AutoCAD Civil 3D Customization

Reply
Mentor
tyronebk
Posts: 164
Registered: ‎08-17-2007
Message 1 of 6 (357 Views)
Accepted Solution

Get Profile View for selected Profile

357 Views, 5 Replies
12-22-2010 04:46 PM

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.

*Expert Elite*
Jeff_M
Posts: 4,198
Registered: ‎07-22-2003
Message 2 of 6 (353 Views)

Re: Get Profile View for selected Profile

12-22-2010 05:31 PM 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
*Expert Elite*
Jeff_M
Posts: 4,198
Registered: ‎07-22-2003
Message 3 of 6 (348 Views)

Re: Get Profile View for selected Profile

12-22-2010 10:09 PM 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
Mentor
tyronebk
Posts: 164
Registered: ‎08-17-2007
Message 4 of 6 (327 Views)

Re: Get Profile View for selected Profile

12-23-2010 11:20 AM 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.

 

*Expert Elite*
Jeff_M
Posts: 4,198
Registered: ‎07-22-2003
Message 5 of 6 (326 Views)

Re: Get Profile View for selected Profile

12-23-2010 12:07 PM 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
Mentor
tyronebk
Posts: 164
Registered: ‎08-17-2007
Message 6 of 6 (321 Views)

Re: Get Profile View for selected Profile

12-23-2010 12:59 PM 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Civil 3D Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for AutoCAD Civil 3D helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Civil 3D

Twitter

Facebook

Blogs