Organizing multiple closed polyline(s) information into lists

Organizing multiple closed polyline(s) information into lists

rvtquestions
Advocate Advocate
759 Views
3 Replies
Message 1 of 4

Organizing multiple closed polyline(s) information into lists

rvtquestions
Advocate
Advocate

I am trying to extract as much information about a (user prompted) selected set of closed polylines into lists so that I would have a matching set of lists corresponding respectively. In Example, pLset would hold the set of polylines, ptset would hold the respective points of the polylines, objset would hold the objects inside the respective polylines, etc...

 

In the code below, it prompts the user to select closed polylines which get put into pLset. It goes on to collect the Area and Object ID with a running counter i. From there I would like to create a matching set that would as mentioned earlier hold the respective points to be then used to filter a WP ssget selection to get the objects inside each respective polyline in the pLset, ultimately leaving me with a set for the polyline, its points, and its containing objects. So if I wanted in the end I could print or extract all or a specific polyline and its information. Hopefully this makes sense. I would greatly appreciate any direction. Thank you!

 

 

(princ "\n Select Polyline Boundary ")
(if (setq pLset (ssget '((0 . "LWPOLYLINE")(-4 . "&")(70 . 1))))
(progn

(repeat
(setq cnt (sslength pLset))
(setq a (vlax-ename->vla-object (ssname pLset i)))
(setq tlst (list (vla-get-Area a) (vla-get-ObjectID a)))
(setq lst (cons tlst lst))

(setq i (1+ i))

0 Likes
760 Views
3 Replies
Replies (3)
Message 2 of 4

john.uhden
Mentor
Mentor
Looks like you are on your way. I think you are missing (setq i 0) within (progn...

Regarding a list of points surrounding objects that are within a polyline, I have to ask if any of the polyline segments is bulged (arced/curved). If so, cutting straight across a curve from start to end may not capture something within the curve segment. In that case you will want to approximate the curve with additional points. This can be done by using parameters, as in (setq p (vlax-curve-getpointatparam a 3.1)) etc.

John F. Uhden

0 Likes
Message 3 of 4

stevor
Collaborator
Collaborator

If the rest of the code is valid,

then a short addition would suffice.

 

Change:

(if (setq pLset (ssget '((0 . "LWPOLYLINE")(-4 . "&")(70 . 1))))

to:

(if (setq i 0  pLset (ssget '((0 . "LWPOLYLINE")(-4 . "&")(70 . 1))))

S
0 Likes
Message 4 of 4

john.uhden
Mentor
Mentor
That's very efficient. Good work!

John F. Uhden

0 Likes