Attempting to mimic C3D's highlight each region as the cursor passes through it during selection of a region to edit. Not seeing how to accomplish this...any hints would be helpful.
Edited to add that I know it will involve using the Editor.PointMonitor event. What I don't know is how to determine which region the cursor is in and then, once I know that, how to get the region boundary in order to highlight it.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Hi jeff.
I would calculate the station (from your alignment) of your cursor, then I would check every region (startregion station and endregion station) if my station is between them to determine the region properly.
Thanks, Joan. That's not quite what I'm looking at doing though. Here's a quick Screencast showing the naitive C3D region selection, and then my attempt at mimicing this selection process. You can see mine does work, but it is painfully slow....
I'd cache the regions of the corridor when the command is first called and then you'd be able to use multithreading to pull the correct region and not get stuck using Civil 3Ds single threaded API to return the value.
Thanks, Christopher. That's what I was doing, but I was using the BoundaryRepresentation managed wrapper to find IsPointInside. It turns out that this process is quite slow, at least in the manner in which I was using it. I've got another method working fairly well, but it is returning some false positives so still need to work on cleaning it up.
But, it's getting closer!
Hi,
Not sure if I can add... but what you mean by 'brute force'? Also, how are you reading the objects inside the PointMonitor event? Maybe we can just improve the current process you have...
Thanks for responding Augusto.
By 'brute force' I meant iterating each baseline->region->applied assembly->link._calculated point to find the boundaries of each region (I do this once at the onset of the command). I then use the PointMonitor RawPoint and check if it lies within one of the polylines formed by the regions. If so, I highlight the region using a TransientGraphic with that polyline and show a small form with the Baseline-Region name.
I actually have a version of this working well now. Would've been nice to be able to tap into what C3D uses internally for this, if, for no other reason, to be able to keep my command looking like a 'normal' C3D command. Would've saved me a few days of research and testing, too.
@Jeff_M Do you have any tips for getting the region boundaries more efficiently. I've been looping through every AppliedAssembly and getting the extents that way, but this is very slow for large corridors or corridors with dense frequencies. I see you mentioned that you're hitting only the "Top" coded links. I might be able to get some performance gains from that approach, but I know we have assemblies in use that don't have the "Top" link code, or any links at all. I've been looping through all the CalculatedPoints in each AppliedAssembly. I noticed that the Corridor style has an option to display the Region boundaries, so it seems like Civil 3D already has the boundaries computed, but I'm not seeing them buried anywhere.
I thought I might find something useful in the AeccFeatureElevCorridorAndGrading.dll. Some interesting looking classes in there, but not sure what they all do or how to use them.
@keith_sowinski I actually have mine setup so the function requires what code to use to be passed as an argument. But no, I have not found any other way of accomplishing this. I, too, have looked in the other libraries that come with Civil 3D.
Hi Jeff
. Maybe another way would be from the Corridor style which has a component to show the boundary of the corridor Regions. You could export those boundaries to Acad entities temporally and then remove them.
Maybe your hard work is looking for the Baseline -Region name.
Perhaps for a long corridors with too much regions you could avoid/ omit that data.
Regards.
Using the Corridor style to get the region boundaries seem to work well. Although, there is still some lag, especially with very large corridors and the majority of it is on the Explode method.
Can't find what you're looking for? Ask the community or share your knowledge.