TheSwamp

Code Red => .NET => Topic started by: huiz on September 18, 2014, 04:55:21 AM

Title: Mimic the Civil3D function to color the selected path
Post by: huiz on September 18, 2014, 04:55:21 AM
Is it possible to mimic the way Civil3D colors the path while selecting, using a jig? And if so, does it not use a lot of resources to continuously calculate a part of a polyline while moving around?

In Civil3D, for example, if you split a Parcel, you can select the path along a Parcel line and while dragging the mouse, you see a colored line along the Parcel lines from the first selected point to the place where the cursor is, untill you click.

I know it is possible to split a polyline with Curve.GetSplitCurves() but is that the way to get a part of the polyline and show it as a jig? Or are there smarter functions to do this?





Title: Re: Mimic the Civil3D function to color the selected path
Post by: Gasty on September 19, 2014, 12:06:29 AM
Hi,

I'm not sure as I'm not a C3D user or developer, but you can try with a combination of point monitor, transient graphics, and some clever treatment of the polyline segments. The are good examples of point monitor and transient graphics out there, just google a little.

Gaston Nunez
Title: Re: Mimic the Civil3D function to color the selected path
Post by: n.yuan on September 19, 2014, 04:02:18 PM
I do not use Civil3D, therefore not very sure what the feature you are referring does. But I can guess what you want and just did a quick enhancement to one my existing piece of code. Instead of post incomplete portion of that code, I though it would be better to post it as whole in my blog.

Here is the link:

http://drive-cad-with-code.blogspot.ca/2014/09/moving-mouse-cursor-to-trace-polyline.html (http://drive-cad-with-code.blogspot.ca/2014/09/moving-mouse-cursor-to-trace-polyline.html)

HTH
Title: Re: Mimic the Civil3D function to color the selected path
Post by: huiz on September 20, 2014, 12:55:20 AM
Wow Norman! It is exactly what I described! Thank you very much for this code!

I would be happy already with some tips, but full working code is really cool! :-) Saves me a lot of time to implement.
Title: Re: Mimic the Civil3D function to color the selected path
Post by: insmur on February 15, 2019, 05:06:10 PM
Firstly , thanks your code, it is real awesome but I have a question.

It is working only line, what about arc?
Title: Re: Mimic the Civil3D function to color the selected path
Post by: n.yuan on February 20, 2019, 11:53:29 AM
Well, you need to update to code (the "DrawTransientGraphics()" method in my article) to draw the transient graphics correctly. For straight line/segment, it is easy, as the code shows; but it is arc/curved segment, you need to figure/calculate the arc/curve's radius and calculate the arc/curve's length according to current cursor location. It should be a simple math work, I suppose.