.NET

Reply
Active Contributor
R.Gerritsen4967
Posts: 47
Registered: ‎07-31-2009
Message 1 of 3 (2,368 Views)
Accepted Solution

Selecting closed polylines with 'Linetype generation' enabled.

2368 Views, 2 Replies
09-05-2013 01:51 AM

I have a piece of code that needs closed polylines.

I use the following selectionfilter to filter the selection so I can only select closed polylines:

 

Dim sf As New SelectionFilter(New TypedValue() {New TypedValue(0, "LWPOLYLINE"), New TypedValue(70, 1)})

 

Today I noticed that in some drawings this filter won't select all the closed polylines for me.

After some experimenting I found the 'linetype generation' property of the polylines to be the problem. If this is enabled the above filter will not let me select a closed polyline. If I disable it, there is no problem.

 

How can I make my code for selecting closed polylines more robust? Is there a 'TypedValue' for closed polylines with the linetype generation enabled?

The DXF code 70 for polylines is a bit code, 1 = closed, 128 = ltgen enabled. So use the relational test "&":

Dim sf As New SelectionFilter(New TypedValue() {New TypedValue(0, "LWPOLYLINE"), New TypedValue(-4, "&"), New TypedValue(70, 1)})

 

*Expert Elite*
Jeff_M
Posts: 4,478
Registered: ‎07-22-2003
Message 2 of 3 (2,351 Views)

Re: Selecting closed polylines with 'Linetype generation' enabled.

09-05-2013 06:56 AM in reply to: R.Gerritsen4967

The DXF code 70 for polylines is a bit code, 1 = closed, 128 = ltgen enabled. So use the relational test "&":

Dim sf As New SelectionFilter(New TypedValue() {New TypedValue(0, "LWPOLYLINE"), New TypedValue(-4, "&"), New TypedValue(70, 1)})

 

Jeff_M, also a frequent Swamper
Active Contributor
R.Gerritsen4967
Posts: 47
Registered: ‎07-31-2009
Message 3 of 3 (2,346 Views)

Re: Selecting closed polylines with 'Linetype generation' enabled.

09-05-2013 07:25 AM in reply to: Jeff_M

Thanks Jeff_M!

This works well!!
It looks so simple. I was digging further into this just now, and I already found the bitcode 128, but I could not get it to work.
I was messing around with Conditional selections (AND, OR, etc.).
Your solution looks really elegant, but it leaves me with another question:
What does the (-4, "&") mean?
the 128 is not mentioned in your code. So how does this work?


Nevermind... I found the info I needed right here.

Your solution just looks for any polyline that is closed but it can have other properties as well, as long as it is closed....

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!