Results 1 to 2 of 2

Thread: Using an external look-up csv table for variable translation

  1. #1
    Login to Give a bone
    0

    Default Using an external look-up csv table for variable translation

    I've got a LISP that currently works on a block attribute 'CODE' and I've got a .csv used for translating drawing layers from one nomenclature to another.

    If in the csv column 1 is 'CODE' and column 2 is 'LAYER' how do I tell the LISP I've got to exchange CODE for LAYER? This is the basic LISP:

    (defun c:ASLX ( / )

    (varopen)
    (setq Blnamex (car(entsel "\nSelect:")))
    (setq SIZE () material () code ())
    (GATTRIB Blnamex)
    (CoordBL Blnamex)
    (MatSiText Size Material)
    (setq leadlay (strcat code "-TEXT"))
    (COMMAND "-LAYER" "M" leadlay "")
    (COMMAND "_MLEADER" coord PAUSE TX)
    (Varclose)
    (princ)
    )

    I know there's a lot of other functions happening in here, but I just need some way of using the CODE variable to look-up a csv and return the LAYER valu. ATM I've got a long workaround that uses the CODE and suffixes it with -TEXT so I can isolate and manually shift the Mleaders into the required layers. ANy help appreciated.

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Using an external look-up csv table for variable translation

    You can either read a file line by line look for match.

    Or convert csv to a list then step through list looking for match ((code1 layer1)(code2 layer2)...

    There is plenty of read csv to list out there start with Lee-mac.com

    If talking survey codes we had like 250+ not huge, there is a method 10,000 entries takes 13 goes max to find to do with indexing.

Similar Threads

  1. Export table to CSV
    By georgii_daneliya720261 in forum AutoLISP
    Replies: 0
    Last Post: 2017-02-22, 09:55 AM
  2. Families using CSV files vrs using Conditional Statements
    By bmendiuk710733 in forum Revit MEP - Families
    Replies: 0
    Last Post: 2012-08-27, 11:07 PM
  3. 2011: CSV Import to Table
    By gneuhaus in forum AutoCAD General
    Replies: 1
    Last Post: 2010-11-09, 04:11 PM
  4. Replies: 4
    Last Post: 2009-05-04, 06:07 AM
  5. Replies: 2
    Last Post: 2008-05-09, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •