Organic Posted April 25, 2016 Share Posted April 25, 2016 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... Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 25, 2016 Share Posted April 25, 2016 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 Quote Link to comment Share on other sites More sharing options...
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.