Jump to content

Recommended Posts

Posted

Hello is there a lisp that will allow me to export linework into a x/y/z csv file along with also the field for the layer its on??

 

Thanks

 

Posted

Can you attached example drawing 

Posted

How does this work for a starter?

https://autocadtutorial22.blogspot.com/2020/04/15-13a-autocad-export-coordinates.html

 

 

;;https://autocadtutorial22.blogspot.com/2020/04/15-13a-autocad-export-coordinates.html
(defun C:c2exc2 (/ coords coor_list elist en fd fname i ss)
  (setq ss
        (ssget "_:S" '((0 . "*POLYL*,LINE,CIRCLE,ARC,ELLIPSE,SPLINE,POINT")))
        i -1
  )
  (repeat (sslength ss)
  (setq i (1+ i)
        en (ssname ss i)
        elist (entget en)
        coords (vl-remove-if (function not)
          (mapcar (function (lambda (x)(if (eq 10 (car x))(trans (cdr x) 0 1)))) elist) )
        coor_list (cons coords coor_list))
  )
  (setq coor_list (reverse coor_list))
  (setq fname (getfiled "Type file name" "" "csv" 1))
  (setq fd (open fname "w"))
  (foreach coors coor_list
    (foreach i coors
      (princ (strcat (rtos(car i)) "\t"
        (rtos (cadr i))"\t"
        (rtos (caddr i)) "\n")
        fd
      )
    )
  )
  (close fd)
  (princ)
)

 

  • Like 1
Posted

Has been asked many times before Google "export linework co-ordinates to csv Autocad lisp"

 

Again post a sample dwg . 

 

"also the name for the layer its on??"

 

Do you want direct to excel ?

 

Do you want line counts by layer and length ? Just getting to the next request after code is posted.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...