how to merge Polyline

how to merge Polyline

reithinger
Advocate Advocate
1,370 Views
6 Replies
Message 1 of 7

how to merge Polyline

reithinger
Advocate
Advocate

Hi,

I have an exemple.

I have 2 Polyline the red and the blue.

I want to get the green polyline.

Have you any Idea how can i make this ?

Thanks in advancemixedpolyline.jpg

Fabrice

0 Likes
Accepted solutions (2)
1,371 Views
6 Replies
Replies (6)
Message 2 of 7

Norman_Yuan
Mentor
Mentor
Accepted solution

Here are 2 approaches:

 

1. Test 2 polyline's intersection points (you should find 2 intersection points in this case); then use Curve.GetSplitCurves() to split the 2 polylines (i.e. the rectangle polyline would be split into 2 parts, while the pass-through polyline would be split into 3 parts.; then use Entity.JoinEntity() to merge the middle part of the pass-through polyline with either half of the rectangle polyline.

 

2. if you can obtain a point inside the green area (any point your code can identify that is inside the area; or simply ask user to pick anywhere inside), then call Editor.TraceBoundary(). This would be similar as running "BOUNDARY" command.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 7

reithinger
Advocate
Advocate

Hi Norman,

when you have a solution to take a point in the green area (without user pick) it were perfekt.

0 Likes
Message 4 of 7

kerry_w_brown
Mentor
Mentor

@reithinger 

Fabrice,

For interests sake, what criteria determines the correct side to choose ?

 

Stay well,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 5 of 7

reithinger
Advocate
Advocate

Hi Kerry,

That my problem, i don't know...

The best way is to use the TraceBoundary but you must find the right point to use...

Sorry i can't answer you..

0 Likes
Message 6 of 7

_gile
Consultant
Consultant
Accepted solution

Hi,

You use or get inspired by the TrySlice method of the Polygon2d class from GeometryExtensions library.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 7 of 7

ActivistInvestor
Mentor
Mentor

The only way you can solve the problem is to know which side of the green Arc you are interested in finding a closed boundary with. You need to supply all of the input order to obtain the result. 

0 Likes