SSGET with additional filter?

SSGET with additional filter?

Anonymous
Not applicable
1,824 Views
13 Replies
Message 1 of 14

SSGET with additional filter?

Anonymous
Not applicable

Hi,

 

I try to pick object that have closed boundary with ssget

(ssget '((0 . "*POLYLINE")))

 But it doesn't include circle or other closed boundary objects? 

 

How can I select all closed boundary objects in a drawing with ssget or add some object type filter in ssget?

So it maybe seem like this

 

(ssget '((0 . "*POLYLINE") (0. "CIRCLE")))

 

Many thanks.

 

 

 

 

0 Likes
Accepted solutions (1)
1,825 Views
13 Replies
Replies (13)
Message 2 of 14

hmsilva
Mentor
Mentor
Accepted solution

Hi maikhanhmst,

 

untested, I don't have AutoCAD in this laptop...

 

(ssget '((-4 . "<OR")
         (-4 . "<AND")(0 . "*POLYLINE,SPLINE")(-4 . "&=")(70 . 1) (-4 . "AND>")
         (-4 . "<AND")(0 . "ELLIPSE")(41 . 0.0)(-4 . "AND>")
         (-4 . "<AND")(0 . "CIRCLE,REGION")(-4 . "AND>")
         (-4 . "OR>")
        )
)

 

Hope this helps,
Henrique

 

 

 

 

EESignature

Message 3 of 14

stevor
Collaborator
Collaborator

As long as you are at it,

might as well see it all at:

http://www.lee-mac.com/ssget.html

 

Your statement could be:

 

 (setq ss (ssget "x"'((-4 . "<OR")  
  (-4 . "<AND") (0 . "*POLYLINE") (70 . 1) (-4 . "AND>")   
  (0 . "CIRCLE")  (-4 . "OR>")) ))
 (princ" \n Closed: ") (prin1 (sslength ss))

 (setq ss (ssget "x"'((-4 . "<OR") (0 . "*POLYLINE") (0 . "CIRCLE")(-4 . "OR>"))))
 (princ" \n Any: ") (prin1 (sslength ss))

 

S
Message 4 of 14

Anonymous
Not applicable

Hi everybody,

Thank you for your replies.

The code picked some of closed boundary objects in my drawing, not all of them.

I also attached the drawing. 

 

0 Likes
Message 5 of 14

dbroad
Mentor
Mentor

Are you sure that the ones not selected are closed?  Every one I tested that was not selected was not closed but looked closed.

If you want to select both closed and those that look closed, perhaps this would work.

(setq ss(ssget '((-4 . "<OR")
         (-4 . "<AND")(0 . "LWPOLYLINE,SPLINE")(-4 . "&")(70 . 1) (-4 . "AND>")
	 (-4 . "<AND")(0 . "POLYLINE")(-4 . "<NOT") (-4 . "&")(70 . 112)(-4 . "NOT>") (-4 . "AND>")
         (-4 . "<AND")(0 . "ELLIPSE")(41 . 0.0)(-4 . "AND>")
         (-4 . "<AND")(0 . "CIRCLE,REGION")(-4 . "AND>")
         (-4 . "OR>")
        )
))

 

Architect, Registered NC, VA, SC, & GA.
Message 6 of 14

hmsilva
Mentor
Mentor

maikhanhmst wrote:

The code picked some of closed boundary objects in my drawing, not all of them.

I also attached the drawing. 

 


Hi maikhanhmst,

the not selected boundaries, are not closed...

 

Henrique

EESignature

0 Likes
Message 7 of 14

pbejse
Mentor
Mentor

@hmsilva wrote:
...the not selected boundaries, are not closed... 

Henrique


Thats always been most of the time Smiley Happy

 

Perhpas Autodesk needs to resolve that issue by automatically flagging the polylines as closed when the start and endpoint is the same, or a system variable for such cases with fuzz value 

0 Likes
Message 8 of 14

hmsilva
Mentor
Mentor

@pbejse wrote:

@hmsilva wrote:
...the not selected boundaries, are not closed... 

Henrique


Thats always been most of the time Smiley Happy

 

Perhpas Autodesk needs to resolve that issue by automatically flagging the polylines as closed when the start and endpoint is the same, or a system variable for such cases with fuzz value 


Yes pBe, that's true! Smiley Happy

I also agree that polylines should be flagged automatically as closed when the start and endpoint is the same.

 

Cheers

Henrique

EESignature

0 Likes
Message 9 of 14

stevor
Collaborator
Collaborator

The case where a LWPOLYLINE, POLYLINE, ARC, or anything that looks 'closed' but is in fact only with its end vertices in close proximity, can be tested by the 'vlax-curve-getStartParam, and 'vlax-curve-getEndParam, and so on. Probably worth doing in all cases of less than perfect DWGs.

S
0 Likes
Message 10 of 14

hmsilva
Mentor
Mentor

@stevor wrote:

The case where a LWPOLYLINE, POLYLINE, ARC, or anything that looks 'closed' but is in fact only with its end vertices in close proximity, can be tested by the 'vlax-curve-getStartParam, and 'vlax-curve-getEndParam, and so on. Probably worth doing in all cases of less than perfect DWGs.


Hi stevor,

probably you meant vlax-curve-getStartPoint and vlax-curve-getEndPoint

My understanding is that there should be easier to the user to identify a non closed *polyline/spline, possibly with some rollover icon and right click to close the object...

Some users, do not know that an object with coincident startpoint/endpoint is not by default a closed object.

 

Henrique

EESignature

0 Likes
Message 11 of 14

Kent1Cooper
Consultant
Consultant

If you have Polylines that are not closed [whether they appear to be or not], but that you want closed, try PLsCloseCorner.lsp, available here.  There's a single-selection version, PLCloseCorner.lsp, at Post 14 on the same thread, but I assume you'd rather have the one that will do it to all open Polylines in the drawing [or in the User's selection, if the noted modification is made].  There are other approaches on that same thread, and considerable discussion about the difference between Polylines that are closed and those that look closed but are not.

Kent Cooper, AIA
0 Likes
Message 12 of 14

Anonymous
Not applicable
Hi everybody,
Many thanks.
My problem was solved.
I also realized the different is 2D polyline (not a closed object) and polyline (a closed object).
Thank you 🙂
0 Likes
Message 13 of 14

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:
.....
I also realized the different is 2D polyline (not a closed object) and polyline (a closed object).
....

Not always.  2D Polylines can be open or closed, and Lightweight Polylines can be open or closed, and 3D Polylines can be open or closed, and any variety of Polyline can look like it's closed but not really be closed, having its starting and ending points in the same place.  [Splines and Multilines also have the same possibilities.]

Kent Cooper, AIA
0 Likes
Message 14 of 14

Anonymous
Not applicable
Thank you 😄
0 Likes