3d polyline vertices

3d polyline vertices

Anonymous
Not applicable
2,354 Views
2 Replies
Message 1 of 3

3d polyline vertices

Anonymous
Not applicable
I would like to obtain all of the vertices on a given 3DPolyline. I can get to the point where I have a list with the (100 . "AcDb3dPolyline") , but do not know where or what to do after that point.

Can someone give me a little push to let me know where i may find this information from?

Thanks
0 Likes
2,355 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant
Hi,

Here're two ways.

Using DXF codes vertices are sub entities of the 3dpoly, have to use (entnext ...)

(setq poly (car (entsel)))
(setq vtx (entnext poly))
(while (/= (cdr (assoc 0 (setq elst (entget vtx)))) "SEQEND")
(setq lst (cons (cdr (assoc 10 elst)) lst)
vtx (entnext vtx)
)
)
(reverse lst)

Another way using VisualLISP

(vl-load-com)

;; Split a flat list into a points list
(defun 3d-coord->pt-lst (lst)
(if lst
(cons (list (car lst) (cadr lst) (caddr lst))
(3d-coord->pt-lst (cdddr lst))
)
)
)

(setq poly (car (entsel)))
(setq lst (3d-coord->pt-lst (vlax-get (vlax-ename->vla-object poly) 'Coordinates)))


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks gile!!

I appreciate your help and time...Its been a while for me writing some lisp...

Thanks again!
0 Likes