<?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 Re: Calling Workaxes from a drawing to get automated ordinate dimensions. in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548473#M13818</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;, thank you for the input but as&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;&amp;nbsp;mentioned we should consider the drawing reference of axes as centrelines instead of curves, I guess. It did not work when I combined those two codes probably because it wasn't creating curves and geometry intents.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 13:08:13 GMT</pubDate>
    <dc:creator>krishnaprasad.veedu</dc:creator>
    <dc:date>2024-02-08T13:08:13Z</dc:date>
    <item>
      <title>Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12543607#M13811</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;I was able to automate Ordinate dimensions for a subassembly as shown in the pic using ilogic. I have taken tips from here and there and used ChatGPT+copilot to get something working. I was able to achieve the dimensions shown above. Now I'm trying to get dimensions as shown below. Basically, I need to get axis from the parts and get ordinate dimensions starting from the left most side of the drawing view. Kindly let me know if anyone can help me to get this done. Thanks. Im posting the code for getting ordinate dimensions as shown above.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument

    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet

    Dim oView As DrawingView
    oView = oSheet.DrawingViews(1)

    Dim oMainAsmDoc As AssemblyDocument
    oMainAsmDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument

    ' Assuming the subassembly is the first occurrence in the main assembly
    Dim oSubAsmOcc As ComponentOccurrence
    oSubAsmOcc = oMainAsmDoc.ComponentDefinition.Occurrences.Item(2)

    Dim FPColl As ObjectCollection
    Dim OverallColl As ObjectCollection
    Dim oText As Point2d

    FPColl = ThisServer.TransientObjects.CreateObjectCollection
    OverallColl = ThisServer.TransientObjects.CreateObjectCollection

    ' Loop through all occurrences in the subassembly
    For Each occurrence As ComponentOccurrence In oSubAsmOcc.SubOccurrences
        ' Get the named entities for the occurrence's document
        Dim namedEntities = iLogicVb.Automation.GetNamedEntities(occurrence.Definition.Document)

        ' Find the entity named "zx" within the named entities
        Dim entity As Face
        Try
            entity = namedEntities.FindEntity("zx")
        Catch ex As Exception
            ' Skip the occurrence if named entity "zx" is not found
            Continue For
        End Try

        ' Create geometry proxy for the entity
        Dim oSketchProxy As Object
        Call occurrence.CreateGeometryProxy(entity, oSketchProxy)

        ' Get the drawing curves for the sketch proxy
        Dim curves = oView.DrawingCurves(oSketchProxy)

        ' Create geometry intent for the first curve
        Dim oIntent = oSheet.CreateGeometryIntent(curves.Item(1))

        ' Add the geometry intent to the overall collection
        Call OverallColl.Add(oIntent)
    Next

    ' Create a point at the top-left corner of the view
    Dim topLeftPoint As Point2d
    topLeftPoint = ThisServer.TransientGeometry.CreatePoint2d(oView.Left, oView.Top)

    ' Create a point slightly to the right of the top-left corner to leave space for the dimension text
    Dim offset As Double
    offset = 0.1 ' Adjust this value as needed
    Dim oText1 As Point2d
    oText1 = ThisServer.TransientGeometry.CreatePoint2d(topLeftPoint.X + offset, topLeftPoint.Y)

    ' Create Ordinate Dimension
    Dim geomIntents As ObjectCollection
    geomIntents = ThisApplication.TransientObjects.CreateObjectCollection
    For i As Integer = 1 To OverallColl.Count ' Loop from 1 to count
        Call geomIntents.Add(OverallColl.Item(i)) ' Add intents in the order they are retrieved
    Next

    ' Create Ordinate Dimension
    Call oSheet.DrawingDimensions.OrdinateDimensionSets.Add(geomIntents, oText1, kHorizontalDimensionType)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krishnaprasadveedu_0-1707229739010.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1322833iC04D4A1D6ECF212D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="krishnaprasadveedu_0-1707229739010.png" alt="krishnaprasadveedu_0-1707229739010.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 14:31:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12543607#M13811</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-06T14:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12544424#M13812</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13138943"&gt;@krishnaprasad.veedu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://adndevblog.typepad.com/manufacturing/2012/06/include-with-api-a-work-plane-from-model-inside-the-drawing.html" target="_blank" rel="noopener"&gt;Here is an article that does just that to include a workplane in a part and or assembly occurrence&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workaxis is just a similar object in the collection so it's an easy change. Hopefully that gets you moving in the right direction.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 20:42:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12544424#M13812</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2024-02-06T20:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12545732#M13813</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;&amp;nbsp;, thanks for your input. I have been able to call the axes and make them visible in the drawing view using this code, tried adding ordinate set dimensions but with no luck. Any idea how can i do it?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument

    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet

    Dim oView As DrawingView
    oView = oSheet.DrawingViews(1)

    Dim oMainAsmDoc As AssemblyDocument
    oMainAsmDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument

    ' Loop through all occurrences in the assembly
    For Each occurrence As ComponentOccurrence In oMainAsmDoc.ComponentDefinition.Occurrences
        ' Check if the occurrence is a part
        If TypeOf occurrence.Definition.Document Is PartDocument Then
            Dim oPartDoc As PartDocument
            oPartDoc = occurrence.Definition.Document

            ' Get the work axes for the part document
            Dim workAxes = oPartDoc.ComponentDefinition.WorkAxes

            ' Find the work axis named "axs" within the work axes
            For Each workAxis As WorkAxis In workAxes
                If WorkAxis.Name = "axs" Then
                    ' Create geometry proxy for the work axis
                    Dim oWorkAxisProxy As WorkAxisProxy
                    Call occurrence.CreateGeometryProxy(WorkAxis, oWorkAxisProxy)

                    ' Set visibility
                    Call oView.SetVisibility(oWorkAxisProxy, True)
                End If
            Next
        End If
    Next
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Feb 2024 12:22:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12545732#M13813</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-07T12:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12545913#M13814</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;, Here is what I have tried doing, would you have a look please. I'm getting unspecified error running this. I'm kinda new to codes.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument

    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet

    Dim oView As DrawingView
    oView = oSheet.DrawingViews(1)

     Dim oAsmDoc As AssemblyDocument
    oAsmDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument

    Dim oCompDef As AssemblyComponentDefinition
    oCompDef = oAsmDoc.ComponentDefinition

  Dim FPColl As ObjectCollection
    Dim OverallColl As ObjectCollection
    Dim oText As Point2d

    FPColl = ThisServer.TransientObjects.CreateObjectCollection
    OverallColl = ThisServer.TransientObjects.CreateObjectCollection

    

    ' Loop through all occurrences in the assembly
    For Each occurrence As ComponentOccurrence In oCompDef.Occurrences
        ' Get the named entities for the occurrence's document
        Dim namedEntities = iLogicVb.Automation.GetNamedEntities(occurrence.Definition.Document)

        ' Find the entity named "zx" within the named entities
        Dim entity As WorkAxis
        Try
            entity = namedEntities.FindEntity("axs")
        Catch ex As Exception
            ' Skip the occurrence if named entity "axs" is not found
            Continue For
        End Try

        ' Create geometry proxy for the entity
        Dim oSketchProxy As Object
        Call occurrence.CreateGeometryProxy(entity, oSketchProxy)

        ' Get the drawing curves for the sketch proxy
        Dim curves = oView.DrawingCurves(oSketchProxy)

        ' Create geometry intent for the first curve
        Dim oIntent = oSheet.CreateGeometryIntent(curves.Item(1))

        ' Add the geometry intent to the overall collection
        Call OverallColl.Add(oIntent)
    Next

    ' Create a point at the bottom-left corner of the view
    Dim bottomLeftPoint As Point2d
    bottomLeftPoint = ThisServer.TransientGeometry.CreatePoint2d(oView.Left, oView.Top - oView.Height-1)

' Create a point slightly above the bottom-left corner to leave space for the dimension text
        Dim offset As Double
        offset = 0.1 ' Adjust this value as needed
        Dim oText1 As Point2d
        oText1 = ThisServer.TransientGeometry.CreatePoint2d(bottomLeftPoint.X, bottomLeftPoint.Y)

    ' Create Ordinate Dimension
    Dim geomIntents As ObjectCollection
    geomIntents = ThisApplication.TransientObjects.CreateObjectCollection
    For i As Integer = 1 To OverallColl.Count
        Call geomIntents.Add(OverallColl.Item(i))
    Next

    ' Create Ordinate Dimension
    Call oSheet.DrawingDimensions.OrdinateDimensionSets.Add(geomIntents, oText1, kHorizontalDimensionType)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 13:36:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12545913#M13814</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-07T13:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12546177#M13815</link>
      <description>&lt;P&gt;I am not sure what your design intent is for the ordination dimension. Are you trying to dimension between the now included axis?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so I think you would need to supply the&amp;nbsp;&lt;/P&gt;&lt;P&gt;work axis proxy at this location in your first code to get the drawing curve associated with the axis.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        ' Get the drawing curves for the sketch proxy
        Dim curves = oView.DrawingCurves(oSketchProxy)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Your last post does not included the axis visibility you had working in post 2. So go back and combine post 1 &amp;amp; 2 with this in mind. Hopefully that is all that is needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the error checking the more info tab can give you more insight so please share that, it might indicate what object the code is failing on. If you don’t have the latest version showing the line number where the error message occurs, step through the code with a message box or logger statement until the error message occurs this way you can narrow down what line it fails on.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 15:15:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12546177#M13815</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2024-02-07T15:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12547666#M13816</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13138943"&gt;@krishnaprasad.veedu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Give this a try:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
	Dim oDrawDoc As DrawingDocument = TryCast(ThisApplication.ActiveDocument, DrawingDocument)
	If IsNothing(oDrawDoc) Then Logger.Debug("Not Run In Drawing Document") : Exit Sub

    Dim oSheet As Sheet = oDrawDoc.ActiveSheet
	If oSheet.DrawingViews.Count &amp;lt; 1 Then Logger.Debug("No Views on active sheet") : Exit Sub
	
    Dim oView As DrawingView = oSheet.DrawingViews(1)

    Dim oAsmDoc As AssemblyDocument = TryCast(oView.ReferencedDocumentDescriptor.ReferencedDocument, AssemblyDocument)
	If IsNothing(oAsmDoc) Then Logger.Debug("View(1) of the active drawing is not an assembly document") : Exit Sub
    
	Dim oCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
	Dim CenterlineGeometryIntentList As New List(Of GeometryIntent)

    ' Loop through all occurrences in the assembly
    For Each occurrence As ComponentOccurrence In oCompDef.Occurrences
        ' Get the named entities for the occurrence's document
        Dim namedEntities = iLogicVb.Automation.GetNamedEntities(occurrence.Definition.Document)
		If Not namedEntities.NameExists("axs") Then Continue For

        Dim entity As WorkAxis = namedEntities.FindEntity("axs")
				
        ' Create geometry proxy for the entity
        Dim oGeometryProxy As Object
        occurrence.CreateGeometryProxy(entity, oGeometryProxy)
		
		'Get Drawing Reference of the axis
		oView.SetIncludeStatus(oGeometryProxy, True)
		Dim axisCenterline As Centerline
		Try
			axisCenterline = oSheet.Centerlines.AddByWorkFeature(oGeometryProxy, oView)
		Catch
			Logger.Debug("Work Axis ""axs"" in component ""{0}"" does not produce a centerline object", occurrence.Name)
			Continue For
		End Try
		CenterlineGeometryIntentList.Add(oSheet.CreateGeometryIntent(axisCenterline))
    Next

	If CenterlineGeometryIntentList.Count &amp;lt; 1 Then Logger.Debug("Did not collect any Geometry Intents") : Exit Sub
	
	CenterlineGeometryIntentList.Sort(Function(x, y) x.Geometry.EndPoint.X.CompareTo(y.Geometry.EndPoint.X))
		
    ' Add the geometry intent to the object collection
	Dim geomIntents As ObjectCollection = ThisServer.TransientObjects.CreateObjectCollection()
	For Each Item In CenterlineGeometryIntentList
		geomIntents.Add(Item)
	Next
	
	Dim oPlacementPoint As Point2d = oView.Position
	oPlacementPoint.Y -= 1
	
    ' Create Ordinate Dimension
    Call oSheet.DrawingDimensions.OrdinateDimensionSets.Add(geomIntents, oPlacementPoint, DimensionTypeEnum.kHorizontalDimensionType)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The drawing reference object of an axis, which is not perpendicular to the view, is a Centerline, not a drawing curve.&amp;nbsp; I collected the GeometryIntent with a list so i could sort it before putting the objects into a collection.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions, or if this is not working as intended&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 05:29:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12547666#M13816</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2024-02-08T05:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548458#M13817</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much. Really appreciated. It does work for the axes. One question is how do I get the starting of ordinate dimension as the left most end of the view (highlighted below)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krishnaprasadveedu_0-1707396913363.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1323935i3F0F1EA8155E8D73/image-size/medium?v=v2&amp;amp;px=400" role="button" title="krishnaprasadveedu_0-1707396913363.png" alt="krishnaprasadveedu_0-1707396913363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Also, this works when I have the drawing view referring to an assembly and there are parts which contain axes named axs in the parts. Now, lets say I have subassemblies named "abc" inside the main assembly and it has parts containing axes named axs. I need to include them as well. please help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 13:00:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548458#M13817</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-08T13:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548473#M13818</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;, thank you for the input but as&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;&amp;nbsp;mentioned we should consider the drawing reference of axes as centrelines instead of curves, I guess. It did not work when I combined those two codes probably because it wasn't creating curves and geometry intents.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 13:08:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548473#M13818</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-08T13:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548603#M13819</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13138943"&gt;@krishnaprasad.veedu&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;We can find an entity on the left most part of the view for the first intent.&lt;BR /&gt;&lt;BR /&gt;When you have parts in sub-assemblies are we only pulling axes from part files or will the intended axes exist in a mix of part and assembly files?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 13:59:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548603#M13819</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2024-02-08T13:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548667#M13820</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;, I have situations where it is a mix of parts and parts inside subassemblies. Axes are not there in assemblies as it is. To be more specific&amp;nbsp; I&amp;nbsp; have the main assembly named 'a' inside that i have parts named 'b' and subassemblies named 'c'. The subassembly named 'c' contains another part named 'd' and the parts 'b' and 'd' has axes named 'axs'. I need to get all the 'axs' in my drawing.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 14:34:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548667#M13820</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-08T14:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548690#M13821</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;&amp;nbsp;: Also, for the first intent, I have this frame assembly and the web(face) of these frames are named entity(zx). I have the code in this first post. Will that work?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 14:25:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548690#M13821</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-08T14:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548887#M13822</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13138943"&gt;@krishnaprasad.veedu&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I think this should do it:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
	Dim oDrawDoc As DrawingDocument = TryCast(ThisApplication.ActiveDocument, DrawingDocument)
	If IsNothing(oDrawDoc) Then Logger.Debug("Not Run In Drawing Document") : Exit Sub

    Dim oSheet As Sheet = oDrawDoc.ActiveSheet
	If oSheet.DrawingViews.Count &amp;lt; 1 Then Logger.Debug("No Views on active sheet") : Exit Sub
	
    Dim oView As DrawingView = oSheet.DrawingViews(1)

    Dim oAsmDoc As AssemblyDocument = TryCast(oView.ReferencedDocumentDescriptor.ReferencedDocument, AssemblyDocument)
	If IsNothing(oAsmDoc) Then Logger.Debug("View(1) of the active drawing is not an assembly document") : Exit Sub
    
	Dim oCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
	Dim CenterlineGeometryIntentList As New List(Of GeometryIntent)
	Dim FirstGeometryProxy As Object
	Dim FirstGeoFound As Boolean = False
	
    ' Loop through all occurrences in the assembly
    For Each occurrence As ComponentOccurrence In oCompDef.Occurrences.AllLeafOccurrences 'Only looking at occurrences from part files
        ' Get the named entities for the occurrence's document
        Dim namedEntities = iLogicVb.Automation.GetNamedEntities(occurrence.Definition.Document)
		
		If namedEntities.NameExists("zx") Then occurrence.CreateGeometryProxy(namedEntities.FindEntity("zx"), FirstGeometryProxy) : FirstGeoFound = True
		
		If Not namedEntities.NameExists("axs") Then Continue For
        Dim entity As WorkAxis = namedEntities.FindEntity("axs")
				
        ' Create geometry proxy for the entity
        Dim oGeometryProxy As Object
        occurrence.CreateGeometryProxy(entity, oGeometryProxy)
		
		'Get Drawing Reference of the axis
		oView.SetIncludeStatus(oGeometryProxy, True)
		Dim axisCenterline As Centerline
		Try
			axisCenterline = oSheet.Centerlines.AddByWorkFeature(oGeometryProxy, oView)
		Catch
			Logger.Debug("Work Axis ""axs"" in component ""{0}"" does not produce a centerline object", occurrence.Name)
			Continue For
		End Try
		CenterlineGeometryIntentList.Add(oSheet.CreateGeometryIntent(axisCenterline))
    Next

	If CenterlineGeometryIntentList.Count &amp;lt; 1 Then Logger.Debug("Did not collect any Geometry Intents") : Exit Sub
	CenterlineGeometryIntentList.Sort(Function(x, y) x.Geometry.EndPoint.X.CompareTo(y.Geometry.EndPoint.X))
	
	If Not FirstGeoFound Then Logger.Debug("Did find named face ""zx"" in any part component in the assembly.  Will build the dimension set without it.")
	
    ' Add the geometry intent to the object collection
	Dim geomIntents As ObjectCollection = ThisServer.TransientObjects.CreateObjectCollection()
	
	Dim FirstIntent As GeometryIntent 
	If FirstGeoFound Then geomIntents.Add(oSheet.CreateGeometryIntent(oView.DrawingCurves(FirstGeometryProxy).Item(1)))
	
	For Each Item In CenterlineGeometryIntentList
		geomIntents.Add(Item)
	Next
	
	Dim oPlacementPoint As Point2d = oView.Center
	oPlacementPoint.Y -= oView.Height*.55
	
    ' Create Ordinate Dimension
    Call oSheet.DrawingDimensions.OrdinateDimensionSets.Add(geomIntents, oPlacementPoint, DimensionTypeEnum.kHorizontalDimensionType)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 15:46:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12548887#M13822</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2024-02-08T15:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12550061#M13823</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thats awesome. just works perfectly. One more request I would like to ask is, lets say if none of the parts in main assembly contains axes named axs and only the parts inside the subassembly contains it, it should still work, currently if i dont have parts with axs inside the main assembly, it returns me an unspecified error. More info on the error is "System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))&lt;BR /&gt;at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;at Inventor.ComponentOccurrence.get_Definition()&lt;BR /&gt;at ThisRule.Main() in rule: Rule16, in document Ordim_asm.idw:line 21&lt;BR /&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)"&amp;nbsp;&lt;/P&gt;&lt;P&gt;The line 21 is "&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;namedEntities&lt;/SPAN&gt; = &lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;Automation&lt;/SPAN&gt;.&lt;SPAN&gt;GetNamedEntities&lt;/SPAN&gt;(&lt;SPAN&gt;occurrence&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;)"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 06:00:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12550061#M13823</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-09T06:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12550091#M13824</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the issue is not parts and subassemblies, it works fine. The problem happens when there are suppressed components in the assembly, if I suppress a component, it returns the error.&lt;BR /&gt;Initially I suppressed the parts to check if it works only with subassemblies. It gave me the error but when I deleted the parts and checked, it worked fine. So the problem is with suppression. Any idea how to solve this?? thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 06:26:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12550091#M13824</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-09T06:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Workaxes from a drawing to get automated ordinate dimensions.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12550116#M13825</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I added an extra line for skipping suppressed components and it works fine now. Thanks a lot&lt;/P&gt;&lt;PRE&gt;    ' Loop through all occurrences in the assembly
    For Each occurrence As ComponentOccurrence In oCompDef.Occurrences.AllLeafOccurrences 'Only looking at occurrences from part files
        ' Skip suppressed components
        If occurrence.Suppressed Then Continue For

        ' Get the named entities for the occurrence's document
        Dim namedEntities = iLogicVb.Automation.GetNamedEntities(occurrence.Definition.Document)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 06:50:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-workaxes-from-a-drawing-to-get-automated-ordinate/m-p/12550116#M13825</guid>
      <dc:creator>krishnaprasad.veedu</dc:creator>
      <dc:date>2024-02-09T06:50:25Z</dc:date>
    </item>
  </channel>
</rss>

