<?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: Bounding box with the UCS Origin in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8513644#M80511</link>
    <description>&lt;P&gt;Also since your box is rotated per ucs1 in 3d space, you have two options:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Trigonometry (turn the diagonal flat plane line into a right triangle equation to get the length and with)&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; You could attempt to get the values Before we transform them BACK to origin ucs.&lt;/P&gt;
&lt;P&gt;In fact if getting bounding lengths is you goal, then the second option is probably the easiest for your situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jan 2019 16:35:26 GMT</pubDate>
    <dc:creator>JamieVJohnson2</dc:creator>
    <dc:date>2019-01-10T16:35:26Z</dc:date>
    <item>
      <title>Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8501946#M80495</link>
      <description>&lt;P&gt;Dear Expert,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My name is Son, I am a user in the Autodesk Inventor. I have an issue when I get the&amp;nbsp;bounding box with the UCS origin. Please see the attached file for the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me in this case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice day.&lt;/P&gt;
&lt;P&gt;Ngoc Son&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 04:57:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8501946#M80495</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-05T04:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8504225#M80496</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not directly the solution but it will help to implement this is future maybe!&lt;/P&gt;
&lt;P&gt;You could vote this...….&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/dimension-component-part-and-assembly/idi-p/7523011" target="_blank"&gt;Dimension Component!&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Autodesk Software:&lt;/STRONG&gt; Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018&lt;BR /&gt;&lt;STRONG&gt;Programming Skills:&lt;/STRONG&gt; Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/dimension-component-part-and-assembly/idi-p/7523011" target="_blank"&gt;Dimension Component!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/export-partlist-default-configuration/idc-p/7422221#M21416" target="_blank"&gt;Partlist Export!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/derived-part-and-assembly-copy-i-properties/idi-p/6349392" target="_blank"&gt;Derive I-properties!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/inventor-vault-prompts-settings-amp-vault-prompts-settings-via/idi-p/7641767" target="_blank"&gt;Vault Prompts Via API!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/vault-ideas/vault-professional-handbook-or-manual-to-be-provided/idi-p/7653669" target="_blank"&gt;Vault Handbook/Manual!&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/drawing-toggle-sheets/idi-p/7708757" target="_blank"&gt;Drawing Toggle Sheets!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/open-files-automatically-with-quot-defer-update-quot-on-read/idi-p/7762709" target="_blank"&gt;Vault Defer Update!&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;! For administrative reasons, please mark a &lt;STRONG&gt;"Solution as solved"&lt;/STRONG&gt; when the issue is solved !&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 08:59:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8504225#M80496</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-01-07T08:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8505370#M80497</link>
      <description>&lt;P&gt;If we can't find it, we create it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some code that will create a range box using the vertices from the solid object, translated to user UCS, calculated for range box, then translated back to origin ucs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            Dim partDoc As PartDocument = invApp.ActiveDocument&lt;BR /&gt;'get 3d solid
            Dim sb As SurfaceBody = partDoc.SelectSet(1)
'get custom user coordinate system&lt;BR /&gt;            Dim ucs As UserCoordinateSystem = partDoc.ComponentDefinition.UserCoordinateSystems(1)
'create a list of points (for sorting)&lt;BR /&gt;            Dim vPoints As New List(Of Point)
'get the transformation matrix from the usc (what it takes to translate from user ucs to origin)&lt;BR /&gt;            Dim mat As Matrix = ucs.Transformation&lt;BR /&gt;'invert the matrix (what it takes to translate from origin to user ucs)
            mat.Invert()&lt;BR /&gt;'cycle through all the points
            For Each vert As Vertex In sb.Vertices&lt;BR /&gt;'get the point data from the vertex
                Dim p As Point = vert.Point&lt;BR /&gt;'invert translate the point data (from origin to user ucs)
                p.TransformBy(mat)&lt;BR /&gt;'add translated point to collection
                vPoints.Add(p)
            Next&lt;BR /&gt;'create empty min and max points
            Dim minPoint As Point = tg.CreatePoint(0, 0, 0)
            Dim maxPoint As Point = tg.CreatePoint(0, 0, 0)&lt;BR /&gt;'sort points based on x values, and get lowest and highest value
            vPoints.Sort(Function(x, y) x.X.CompareTo(y.X))
            minPoint.X = vPoints.First.X
            maxPoint.X = vPoints.Last.X&lt;BR /&gt;'sort points based on y values, and get lowest and highest values
            vPoints.Sort(Function(x, y) x.Y.CompareTo(y.Y))
            minPoint.Y = vPoints.First.Y
            maxPoint.Y = vPoints.Last.Y&lt;BR /&gt;'sort points based on z values, and get lowest and highest values
            vPoints.Sort(Function(x, y) x.Z.CompareTo(y.Z))
            minPoint.Z = vPoints.First.Z
            maxPoint.Z = vPoints.Last.Z&lt;BR /&gt;'transform min and max points from user ucs back to origin
            minPoint.TransformBy(ucs.Transformation)
            maxPoint.TransformBy(ucs.Transformation)&lt;/PRE&gt;
&lt;P&gt;Note, when I attempted to create a new rangebox (box) object, and assign these min and max points, it behaved oddly, by setting the min and max Z value both to '-0.5'.&amp;nbsp; This is not the expected behavior as the min/max points have '0.5' and '-0.5'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 17:52:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8505370#M80497</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-01-07T17:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506388#M80498</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_26" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3677112" target="_self"&gt;JamieVJohnson2&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;This is for iLogic, I can not run it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Please&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 03:58:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506388#M80498</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-08T03:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506598#M80499</link>
      <description>&lt;P&gt;what do you need:&lt;/P&gt;
&lt;P&gt;VBA&lt;/P&gt;
&lt;P&gt;Vb.net&lt;/P&gt;
&lt;P&gt;????&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 07:50:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506598#M80499</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-01-08T07:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506602#M80500</link>
      <description>&lt;P&gt;iLogic please&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 07:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506602#M80500</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-08T07:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506687#M80501</link>
      <description>&lt;PRE&gt; Dim partDoc As Inventor.PartDocument
 partDoc = ThisApplication.ActiveDocument
 
'get 3d solid
            Dim sb As SurfaceBody 
			sb = partDoc.SelectSet(1)
			MsgBox (sb.ComponentDefinition.SurfaceBodies.Count)
'get custom user coordinate system
            Dim ucs As UserCoordinateSystem 
			MsgBox (partDoc.ComponentDefinition.UserCoordinateSystems.Count)
			ucs = partDoc.ComponentDefinition.UserCoordinateSystems(1)

'create a list of points (for sorting)
            Dim vPoints As  New List(Of Point)

'get the transformation matrix from the usc (what it takes to translate from user ucs to origin)
            Dim mat As Matrix 
			mat = ucs.Transformation
'invert the matrix (what it takes to translate from origin to user ucs)
            mat.Invert()

'cycle through all the points
            For Each vert As Vertex In sb.Vertices
'get the point data from the vertex
                Dim p As Point 
				p = vert.Point
'invert translate the point data (from origin to user ucs)
                p.TransformBy(mat)
'add translated point to collection
                vPoints.Add(p)
            Next
			
			 ' Get the corners of the range box.
    		&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Dim tg As TransientGeometry
    		tg = ThisApplication.TransientGeometry
&lt;/STRONG&gt;&lt;/FONT&gt;'create empty min and max points
            Dim minPoint As Point 
			minPoint =  tg.CreatePoint(0, 0, 0)
            Dim maxPoint As Point 
			maxPoint = tg.CreatePoint(0, 0, 0)
'sort points based on x values, and get lowest and highest value
            vPoints.Sort(Function(x, y) x.X.CompareTo(y.X))
            minPoint.X = vPoints.First.X
            maxPoint.X = vPoints.Last.X
'sort points based on y values, and get lowest and highest values
            vPoints.Sort(Function(x, y) x.Y.CompareTo(y.Y))
            minPoint.Y = vPoints.First.Y
            maxPoint.Y = vPoints.Last.Y
'sort points based on z values, and get lowest and highest values
            vPoints.Sort(Function(x, y) x.Z.CompareTo(y.Z))
            minPoint.Z = vPoints.First.Z
            maxPoint.Z = vPoints.Last.Z
'transform min and max points from user ucs back to origin
            minPoint.TransformBy(ucs.Transformation)
            maxPoint.TransformBy(ucs.Transformation)
&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Jan 2019 08:49:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8506687#M80501</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-01-08T08:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507504#M80502</link>
      <description>&lt;P&gt;I can not run, some errors. Please, help me to fix.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 14:34:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507504#M80502</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-08T14:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507550#M80503</link>
      <description>&lt;P&gt;have you added an UCS?&lt;/P&gt;
&lt;P&gt;have you selected the part SurfaceBody?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 15:12:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507550#M80503</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-01-08T15:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507641#M80504</link>
      <description>&lt;P&gt;It still has this problem&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 15:15:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507641#M80504</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-08T15:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507643#M80505</link>
      <description>&lt;P&gt;I am using Inventor 2017&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 15:16:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507643#M80505</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-08T15:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507785#M80506</link>
      <description>&lt;PRE&gt; Dim partDoc As Inventor.PartDocument
 partDoc = ThisApplication.ActiveDocument
 
'get 3d solid
            Dim sb As SurfaceBody 
			sb = partDoc.SelectSet(1)
			MsgBox (sb.ComponentDefinition.SurfaceBodies.Count)
'get custom user coordinate system
            Dim ucs As UserCoordinateSystem 
			MsgBox (partDoc.ComponentDefinition.UserCoordinateSystems.Count)
			ucs = partDoc.ComponentDefinition.UserCoordinateSystems(1)

'create a list of points (for sorting)
            Dim vPoints As  New List(Of Point)

'get the transformation matrix from the usc (what it takes to translate from user ucs to origin)
            Dim mat As Matrix 
			mat = ucs.Transformation
'invert the matrix (what it takes to translate from origin to user ucs)
            mat.Invert()

'cycle through all the points
            For Each vert As Vertex In sb.Vertices
'get the point data from the vertex
                Dim p As Point 
				p = vert.Point
'invert translate the point data (from origin to user ucs)
                p.TransformBy(mat)
'add translated point to collection
                vPoints.Add(p)
            Next
			
			 ' Get the corners of the range box.
    		Dim tg As TransientGeometry
    		tg = ThisApplication.TransientGeometry
'create empty min and max points
            Dim minPoint As Point 
			minPoint =  tg.CreatePoint(0, 0, 0)
            Dim maxPoint As Point 
			maxPoint = tg.CreatePoint(0, 0, 0)
'sort points based on x values, and get lowest and highest value
            vPoints.Sort(Function(x, y) x.X.CompareTo(y.X))
            minPoint.X = vPoints(0).X
            maxPoint.X = vPoints(vPoints.count-1).X
'sort points based on y values, and get lowest and highest values
            vPoints.Sort(Function(x, y) x.Y.CompareTo(y.Y))
            minPoint.Y = vPoints(0).Y
            maxPoint.Y = vPoints(vPoint.count-1).Y
'sort points based on z values, and get lowest and highest values
            vPoints.Sort(Function(x, y) x.Z.CompareTo(y.Z))
            minPoint.Z = vPoints(0).Z
            maxPoint.Z = vPoints(vPoint.count-1).Z
'transform min and max points from user ucs back to origin
            minPoint.TransformBy(ucs.Transformation)
            maxPoint.TransformBy(ucs.Transformation)&lt;/PRE&gt;
&lt;P&gt;The API is not performing as expected (even the iLogic API can run VB.Net code directly, we are using 2019).&amp;nbsp; So I modified the .First and .Last statements to their equivalent (0) index value and (vPoints.count-1) index value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 15:57:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8507785#M80506</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-01-08T15:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8509014#M80507</link>
      <description>&lt;P&gt;The next problem. So I'll try to fix it. Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 00:10:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8509014#M80507</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-09T00:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8512462#M80508</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_26" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3677112" target="_self"&gt;JamieVJohnson2&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;I can not fix this error. Could you support me?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 09:24:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8512462#M80508</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-10T09:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8512553#M80509</link>
      <description>&lt;P&gt;I tried to use Inventor 2019 but I can not get the size of a part with UCS1 (User UCS). Please view my attached file&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is your code and my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SyntaxEditor Code Snippet&lt;/P&gt;
&lt;PRE&gt; &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;partDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;PartDocument&lt;/SPAN&gt;
 &lt;SPAN&gt;partDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
 &lt;SPAN&gt;oDef&lt;/SPAN&gt; = &lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
 
&lt;SPAN&gt;'get 3d solid&lt;/SPAN&gt;
            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sb&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SurfaceBody&lt;/SPAN&gt; 
			&lt;SPAN&gt;sb&lt;/SPAN&gt; = &lt;SPAN&gt;oDef&lt;/SPAN&gt;.&lt;SPAN&gt;SurfaceBodies&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1)
			&lt;SPAN&gt;'MsgBox (sb.ComponentDefinition.SurfaceBodies.Count)&lt;/SPAN&gt;
&lt;SPAN&gt;'get custom user coordinate system&lt;/SPAN&gt;
            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ucs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;UserCoordinateSystem&lt;/SPAN&gt; 
			&lt;SPAN&gt;'MsgBox (partDoc.ComponentDefinition.UserCoordinateSystems.Count)&lt;/SPAN&gt;
			&lt;SPAN&gt;ucs&lt;/SPAN&gt; = &lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;UserCoordinateSystems&lt;/SPAN&gt;(1)

&lt;SPAN&gt;'create a list of points (for sorting)&lt;/SPAN&gt;
            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;vPoints&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt;  &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;Point&lt;/SPAN&gt;)

&lt;SPAN&gt;'get the transformation matrix from the usc (what it takes to translate from user ucs to origin)&lt;/SPAN&gt;
            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;mat&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Matrix&lt;/SPAN&gt; 
			&lt;SPAN&gt;mat&lt;/SPAN&gt; = &lt;SPAN&gt;ucs&lt;/SPAN&gt;.&lt;SPAN&gt;Transformation&lt;/SPAN&gt;
&lt;SPAN&gt;'invert the matrix (what it takes to translate from origin to user ucs)&lt;/SPAN&gt;
            &lt;SPAN&gt;mat&lt;/SPAN&gt;.&lt;SPAN&gt;Invert&lt;/SPAN&gt;()

&lt;SPAN&gt;'cycle through all the points&lt;/SPAN&gt;
            &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;vert&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Vertex&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;sb&lt;/SPAN&gt;.&lt;SPAN&gt;Vertices&lt;/SPAN&gt;
&lt;SPAN&gt;'get the point data from the vertex&lt;/SPAN&gt;
                &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;p&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Point&lt;/SPAN&gt; 
				&lt;SPAN&gt;p&lt;/SPAN&gt; = &lt;SPAN&gt;vert&lt;/SPAN&gt;.&lt;SPAN&gt;Point&lt;/SPAN&gt;
&lt;SPAN&gt;'invert translate the point data (from origin to user ucs)&lt;/SPAN&gt;
                &lt;SPAN&gt;p&lt;/SPAN&gt;.&lt;SPAN&gt;TransformBy&lt;/SPAN&gt;(&lt;SPAN&gt;mat&lt;/SPAN&gt;)
&lt;SPAN&gt;'add translated point to collection&lt;/SPAN&gt;
                &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;p&lt;/SPAN&gt;)
            &lt;SPAN&gt;Next&lt;/SPAN&gt;
			
			 &lt;SPAN&gt;' Get the corners of the range box.&lt;/SPAN&gt;
    		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;tg&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TransientGeometry&lt;/SPAN&gt;
    		&lt;SPAN&gt;tg&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientGeometry&lt;/SPAN&gt;
&lt;SPAN&gt;'create empty min and max points&lt;/SPAN&gt;
            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;minPoint&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Point&lt;/SPAN&gt; 
			&lt;SPAN&gt;minPoint&lt;/SPAN&gt; =  &lt;SPAN&gt;tg&lt;/SPAN&gt;.&lt;SPAN&gt;CreatePoint&lt;/SPAN&gt;(0, 0, 0)
            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;maxPoint&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Point&lt;/SPAN&gt; 
			&lt;SPAN&gt;maxPoint&lt;/SPAN&gt; = &lt;SPAN&gt;tg&lt;/SPAN&gt;.&lt;SPAN&gt;CreatePoint&lt;/SPAN&gt;(0, 0, 0)
&lt;SPAN&gt;'sort points based on x values, and get lowest and highest value&lt;/SPAN&gt;
            &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;Sort&lt;/SPAN&gt;(&lt;SPAN&gt;Function&lt;/SPAN&gt;(&lt;SPAN&gt;x&lt;/SPAN&gt;, &lt;SPAN&gt;y&lt;/SPAN&gt;) &lt;SPAN&gt;x&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt;.&lt;SPAN&gt;CompareTo&lt;/SPAN&gt;(&lt;SPAN&gt;y&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt;))
            &lt;SPAN&gt;minPoint&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt; = &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;First&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt;
            &lt;SPAN&gt;maxPoint&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt; = &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;Last&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt;
&lt;SPAN&gt;'sort points based on y values, and get lowest and highest values&lt;/SPAN&gt;
            &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;Sort&lt;/SPAN&gt;(&lt;SPAN&gt;Function&lt;/SPAN&gt;(&lt;SPAN&gt;x&lt;/SPAN&gt;, &lt;SPAN&gt;y&lt;/SPAN&gt;) &lt;SPAN&gt;x&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt;.&lt;SPAN&gt;CompareTo&lt;/SPAN&gt;(&lt;SPAN&gt;y&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt;))
            &lt;SPAN&gt;minPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt; = &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;First&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt;
            &lt;SPAN&gt;maxPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt; = &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;Last&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt;
&lt;SPAN&gt;'sort points based on z values, and get lowest and highest values&lt;/SPAN&gt;
            &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;Sort&lt;/SPAN&gt;(&lt;SPAN&gt;Function&lt;/SPAN&gt;(&lt;SPAN&gt;x&lt;/SPAN&gt;, &lt;SPAN&gt;y&lt;/SPAN&gt;) &lt;SPAN&gt;x&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt;.&lt;SPAN&gt;CompareTo&lt;/SPAN&gt;(&lt;SPAN&gt;y&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt;))
            &lt;SPAN&gt;minPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt; = &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;First&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt;
            &lt;SPAN&gt;maxPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt; = &lt;SPAN&gt;vPoints&lt;/SPAN&gt;.&lt;SPAN&gt;Last&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt;
&lt;SPAN&gt;'transform min and max points from user ucs back to origin&lt;/SPAN&gt;
            &lt;SPAN&gt;minPoint&lt;/SPAN&gt;.&lt;SPAN&gt;TransformBy&lt;/SPAN&gt;(&lt;SPAN&gt;ucs&lt;/SPAN&gt;.&lt;SPAN&gt;Transformation&lt;/SPAN&gt;)
            &lt;SPAN&gt;maxPoint&lt;/SPAN&gt;.&lt;SPAN&gt;TransformBy&lt;/SPAN&gt;(&lt;SPAN&gt;ucs&lt;/SPAN&gt;.&lt;SPAN&gt;Transformation&lt;/SPAN&gt;)
			
&lt;SPAN&gt;'			MessageBox.Show(minPoint.Z, "Title")&lt;/SPAN&gt;
 
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;SurfaceBodies&lt;/SPAN&gt;.&lt;SPAN&gt;Count&lt;/SPAN&gt; &amp;gt; 1 &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; = &lt;SPAN&gt;Nothing&lt;/SPAN&gt;
        &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
 
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oBox&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Box&lt;/SPAN&gt;
 
&lt;SPAN&gt;Try&lt;/SPAN&gt;
        &lt;SPAN&gt;oBox&lt;/SPAN&gt; = &lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;SurfaceBodies&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN&gt;RangeBox&lt;/SPAN&gt;
&lt;SPAN&gt;Catch&lt;/SPAN&gt;
        &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN&gt;"BBox_X"&lt;/SPAN&gt;) = &lt;SPAN&gt;""&lt;/SPAN&gt;
        &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN&gt;"BBox_Y"&lt;/SPAN&gt;) = &lt;SPAN&gt;""&lt;/SPAN&gt;
        &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN&gt;"BBox_Z"&lt;/SPAN&gt;) = &lt;SPAN&gt;""&lt;/SPAN&gt;
        &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; = &lt;SPAN&gt;Nothing&lt;/SPAN&gt;
        &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Lenght&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Width&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Height&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;

&lt;SPAN&gt;Lenght&lt;/SPAN&gt; = &lt;SPAN&gt;FormatNumber&lt;/SPAN&gt;(&lt;SPAN&gt;oBox&lt;/SPAN&gt;.&lt;SPAN&gt;MaxPoint&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt; - &lt;SPAN&gt;oBox&lt;/SPAN&gt;.&lt;SPAN&gt;MinPoint&lt;/SPAN&gt;.&lt;SPAN&gt;X&lt;/SPAN&gt;, 1) &amp;amp; &lt;SPAN&gt;" cm"&lt;/SPAN&gt;
&lt;SPAN&gt;Width&lt;/SPAN&gt; = &lt;SPAN&gt;FormatNumber&lt;/SPAN&gt;(&lt;SPAN&gt;oBox&lt;/SPAN&gt;.&lt;SPAN&gt;MaxPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt; - &lt;SPAN&gt;oBox&lt;/SPAN&gt;.&lt;SPAN&gt;MinPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Y&lt;/SPAN&gt;, 1) &amp;amp; &lt;SPAN&gt;" cm"&lt;/SPAN&gt;
&lt;SPAN&gt;Height&lt;/SPAN&gt; = &lt;SPAN&gt;FormatNumber&lt;/SPAN&gt;(&lt;SPAN&gt;oBox&lt;/SPAN&gt;.&lt;SPAN&gt;MaxPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt; - &lt;SPAN&gt;oBox&lt;/SPAN&gt;.&lt;SPAN&gt;MinPoint&lt;/SPAN&gt;.&lt;SPAN&gt;Z&lt;/SPAN&gt;, 1) &amp;amp; &lt;SPAN&gt;" cm"&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;Lenght&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" x "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Width&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" x "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Height&lt;/SPAN&gt;, &lt;SPAN&gt;"Size of Part"&lt;/SPAN&gt;)


&lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; = &lt;SPAN&gt;Nothing&lt;/SPAN&gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 10:10:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8512553#M80509</guid>
      <dc:creator>ngocson8335</dc:creator>
      <dc:date>2019-01-10T10:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8513610#M80510</link>
      <description>&lt;P&gt;So you have the confusion of how to calculate the distance between two points, and which method to use.&amp;nbsp; Think of it like this:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; If you use the method your code shows, where you break down 2 points into their 3 components (x,y,z) and then calculated the total distance, you will definitely get a ORIGIN based bounding box.&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; If you use a different method (point1.distanceto(point2)), you will get a direct calculation between two points.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your two points are in 3D space, you want to get distances from 2 dimensions, you need to create points that eliminate the third dimension per 'work plane' of interest.&amp;nbsp; Example:&lt;/P&gt;
&lt;P&gt;dim pXYMin as point = tg.createpoint(minPoint.x,minpoint,x,0) 'see we only drop the z value&lt;/P&gt;
&lt;P&gt;dim pXYMax as point = tg.createpoint(maxPoint.x,maxpoint.y,0)&lt;/P&gt;
&lt;P&gt;dim distXY as double = pxymin.distanceto(pxymax)&lt;/P&gt;
&lt;P&gt;'repeat for yz, and xz where you drop the x value then the y value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 16:26:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8513610#M80510</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-01-10T16:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Bounding box with the UCS Origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8513644#M80511</link>
      <description>&lt;P&gt;Also since your box is rotated per ucs1 in 3d space, you have two options:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Trigonometry (turn the diagonal flat plane line into a right triangle equation to get the length and with)&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; You could attempt to get the values Before we transform them BACK to origin ucs.&lt;/P&gt;
&lt;P&gt;In fact if getting bounding lengths is you goal, then the second option is probably the easiest for your situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 16:35:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/bounding-box-with-the-ucs-origin/m-p/8513644#M80511</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-01-10T16:35:26Z</dc:date>
    </item>
  </channel>
</rss>

