+ Reply to Thread
Results 1 to 6 of 6

Thread: Autolisp Help

  1. #1
    Forum Newbie
    Using
    Civil 3D 2012
    Join Date
    Aug 2013
    Posts
    2

    Default Autolisp Help

    Registered forum members do not see this ad.

    Does anyone know how to create a lisp that will export a csv file with object data and coordinates?

    Example;

    od field 1, od field 2,etc... x1,y1,z1,x2,y2,z2,etc....

    Ideally it should be able to report all object data fields irregardless of the number. And it should report all xyz coordinates of polylines.

    I would also need a lisp to import csv files from the above format.

    If your curious this is all in an attempt to solve the 4 coordinate limits that map3d puts on exporting shape files... If someone has an alternate solution to that, I'm all ears!

    Dalivore

  2. #2
    Super Member irneb's Avatar
    Computer Details
    irneb's Computer Details
    Operating System:
    Win7 Pro 64bit
    Computer:
    Antec One Hundred
    Motherboard:
    ASUS P8P67-Pro P67
    CPU:
    Intel i7 2600 @ 3.4GHz
    RAM:
    16GB-1600MHz
    Graphics:
    GeForce GT 430 (1GB)
    Primary Storage:
    Seagate1TB SATA2 - 7200rpm
    Monitor:
    Samsung 2333TN 23" 1920 x 1080 Full HD LCD Monitor2GW
    Discipline
    Architectural
    irneb's Discipline Details
    Occupation
    Architectural Technician and Programmer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Sep 2010
    Location
    Jo'burg SA
    Posts
    1,744

    Default

    Not sure if there's already one of these somewhere. I know there's a lot of CSV export & import stuff around, but if they're specific to C3D/Map entity data I definitely don't know.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  3. #3
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    An old solution its called a DXF file contains all object data and co-ords and its simple text file !
    A man who never made mistakes never made anything

  4. #4
    Super Member Commandobill's Avatar
    Using
    AutoCAD 2014
    Join Date
    Oct 2008
    Location
    Raleigh, NC
    Posts
    538

    Default

    I have something buried in the archives... let me find it. It ges rather hard as I would always name my code something random when I started...
    ***Commandobill***
    Abusing AutoCad Since 1999
    "Caddatude... Do you has it?"
    Sorry for my poor English, I'm American...

  5. #5
    Super Member Commandobill's Avatar
    Using
    AutoCAD 2014
    Join Date
    Oct 2008
    Location
    Raleigh, NC
    Posts
    538

    Default

    Also, If you have an example dwg I could test it with... that would be superb.
    ***Commandobill***
    Abusing AutoCad Since 1999
    "Caddatude... Do you has it?"
    Sorry for my poor English, I'm American...

  6. #6
    Super Member Commandobill's Avatar
    Using
    AutoCAD 2014
    Join Date
    Oct 2008
    Location
    Raleigh, NC
    Posts
    538

    Default

    Registered forum members do not see this ad.

    Not perfect, but...

    Code:
    (defun c:objectDataExtract(/ coordslist count ent f fieldnames fieldstring path ss ssents strcatlst tablelist x z)
      (vl-load-com)
      (if (and (setq path (getfiled "Specify .CSV file name:"
        (getvar 'dwgprefix)
        "csv"
        1
        )
       )
        
        (setq ss (ssget "x")); SELECT EVERYTHING
        (setq ssEnts (vl-remove-if-not 'ade_odgettables (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))));Filter out only that which has a table attached to it
            (progn
          (setq f (open path "w"))
          (foreach ent ssents
     (setq tablelist (ade_odgettables ent))
     (setq count 0)
     (repeat (length tablelist)
       (foreach def (cdr (assoc "Columns" (ade_odtabledefn (nth count tablelist))))
         (if (not (member (cdr (assoc "ColName" def)) fieldnames))
           (setq fieldnames (cons (cdr (assoc "ColName" def)) fieldnames))
           )
         )
       
       )
     
     
     (setq strcatlst
            (apply 'strcat (mapcar '(lambda (x)
          (strcat x ": " (If (/= (type (setq fieldstring (ade_odgetfield ent (ade_odgettables ent) x 0))) 'STR)
             (rtos fieldstring 2 2)
             fieldstring) ",")) fieldnames)))
     
     (setq coordsList (apply 'strcat (mapcar '(lambda (z) (strcat (rtos z 2) ",")) (vlax-get (vlax-ename->vla-object ent) 'Coordinates))))
     (write-line (strcat strcatlst coordsList) f)
     
     )
          (setq f (close f))
    )))
    ***Commandobill***
    Abusing AutoCad Since 1999
    "Caddatude... Do you has it?"
    Sorry for my poor English, I'm American...

Similar Threads

  1. need autolisp
    By git_thailand in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 4th Oct 2011, 03:04 am
  2. Integrate TAPER autolisp into BD (duct) autolisp to improve productivity?
    By fathihvac in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 30th Aug 2011, 02:10 pm
  3. Help autolisp
    By trun652091 in forum AutoCAD General
    Replies: 1
    Last Post: 26th Nov 2010, 02:38 am
  4. about autolisp
    By salman in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 13th May 2009, 12:50 pm
  5. AutoLISP
    By dhruti in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 8th Dec 2005, 09:44 am

Tags for this Thread

Bookmarks

Posting Permissions

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