dalivore Posted August 19, 2013 Posted August 19, 2013 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 Quote
irneb Posted August 21, 2013 Posted August 21, 2013 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. Quote
BIGAL Posted August 23, 2013 Posted August 23, 2013 An old solution its called a DXF file contains all object data and co-ords and its simple text file ! Quote
Commandobill Posted August 23, 2013 Posted August 23, 2013 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... Quote
Commandobill Posted August 23, 2013 Posted August 23, 2013 Also, If you have an example dwg I could test it with... that would be superb. Quote
Commandobill Posted August 23, 2013 Posted August 23, 2013 Not perfect, but... (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)) ))) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.