Jump to content

Convert 3d polyline coordiantes to Excel


Recommended Posts

I am looking for a way to convert a 3D polyline to a CSV file or table of X, Y & Z coordinates which can be pasted into Excel.

 

I've found a couple of lisps via Google that seemed to do this although don't work on AutoCad 2015/16.

 

Does anyone know of a lisp that does do this or another way out of the box to do this?

 

Edit: thread typo...

Link to comment
Share on other sites

My co-ords.lsp should do it need to add the extra nth for the z, code is for 2d but it should be self explanatory to make 3d. Just add write-line rather than cons xy line, I do have another adds point number etc .

 

; pline points 2d & 3d as list
; pline co-ords example
; By Alan H
(defun getcoords (ent)
 (vlax-safearray->list
   (vlax-variant-value
     (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
     )
   )
 )
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq len (length co-ords))
(setq numb (/ len 2)) ; even and odd check required change code
;(setq numb (/ len 3)) ; even and odd check required
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) ; 2d 
; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) )) ;3d
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)

; program starts here
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy) ; list of 2d points making pline

Link to comment
Share on other sites

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...