<?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 Get RangeBox of Part in Assembly, by Assembly Coordinate System in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13031673#M172006</link>
    <description>&lt;P&gt;I'm trying to get a rangebox on a part in an assembly, but in the assemblies coordinate system. Does anyone know how to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsm&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;BR /&gt;&lt;/SPAN&gt;Dim oOcc as ComponentOccurance&lt;BR /&gt;oOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Pick a feature") &lt;BR /&gt;&lt;BR /&gt;xFrameL = oOcc.Definition.RangeBox.MaxPoint.X - oOcc.Definition.RangeBox.MinPoint.X&lt;/PRE&gt;&lt;P&gt;The code above works great to get the rangebox on the PART coordinate system but I need one for an assembly coordinate system.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2024 18:38:15 GMT</pubDate>
    <dc:creator>C_Haines_ENG</dc:creator>
    <dc:date>2024-09-19T18:38:15Z</dc:date>
    <item>
      <title>Get RangeBox of Part in Assembly, by Assembly Coordinate System</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13031673#M172006</link>
      <description>&lt;P&gt;I'm trying to get a rangebox on a part in an assembly, but in the assemblies coordinate system. Does anyone know how to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsm&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;BR /&gt;&lt;/SPAN&gt;Dim oOcc as ComponentOccurance&lt;BR /&gt;oOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Pick a feature") &lt;BR /&gt;&lt;BR /&gt;xFrameL = oOcc.Definition.RangeBox.MaxPoint.X - oOcc.Definition.RangeBox.MinPoint.X&lt;/PRE&gt;&lt;P&gt;The code above works great to get the rangebox on the PART coordinate system but I need one for an assembly coordinate system.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 18:38:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13031673#M172006</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2024-09-19T18:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get RangeBox of Part in Assembly, by Assembly Coordinate System</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13031702#M172008</link>
      <description>&lt;P&gt;It would appear that I'm a complete idiot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oOcc.RangeBox.MaxPoint.X&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 Sep 2024 18:52:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13031702#M172008</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2024-09-19T18:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get RangeBox of Part in Assembly, by Assembly Coordinate System</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13032778#M172023</link>
      <description>&lt;P&gt;Be careful because it works until the part is not rotated in assembly.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 08:14:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13032778#M172023</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2024-09-20T08:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get RangeBox of Part in Assembly, by Assembly Coordinate System</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13033040#M172028</link>
      <description>&lt;P&gt;I never could get the oriented range box working, could you post a sample code?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 10:44:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13033040#M172028</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2024-09-20T10:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get RangeBox of Part in Assembly, by Assembly Coordinate System</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13033211#M172034</link>
      <description>&lt;P&gt;This is a sample, how you can work with OrientedBox of part in assembly context&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
    Dim asm As AssemblyDocument = ThisDoc.Document
    Dim asmDef As AssemblyComponentDefinition = asm.ComponentDefinition
    Dim partOcc As ComponentOccurrence = asmDef.Occurrences(1)

    Dim partDef As PartComponentDefinition = partOcc.Definition
    Dim orientedBox As OrientedBox = partDef.OrientedMinimumRangeBox

    PrintBoxData(orientedBox, "In part")

    TransformBy(orientedBox, partOcc.Transformation)

    PrintBoxData(orientedBox, "In assembly")

End Sub

Private Sub TransformBy(orientedBox As OrientedBox, matrix As Matrix)
    Dim cornerPoint As Point
    Dim directionOne As Vector
    Dim directionTwo As Vector
    Dim directionThree As Vector
    orientedBox.GetOrientedBoxData(cornerPoint, directionOne, directionTwo, directionThree)

    cornerPoint.TransformBy(matrix)
    directionOne.TransformBy(matrix)
    directionTwo.TransformBy(matrix)
    directionThree.TransformBy(matrix)

    orientedBox.PutOrientedBoxData(cornerPoint, directionOne, directionTwo, directionThree)
End Sub

Private Sub PrintBoxData(orientedBox As OrientedBox, Optional title As String = "")
    Dim stringBuilder As New System.Text.StringBuilder
    stringBuilder.AppendLine(title)
    stringBuilder.AppendLine(String.Format("CornerPoint{3}[{0:N2}, {1:N2}, {2:N2}]", orientedBox.CornerPoint.X, orientedBox.CornerPoint.Y, orientedBox.CornerPoint.Z, vbTab))
    stringBuilder.AppendLine(String.Format("DirectionOne{3}[{0:N2}, {1:N2}, {2:N2}]", orientedBox.DirectionOne.X, orientedBox.DirectionOne.Y, orientedBox.DirectionOne.Z, vbTab))
    stringBuilder.AppendLine(String.Format("DirectionTwo{3}[{0:N2}, {1:N2}, {2:N2}]", orientedBox.DirectionTwo.X, orientedBox.DirectionTwo.Y, orientedBox.DirectionTwo.Z, vbTab))
    stringBuilder.AppendLine(String.Format("DirectionThree{3}[{0:N2}, {1:N2}, {2:N2}]", orientedBox.DirectionThree.X, orientedBox.DirectionThree.Y, orientedBox.DirectionThree.Z, vbTab))
    Logger.Debug(stringBuilder.ToString())
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 20 Sep 2024 12:11:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rangebox-of-part-in-assembly-by-assembly-coordinate-system/m-p/13033211#M172034</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2024-09-20T12:11:46Z</dc:date>
    </item>
  </channel>
</rss>

