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.
Solved! Go to Solution.
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
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.
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.
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.
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.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register