I am trying to get the drawing curve a leader is attached too. Trying to use the api and getting the AttachedEntity either through traversing the LeaderNodes or using Leader._AttachedEntity it seems to always return an IntentType of kParameterIntent. Even if use the api to create the leader and pass it an IntentType of kGeometryIntent, it has an IntentType of kParameterIntent.
How can I retrieve the drawing curve that a leader is attached too?
Solved! Go to Solution.
Solved by philippe.leefsma. Go to Solution.
Hi Rodney,
Using the following code I am creating a leader that has an AttachedEntity of type GeometryIntent with IntentType kGeometryIntent and its Geometry property returns a drawing curve:
Public Sub AddLeaderNote() ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument ' Set a reference to the active sheet. Dim oActiveSheet As sheet Set oActiveSheet = oDrawDoc.ActiveSheet ' Set a reference to the drawing curve segment. ' This assumes that a drawing curve is selected. Dim oDrawingCurveSegment As DrawingCurveSegment Set oDrawingCurveSegment = oDrawDoc.SelectSet.item(1) ' Set a reference to the drawing curve. Dim oDrawingCurve As DrawingCurve Set oDrawingCurve = oDrawingCurveSegment.Parent ' Get the mid point of the selected curve ' assuming that the selected curve is linear Dim oMidPoint As point2d Set oMidPoint = oDrawingCurve.MidPoint Dim oLeaderPoints As ObjectCollection Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection ' Create an intent and add to the leader points collection. ' This is the geometry that the leader text will attach to. Dim oGeometryIntent As GeometryIntent Set oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve, oMidPoint) Call oLeaderPoints.Add(oGeometryIntent) Dim oLeaderNote As LeaderNote Set oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, "API") End Sub
Regards,
Philippe.
Thank you. I was looking at the IntentType and Intent properties. Because IntentType never was kGeometryIntent I didn't think it had the curve. Unfortunately in C# some of the properties type just displays as ComObject.
What does the value of the Intent property hold?
Intent property is described in the API Help Files:
Property that returns the intent point on the input geometry. This can be a value from PointIntentEnum, a geometry if the intent is the intersection of two geometries, a Point2d object that specifies a sheet point on the geometry or a double value indicating the parameter on the input curve geometry.