i am making a command in vb.net which user pick a polyline and the program get it's layer name and place a text that lines up with the polyline.
i can pick the polyline and get layer and put text no problem. but how do i go from GetSelection() to getting a proximity coordinate and get the vertex and previous (or next) vertex and get an angle and apply to the text?
see attached picture for what i am trying to do.
Solved! Go to Solution.
Solved by caddzone. Go to Solution.
Set the PromptSelectionOptions.PrepareOptionalDetails argument to true, and
then if the user picks the polyline, the object in the selection set will be a
PickPointSelectedObject, and you can examine it to find out where it was
picked. You can use Curve.GetParameterAtPoint() to get the index of the
vertex/segment that was picked based on the pick point.
hi Tony
i found out how to get the point user selected, but can you tell me how the curve.GetParameterAtPoint works?
thanks.
i got the point like this:
Dim poly As Polyline = TryCast(tr.GetObject(prResult.Value(0).ObjectId, OpenMode.ForRead), Polyline)
Dim ppso As PickPointSelectedObject = DirectCast(prResult.Value(0), PickPointSelectedObject)
Dim p3d As Point3d = poly.GetClosestPointTo(ppso.PickPoint.PointOnLine, False)
but it's not the point i want. i want the closest vertex. so i can get it's index and get the next one and calculated an angle.
right now it's giving the picked point on the polyline. it's what some people want not for me this time.
The GraphicsSystemMarker property of the PickPointSelectedObject
gives you the index of the selected polyline segment.
ha, you are genius. there is no way i can figure this out on my own.
thank you so much!