Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GeometryIntents and leader AttachedEntity

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
rjay75
1105 Views, 3 Replies

GeometryIntents and leader AttachedEntity

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?

3 REPLIES 3
Message 2 of 4
philippe.leefsma
in reply to: rjay75

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

 intent.png

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
rjay75
in reply to: philippe.leefsma

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?

Message 4 of 4
philippe.leefsma
in reply to: rjay75

Intent property is described in the API Help Files:

 

GeometryIntent.Intent Property

Description

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.

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report