Accessing vertices of polyline

Accessing vertices of polyline

Anonymous
Not applicable
2,309 Views
1 Reply
Message 1 of 2

Accessing vertices of polyline

Anonymous
Not applicable

Hello, this might be very basic question, but I couldn't find simple example code. 😞

 

I have a polyline as below,polyline.jpg

 

I want to access each vertices on this polyline by AutoCAD lisp.

Could you show me a simple code for doing this?

0 Likes
Accepted solutions (1)
2,310 Views
1 Reply
Reply (1)
Message 2 of 2

pbejse
Mentor
Mentor
Accepted solution

@Anonymous wrote:

I want to access each vertices on this polyline by AutoCAD lisp.

 


Indeed its basic. get the list of vertices and do waht with it?

 

(setq ss   (entget (car (Entsel "\nSelect Polyline")))
        pt_lst (mapcar
                 'cdr
                 (vl-remove-if-not '(lambda (x) (= (car x) 10)) ss)))

 

Do you need the z coordinates as well?

(setq e (car (Entsel "\nSelect Polyline")))    
(repeat (setq p (1+ (fix (setq p (vlax-curve-getEndParam e)))))
(setq l (cons (vlax-curve-getPointAtParam e (setq p (1- p))) l))
)

HTH