Cutting Polyline

Cutting Polyline

ChuotSieuNhan
Contributor Contributor
1,053 Views
7 Replies
Message 1 of 8

Cutting Polyline

ChuotSieuNhan
Contributor
Contributor

Hello everyone, I use Google Translate to ask questions in English, hope you understand, can you guide how to split polyline into 2 polyline segments and show the preview length as shown in the video below. I have researched through Jigging but still have not found a solution. Hope you can help me to solve the above problem. Thank you ❤️

0 Likes
1,054 Views
7 Replies
Replies (7)
Message 2 of 8

ChuotSieuNhan
Contributor
Contributor

I want when I click on the Polyline to cut the polyline into 2 segments and display the preview length so I can choose the desired length.

0 Likes
Message 3 of 8

ChuotSieuNhan
Contributor
Contributor

i really need help ☹️

0 Likes
Message 4 of 8

kerry_w_brown
Advisor
Advisor

What have you tried so far ?


// 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 8

ChuotSieuNhan
Contributor
Contributor

i have searched how to use jigging but still haven't found a solution to do so

0 Likes
Message 6 of 8

norman.yuan
Mentor
Mentor

Whether you can use "Jig" or not, the essence of your issue is to help user to select a split point on a line/polyline (or in general, a Curve) with visual aid, which would show potential points to pick (not just anywhere along the curve), the length of the two split segments (as for the overlaps required as your picture show, it is just for extra calculation). That is, with a given line, you only need to visually guide user to pick a slit point. Once the split point is obtained, you can do whatever with it (actual splitting the line/curve into 2, extending the 2 segments to an overlapped range, ...).

 

Surely, you can create your own Jig to do this. Out of the 2 Jig classes - EntityJig and DrawJig - you would likely to use DrawJig for it. However, Since you want the single line/polyline entity being drawn as 2 separate entities, it would make things a bit complicated.

 

Since the nature of the operation is just to let user pick a point on the line/polyline, I think that it would be rather simple to call Editor.GetPoint() and wrap the call in between adding/removing a handler to Editor.PointMonitor(), and presenting visual aid inside the handler with Transient Graphics.

 

I took a bit of time to put together a small project showing the techniques of how to visually help user to pick a split point on a line. I'll post the entire code of the project in my blog shortly when I can find some time. Stay tuned.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 8

norman.yuan
Mentor
Mentor

As promised, see my blog post here:

 

https://drive-cad-with-code.blogspot.com/2023/07/selecting-split-point-of-line-with.html 

 

Again, the code is only meant to demonstrate the techniques to add visual aids to the simple task of select a point by mouse, thus not exactly as @ChuotSieuNhan asked. But one should be able to easily make necessary changes/enhancements to do the same/similar things to make AutoCAD user's point selecting much easier and accurate as the business requires.

 

HTH

 

Norman Yuan

Drive CAD With Code

EESignature

Message 8 of 8

ChuotSieuNhan
Contributor
Contributor

 Thank you very much

0 Likes