Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynamically selecting Corridor Regions

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
Jeff_M
1131 Views, 12 Replies

Dynamically selecting Corridor Regions

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.

Jeff_M, also a frequent Swamper
EESignature
12 REPLIES 12
Message 2 of 13
Jeff_M
in reply to: Jeff_M

Brute force is the answer. Have it nearly working now after a few hours of testing.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 13
Jeff_M
in reply to: Jeff_M

So what I have, works on corridor with a few regions. On one with a few hundred regions it is unbearably slow...back to the drawing board.
Jeff_M, also a frequent Swamper
EESignature
Message 4 of 13
joantopo
in reply to: Jeff_M

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
Message 5 of 13
Jeff_M
in reply to: joantopo

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....

 

 

Jeff_M, also a frequent Swamper
EESignature
Message 6 of 13
Civil3DReminders
in reply to: Jeff_M

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.

Message 7 of 13
Jeff_M
in reply to: Civil3DReminders

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!

Jeff_M, also a frequent Swamper
EESignature
Message 8 of 13
augusto.goncalves
in reply to: Jeff_M

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...

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 9 of 13
Jeff_M
in reply to: augusto.goncalves

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, also a frequent Swamper
EESignature
Message 10 of 13
keith_sowinski
in reply to: Jeff_M

@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.

Message 11 of 13
Jeff_M
in reply to: keith_sowinski

@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.

Jeff_M, also a frequent Swamper
EESignature
Message 12 of 13
joantopo
in reply to: Jeff_M

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
Message 13 of 13
keith_sowinski
in reply to: Jeff_M

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.

  1. Set the region boundaries to visible in the corridor display style
  2. Use the Explode method on the corridor
  3. Get all of the closed Polylines from the resulting BlockReference. (Only the Region boundaries are the closed Polylines)
  4. Set the Corridor style back to the original state

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report