.NET

Reply
Contributor
eriannanda
Posts: 12
Registered: ‎06-15-2011
Message 1 of 4 (1,619 Views)

how to split a polyline at its self intersection points

1619 Views, 3 Replies
07-21-2011 10:50 AM

hi,

 

I'm trying to split a polyline that have some intersection points at its intersection points. So, if a polyline have two self intersection point, then it will become three different polyline. I attach the example of a polyline that I want to split. I wonder, does the get split curve method can help me to do this ? or any other idea how can I do this ?

 

I'm new to .net programming so I still don't know how some methods works

thanks

ADN Support Specialist
adam.nagy
Posts: 587
Registered: ‎03-26-2007
Message 2 of 4 (1,548 Views)

Re: how to split a polyline at its self intersection points

07-26-2011 08:54 AM in reply to: eriannanda

Hi,

 

Yes, GetSplitCurves() could be useful as it can split the polyline, however you have to provide the additional logic that will be able to turn the polyline you attached into 3 closed loop polylines. Depending on which vertex is the start/end point of the polyline you'll get different results.

 

Another thing that might be useful for you to know is that there is a boundary tracing function available since AutoCAD 2011. In AutoCAD 2011 only in the ARX API (I think), but in 2012 it is also available under Editor.TraceBoundary(). If you specify a point that fals inside a loop then it will give you the poly loop around that point. In previous versions you could use the -BOUNDARY command instead.

 

In both cases though first you'd probably have to figure out the intersection points. So you would need to iterate through each segment of the poly and try to intersect it with all the other segments. Depending on the return value of Polyline.GetSegmentType() you would need to call either GetLineSegmentAt or GetArcSegmentAt. These segments then provide an IntersectWith function that you can use.

 

I hope this helps.

 

Cheers,

Adam Nagy

Autodesk Developer Network 



Adam Nagy
Developer Technical Services
Autodesk Developer Network
Contributor
eriannanda
Posts: 12
Registered: ‎06-15-2011
Message 3 of 4 (1,511 Views)

Re: how to split a polyline at its self intersection points

08-03-2011 07:57 PM in reply to: adam.nagy

hi,

 

yes, I found out that there is no simple way to do that, that I have to provide the additional logic to split the polyline

I'm still working on it

 

thanks for your answer !

 

Distinguished Contributor
junoj
Posts: 116
Registered: ‎02-26-2009
Message 4 of 4 (645 Views)

Re: how to split a polyline at its self intersection points

09-23-2013 08:44 AM in reply to: adam.nagy

Thank Adam for the post.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.