Leader Note API text Position

Leader Note API text Position

johnster100
Collaborator Collaborator
1,208 Views
2 Replies
Message 1 of 3

Leader Note API text Position

johnster100
Collaborator
Collaborator

Hi,

I'm adding some leaders to a drawing using API, this works fine.

 

However, when I place the leader the text is always to the left or right of the leader, I would like it to be above leader like in the attached image. What property can I access to achieve this?

 

leader image.PNG

 

thanks,

John

0 Likes
Accepted solutions (1)
1,209 Views
2 Replies
Replies (2)
Message 2 of 3

YuhanZhang
Autodesk
Autodesk
Accepted solution

Now in Inventor drawing you can rotate the Leader Note text, but this also changes the text orientation, is it acceptable for you? You can either use LeaderNote.Rotation or below VBA sample to change the text position:

 

Sub ChangeLeaderTextOrientation()
    Dim oLeaderNote As LeaderNote
    Set oLeaderNote = Me.SelectSet(1)
    
    Debug.Print oLeaderNote.Rotation
    oLeaderNote.Rotation = 1.57
    Dim oPo As Point2d
    If oLeaderNote.Leader.HasRootNode Then
        If Not (oLeaderNote.Position.IsEqualTo(oLeaderNote.Leader.RootNode.Position, 0.000001)) Then
            Set oPo = oLeaderNote.Leader.RootNode.Position
            
            oPo.X = oLeaderNote.Leader.RootNode.Position.X
            oPo.Y = oLeaderNote.Leader.RootNode.Position.Y + 0.3
            
            ' Change the leader note text position just above the root node
            oLeaderNote.Position = oPo
        End If
    End If
    
End Sub


If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 3

johnster100
Collaborator
Collaborator

Hi,

that worked great,

 

thanks

0 Likes