<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Leader note/node from Sketched Symbol in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/leader-note-node-from-sketched-symbol/m-p/10456351#M126306</link>
    <description>&lt;P&gt;I have written a program that takes USER DEFINED &lt;U&gt;sketched symbols&lt;/U&gt; (points in this case).&lt;/P&gt;&lt;P&gt;The program then takes the points and creates a list of all the coordinate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I get to my two problems.&lt;/P&gt;&lt;P&gt;1) - I want the program to put the coordinate in a custom table: I can't get this to work&lt;BR /&gt;&lt;BR /&gt;2) - I want to add a specifier like "AXX" to each points. I tried with Baloons, it wouldn't work, then tried with Leader Text and it won't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using &lt;U&gt;Visual Studio 2019&lt;/U&gt; to create my program&lt;/P&gt;&lt;P&gt;I followed the &lt;U&gt;API Help 2021&lt;/U&gt; to code my things&lt;/P&gt;&lt;P&gt;I searched on the internet for examples, but can't spot the difference from my code.&lt;/P&gt;&lt;P&gt;I linked a picture of what the drawing look like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, I'm trying to add a Leader Text to a Sketched Symbol and it doesn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code for my table&lt;/P&gt;&lt;LI-CODE lang="c"&gt;        Dim oTitles() As String
        ReDim oTitles(1)
        oTitles(0) = "X"
        oTitles(1) = "Y"

        Dim oContent() As Double
        ReDim oContent(oPoints.Count * 2 - 1)

        Dim oColumn As Double
        Dim oRow As Double
        Call Orientation(oOrientationne, oPoints, oOrigin, oContent, oColumn, oRow)



        Dim InsP As Point2d
        InsP = _invApp.TransientGeometry.CreatePoint2d(15, 15)

        Dim oCustomTable As CustomTable


        oCustomTable = oSheet.CustomTables.Add("Coordonnée", InsP, oColumn, oRow, oTitles, oContent)&lt;/LI-CODE&gt;&lt;P&gt;This is the code for my function "Orientation" I'm calling&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Function Orientation(ByVal oOrientation As String, ByVal oPoints As List(Of SketchedSymbol), ByVal oOrigin As OriginIndicator, ByRef oContente() As Double, ByRef Column As Double, ByRef row As Double, Optional oOptional As Boolean = False)

        Dim ThisPoint As SketchedSymbol
        Dim MoinOrigine As Point2d
        MoinOrigine = oOrigin.Intent.PointOnSheet

        If oOrientation = "Vertical" Then
            Dim i As Integer
            row = oPoints.Count
            Column = 2
            For Each ThisPoint In oPoints
                oContente(i) = ThisPoint.Position.X - MoinOrigine.X
                i = i + 1
                oContente(i) = ThisPoint.Position.Y - MoinOrigine.Y
                i = i + 1
            Next

        ElseIf oOrientation = "Horizontal" Then
            Dim i As Integer
            row = 2
            Column = oPoints.Count
            For Each ThisPoint In oPoints
                oContente(i) = ThisPoint.Position.X
                i = i + 1
            Next
            For Each ThisPoint In oPoints
                oContente(i) = ThisPoint.Position.Y
                i = i + 1
            Next
       End If




    End Function
End Class&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And here is my code when I'm trying to create a Leader note&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Dim AverageX As Double
Dim AverageY As Double
AverageX = oView.Width / 2
AverageY = oView.Height / 2

Dim MoinOrigine As Point2d
MoinOrigine = oOrigin.Intent.PointOnSheet

Dim OffX As Double
Dim OffY As Double

Dim b As Integer

For Each ThisPoint In oPoints
     Dim oLeaderPoints As ObjectCollection
     oLeaderPoints = _invApp.TransientObjects.CreateObjectCollection

     b = b + 1

     If ThisPoint.Position.X - MoinOrigine.X &amp;gt;= AverageX Then
         OffX = oView.Width / 15
     ElseIf ThisPoint.Position.X - MoinOrigine.X &amp;lt; AverageX Then
         OffX = -oView.Width / 15
     End If

     If ThisPoint.Position.Y - MoinOrigine.Y &amp;gt;= AverageY Then
         OffY = -oView.Height / 20
     ElseIf ThisPoint.Position.Y - MoinOrigine.Y &amp;lt; AverageY Then
         OffY = oView.Height / 20
     End If


     oLeaderPoints.Add(_invApp.TransientGeometry.CreatePoint2d(60, 45))
     oLeaderPoints.Add(ThisPoint.Position)


     Dim GeomIntentText As GeometryIntent =
     oSheet.CreateGeometryIntent(ThisPoint, ThisPoint.Position)

     oLeaderPoints.Add(GeomIntentText)

     Dim f As String
     f = String.Concat("A", b.ToString)

     Dim OLeaderNote As LeaderNote =
     oSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, f)&amp;lt;FAILS HERE

     Dim oFirstNode As LeaderNode =
     OLeaderNote.Leader.RootNode.ChildNodes.Item(1)
     Dim oSeconNode As LeaderNode =
     oFirstNode.ChildNodes.Item(1)

     oFirstNode.InsertNode(oSeconNode, _invApp.TransientGeometry.CreatePoint2d(ThisPoint.Position.X, ThisPoint.Position.Y))


Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And if this code isn't enough I already have it on GitHub so I can let people at my job change it or propose new feature even when I'm gone - &lt;A href="https://github.com/migui06/DrawingsCoords-PalardyAdd-ins" target="_blank" rel="noopener"&gt;GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can import it and try things with it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File I use for testing linked with this post&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jul 2021 16:11:47 GMT</pubDate>
    <dc:creator>djguiVEC2U</dc:creator>
    <dc:date>2021-07-09T16:11:47Z</dc:date>
    <item>
      <title>Leader note/node from Sketched Symbol</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/leader-note-node-from-sketched-symbol/m-p/10456351#M126306</link>
      <description>&lt;P&gt;I have written a program that takes USER DEFINED &lt;U&gt;sketched symbols&lt;/U&gt; (points in this case).&lt;/P&gt;&lt;P&gt;The program then takes the points and creates a list of all the coordinate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I get to my two problems.&lt;/P&gt;&lt;P&gt;1) - I want the program to put the coordinate in a custom table: I can't get this to work&lt;BR /&gt;&lt;BR /&gt;2) - I want to add a specifier like "AXX" to each points. I tried with Baloons, it wouldn't work, then tried with Leader Text and it won't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using &lt;U&gt;Visual Studio 2019&lt;/U&gt; to create my program&lt;/P&gt;&lt;P&gt;I followed the &lt;U&gt;API Help 2021&lt;/U&gt; to code my things&lt;/P&gt;&lt;P&gt;I searched on the internet for examples, but can't spot the difference from my code.&lt;/P&gt;&lt;P&gt;I linked a picture of what the drawing look like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, I'm trying to add a Leader Text to a Sketched Symbol and it doesn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code for my table&lt;/P&gt;&lt;LI-CODE lang="c"&gt;        Dim oTitles() As String
        ReDim oTitles(1)
        oTitles(0) = "X"
        oTitles(1) = "Y"

        Dim oContent() As Double
        ReDim oContent(oPoints.Count * 2 - 1)

        Dim oColumn As Double
        Dim oRow As Double
        Call Orientation(oOrientationne, oPoints, oOrigin, oContent, oColumn, oRow)



        Dim InsP As Point2d
        InsP = _invApp.TransientGeometry.CreatePoint2d(15, 15)

        Dim oCustomTable As CustomTable


        oCustomTable = oSheet.CustomTables.Add("Coordonnée", InsP, oColumn, oRow, oTitles, oContent)&lt;/LI-CODE&gt;&lt;P&gt;This is the code for my function "Orientation" I'm calling&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Function Orientation(ByVal oOrientation As String, ByVal oPoints As List(Of SketchedSymbol), ByVal oOrigin As OriginIndicator, ByRef oContente() As Double, ByRef Column As Double, ByRef row As Double, Optional oOptional As Boolean = False)

        Dim ThisPoint As SketchedSymbol
        Dim MoinOrigine As Point2d
        MoinOrigine = oOrigin.Intent.PointOnSheet

        If oOrientation = "Vertical" Then
            Dim i As Integer
            row = oPoints.Count
            Column = 2
            For Each ThisPoint In oPoints
                oContente(i) = ThisPoint.Position.X - MoinOrigine.X
                i = i + 1
                oContente(i) = ThisPoint.Position.Y - MoinOrigine.Y
                i = i + 1
            Next

        ElseIf oOrientation = "Horizontal" Then
            Dim i As Integer
            row = 2
            Column = oPoints.Count
            For Each ThisPoint In oPoints
                oContente(i) = ThisPoint.Position.X
                i = i + 1
            Next
            For Each ThisPoint In oPoints
                oContente(i) = ThisPoint.Position.Y
                i = i + 1
            Next
       End If




    End Function
End Class&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And here is my code when I'm trying to create a Leader note&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Dim AverageX As Double
Dim AverageY As Double
AverageX = oView.Width / 2
AverageY = oView.Height / 2

Dim MoinOrigine As Point2d
MoinOrigine = oOrigin.Intent.PointOnSheet

Dim OffX As Double
Dim OffY As Double

Dim b As Integer

For Each ThisPoint In oPoints
     Dim oLeaderPoints As ObjectCollection
     oLeaderPoints = _invApp.TransientObjects.CreateObjectCollection

     b = b + 1

     If ThisPoint.Position.X - MoinOrigine.X &amp;gt;= AverageX Then
         OffX = oView.Width / 15
     ElseIf ThisPoint.Position.X - MoinOrigine.X &amp;lt; AverageX Then
         OffX = -oView.Width / 15
     End If

     If ThisPoint.Position.Y - MoinOrigine.Y &amp;gt;= AverageY Then
         OffY = -oView.Height / 20
     ElseIf ThisPoint.Position.Y - MoinOrigine.Y &amp;lt; AverageY Then
         OffY = oView.Height / 20
     End If


     oLeaderPoints.Add(_invApp.TransientGeometry.CreatePoint2d(60, 45))
     oLeaderPoints.Add(ThisPoint.Position)


     Dim GeomIntentText As GeometryIntent =
     oSheet.CreateGeometryIntent(ThisPoint, ThisPoint.Position)

     oLeaderPoints.Add(GeomIntentText)

     Dim f As String
     f = String.Concat("A", b.ToString)

     Dim OLeaderNote As LeaderNote =
     oSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, f)&amp;lt;FAILS HERE

     Dim oFirstNode As LeaderNode =
     OLeaderNote.Leader.RootNode.ChildNodes.Item(1)
     Dim oSeconNode As LeaderNode =
     oFirstNode.ChildNodes.Item(1)

     oFirstNode.InsertNode(oSeconNode, _invApp.TransientGeometry.CreatePoint2d(ThisPoint.Position.X, ThisPoint.Position.Y))


Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And if this code isn't enough I already have it on GitHub so I can let people at my job change it or propose new feature even when I'm gone - &lt;A href="https://github.com/migui06/DrawingsCoords-PalardyAdd-ins" target="_blank" rel="noopener"&gt;GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can import it and try things with it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File I use for testing linked with this post&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 16:11:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/leader-note-node-from-sketched-symbol/m-p/10456351#M126306</guid>
      <dc:creator>djguiVEC2U</dc:creator>
      <dc:date>2021-07-09T16:11:47Z</dc:date>
    </item>
    <item>
      <title>Betreff: Leader note/node from Sketched Symbol</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/leader-note-node-from-sketched-symbol/m-p/10461778#M126350</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the creation of the geometry intent fails silently. Afaik a point of a sketched symbol is not a valid input for this.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim GeomIntentText As GeometryIntent = oSheet.CreateGeometryIntent(ThisPoint, ThisPoint.Position)&lt;/LI-CODE&gt;&lt;P&gt;If I'm right, all of your sketched symbols are attached to endpoints of drawingcurves. If so, every sketched symbol has a (invisible) leader with an attached entity. This entity is a geometry intent (drawing curve) where your leader note can also be attached to. If the drawingcurve endpoint moves, your leader note should also do. Finally you could change the leader style from the standard arrow to a big filled dot to replace the sketched symbol or remove the arrow.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 12:51:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/leader-note-node-from-sketched-symbol/m-p/10461778#M126350</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-07-12T12:51:55Z</dc:date>
    </item>
  </channel>
</rss>

