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: 

Get Profile View for selected Profile

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
tyronebk
697 Views, 5 Replies

Get Profile View for selected Profile

I really hope I'm overlooking something, but how do you get the profile view object that contains the selected profile. Using .net.

 

The only thing I've come up with is to use the pick point to iterate through the views to see if it is within a view. This is obviously prone to error (overlapping views or if the pick point is slightly outside the view).

 

Thanks for any insights.

5 REPLIES 5
Message 2 of 6
Jeff_M
in reply to: tyronebk

Get the Alignment from the Profile's properties.

Get the ProfileViews from the Alignment properties.

Then determine if the Profile is set to be Drawn in the PV via the ProfileOverrideCollection

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

Actually, instead of the Overrides, since you said the Profile is selected, use the FindStationAndElevationAtXY method of the Alignment's ProfileViews to determine which PV the picked point is in.

Jeff_M, also a frequent Swamper
EESignature
Message 4 of 6
tyronebk
in reply to: Jeff_M

 

Thanks Jeff.

 

I originally went with the FindStationAndElevationAtXY but noticed that it was technically possible to pick outside a view or if you happen to have overlapping views, it could select the wrong one (noted in the original post).

 

I hadn't considered going through the GraphOverrides. I gave it a try but I've run into another problem. If you have more than one profile view for an alignment in a drawing, it can pick the wrong one as there doesn't seem to be any way to differentiate between the profiles in the different views. Debugging seems to indicate that one profile == the other.

 

To avoid some hassle I'm just going to make the user pick the profile view.

 

Back story: I'm trying to add a polyline to an existing profile (the OOTB geometry editor only allows lines and splines). The reason the correct profile view is required is that I need it to translate the pline vertices into stations and elevations (and check for valid PVIs) to add to the profile.

 

Message 5 of 6
Jeff_M
in reply to: tyronebk

I haven't checked in code to verify, but the docs say the FindStationandElevationAtXY "Returns a flag indicating whether the point specified is within the boundary of the profile view." But it sounds like you've found it still returns True when you pick a point outside the PV?

 

The GraphOverrides was just the first thing I thought of...I realized after I posted that this probably wouldn't work.

 

Back to the picked point in a PV. If you test all the PV's for the alignment and get a positive test for "inside the PV" for more than one, couldn't you then ask the user to pick which one? Of course, if you found a bug in the FindS&E@XY then this may not work, either.

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

There isn't a bug with the FindStationandElevationAtXY as far as I can tell. It is just that the condition can arise where if the user selects the profile near the edge of a profile view, the pick point can fall just outside the view but still select the profile. This is obviously a rare case, but just happened to be one I noticed during testing.

As you suggested I will probably do a test to try to find the view, then prompt the user if there are problems identifying it.

As usual, you've been very helpful. My thanks.

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

Post to forums  

Rail Community


Autodesk Design & Make Report