<?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: Calculate Length, width and Thickness in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12462390#M161937</link>
    <description>&lt;P&gt;Hello, you could use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-OrientedBox" target="_blank"&gt;OrientedMinimumRangeBox&lt;/A&gt;. In a Multibodypart you would then specify the body.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;compdef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;OrientedBox&lt;/SPAN&gt; = &lt;SPAN&gt;compdef&lt;/SPAN&gt;.&lt;SPAN&gt;OrientedMinimumRangeBox&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;dir1&lt;/SPAN&gt;, &lt;SPAN&gt;dir2&lt;/SPAN&gt;, &lt;SPAN&gt;dir3&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Double&lt;/SPAN&gt;
&lt;SPAN&gt;dir1&lt;/SPAN&gt; = &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt;.&lt;SPAN&gt;DirectionOne&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt;, 1) *10
&lt;SPAN&gt;dir2&lt;/SPAN&gt; = &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt;.&lt;SPAN&gt;DirectionTwo&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt;, 1) *10
&lt;SPAN&gt;dir3&lt;/SPAN&gt; = &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt;.&lt;SPAN&gt;DirectionThree&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt;, 1) * 10

&lt;SPAN&gt;' '----------Show axis If needed----------&lt;/SPAN&gt;
&lt;SPAN&gt;'origin = compdef.WorkPoints.AddFixed(minimumboundingbox.CornerPoint) : origin.Name = "origin"&lt;/SPAN&gt;
&lt;SPAN&gt;'dir1axis =  compdef.WorkAxes.AddFixed(minimumboundingbox.CornerPoint, minimumboundingbox.DirectionOne.AsUnitVector) : dir1axis.Name = "dir1axis"&lt;/SPAN&gt;
&lt;SPAN&gt;'dir2axis =  compdef.WorkAxes.AddFixed(minimumboundingbox.CornerPoint, minimumboundingbox.DirectionTwo.AsUnitVector) : dir2axis.Name = "dir2axis"&lt;/SPAN&gt;
&lt;SPAN&gt;'dir3axis =  compdef.WorkAxes.AddFixed(minimumboundingbox.CornerPoint, minimumboundingbox.DirectionThree.AsUnitVector) : dir3axis.Name = "dir3axis"&lt;/SPAN&gt;

&lt;SPAN&gt;length&lt;/SPAN&gt; = &lt;SPAN&gt;MaxOfMany&lt;/SPAN&gt;(&lt;SPAN&gt;dir1&lt;/SPAN&gt;, &lt;SPAN&gt;dir2&lt;/SPAN&gt;, &lt;SPAN&gt;dir3&lt;/SPAN&gt;)
&lt;SPAN&gt;width&lt;/SPAN&gt; = &lt;SPAN&gt;MinOfMany&lt;/SPAN&gt;(&lt;SPAN&gt;dir1&lt;/SPAN&gt;, &lt;SPAN&gt;dir2&lt;/SPAN&gt;, &lt;SPAN&gt;dir3&lt;/SPAN&gt;)
&lt;SPAN&gt;height&lt;/SPAN&gt; = (&lt;SPAN&gt;dir1&lt;/SPAN&gt; + &lt;SPAN&gt;dir2&lt;/SPAN&gt; + &lt;SPAN&gt;dir3&lt;/SPAN&gt;) -&lt;SPAN&gt;length&lt;/SPAN&gt; - &lt;SPAN&gt;width&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Dec 2023 09:59:52 GMT</pubDate>
    <dc:creator>jeremy.goenen</dc:creator>
    <dc:date>2023-12-26T09:59:52Z</dc:date>
    <item>
      <title>Calculate Length, width and Thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12462112#M161934</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to calculate the length, width and thickness of a Plate,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WRahmanK_0-1703568700622.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1307893i816062BD05CFC5C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WRahmanK_0-1703568700622.png" alt="WRahmanK_0-1703568700622.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Below is my code to calculate the length, Width &amp;amp; Thickness,&lt;/P&gt;&lt;LI-CODE lang="general"&gt;                           Inventor.Point maxpoint = Pdoc.ComponentDefinition.RangeBox.MaxPoint;
                            Inventor.Point minpoint = Pdoc.ComponentDefinition.RangeBox.MinPoint;

                            Inventor.Point2d p1 = InvApp.TransientGeometry.CreatePoint2d(0, 0);
                            Inventor.Point2d p2 = InvApp.TransientGeometry.CreatePoint2d(0, 0);
                            PlanarSketch sk = null;
                            List&amp;lt;double&amp;gt; db = new List&amp;lt;double&amp;gt;();

                            double[] arr = { maxpoint.X - minpoint.X, maxpoint.Y - minpoint.Y, maxpoint.Z - minpoint.Z };
                            //double[] arr = { p2.X - p1.X, p2.Y - p1.Y, 0 };
                            Array.Sort(arr);

                            db.Sort();

                            for (int i = 0; i &amp;lt; arr.Length; i++)
                            {
                                if (arr[i] &amp;lt; 0) { arr[i] = arr[i] * -1; }
                            }

                            double G_L = arr[2] * 10; //dbmax[dbmax.Count - 1] * 10;//
                            double G_W = arr[1] * 10; //dbmax[dbmax.Count - 2] * 10;
                            double G_H = arr[0] * 10; //db[0] * 10;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;if the plate is aligned to any Default plane, I am getting the Length, Width &amp;amp; Thickness correctly, if the plate is not aligned to any Default Plane, then there is some outer boundary generated due to which the above code output wrong length, Width and Thickness.&lt;BR /&gt;Could anyone advice how to get only particular &lt;STRONG&gt;solid bodies&lt;/STRONG&gt; and then calculate the length, width and Thickness, or any other best method to calculate these values.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 05:39:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12462112#M161934</guid>
      <dc:creator>WRahmanK</dc:creator>
      <dc:date>2023-12-26T05:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Length, width and Thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12462390#M161937</link>
      <description>&lt;P&gt;Hello, you could use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-OrientedBox" target="_blank"&gt;OrientedMinimumRangeBox&lt;/A&gt;. In a Multibodypart you would then specify the body.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;compdef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;OrientedBox&lt;/SPAN&gt; = &lt;SPAN&gt;compdef&lt;/SPAN&gt;.&lt;SPAN&gt;OrientedMinimumRangeBox&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;dir1&lt;/SPAN&gt;, &lt;SPAN&gt;dir2&lt;/SPAN&gt;, &lt;SPAN&gt;dir3&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Double&lt;/SPAN&gt;
&lt;SPAN&gt;dir1&lt;/SPAN&gt; = &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt;.&lt;SPAN&gt;DirectionOne&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt;, 1) *10
&lt;SPAN&gt;dir2&lt;/SPAN&gt; = &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt;.&lt;SPAN&gt;DirectionTwo&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt;, 1) *10
&lt;SPAN&gt;dir3&lt;/SPAN&gt; = &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;minimumboundingbox&lt;/SPAN&gt;.&lt;SPAN&gt;DirectionThree&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt;, 1) * 10

&lt;SPAN&gt;' '----------Show axis If needed----------&lt;/SPAN&gt;
&lt;SPAN&gt;'origin = compdef.WorkPoints.AddFixed(minimumboundingbox.CornerPoint) : origin.Name = "origin"&lt;/SPAN&gt;
&lt;SPAN&gt;'dir1axis =  compdef.WorkAxes.AddFixed(minimumboundingbox.CornerPoint, minimumboundingbox.DirectionOne.AsUnitVector) : dir1axis.Name = "dir1axis"&lt;/SPAN&gt;
&lt;SPAN&gt;'dir2axis =  compdef.WorkAxes.AddFixed(minimumboundingbox.CornerPoint, minimumboundingbox.DirectionTwo.AsUnitVector) : dir2axis.Name = "dir2axis"&lt;/SPAN&gt;
&lt;SPAN&gt;'dir3axis =  compdef.WorkAxes.AddFixed(minimumboundingbox.CornerPoint, minimumboundingbox.DirectionThree.AsUnitVector) : dir3axis.Name = "dir3axis"&lt;/SPAN&gt;

&lt;SPAN&gt;length&lt;/SPAN&gt; = &lt;SPAN&gt;MaxOfMany&lt;/SPAN&gt;(&lt;SPAN&gt;dir1&lt;/SPAN&gt;, &lt;SPAN&gt;dir2&lt;/SPAN&gt;, &lt;SPAN&gt;dir3&lt;/SPAN&gt;)
&lt;SPAN&gt;width&lt;/SPAN&gt; = &lt;SPAN&gt;MinOfMany&lt;/SPAN&gt;(&lt;SPAN&gt;dir1&lt;/SPAN&gt;, &lt;SPAN&gt;dir2&lt;/SPAN&gt;, &lt;SPAN&gt;dir3&lt;/SPAN&gt;)
&lt;SPAN&gt;height&lt;/SPAN&gt; = (&lt;SPAN&gt;dir1&lt;/SPAN&gt; + &lt;SPAN&gt;dir2&lt;/SPAN&gt; + &lt;SPAN&gt;dir3&lt;/SPAN&gt;) -&lt;SPAN&gt;length&lt;/SPAN&gt; - &lt;SPAN&gt;width&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 09:59:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12462390#M161937</guid>
      <dc:creator>jeremy.goenen</dc:creator>
      <dc:date>2023-12-26T09:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Length, width and Thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12469711#M161995</link>
      <description>&lt;P&gt;Thanks for the effort you put into this...&lt;BR /&gt;I cannot find 'OrientedMinimumRangeBox' API under&amp;nbsp;ComponentDefinition&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WRahmanK_2-1704031887368.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1309147i6B25772405EB6B5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WRahmanK_2-1704031887368.png" alt="WRahmanK_2-1704031887368.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think some dll reference need to be added to include Autodesk.Ilogic.Runtime&amp;nbsp; header in the coding...&lt;BR /&gt;if am i right please tell me what reference to add or else please help me with any possible solution...&lt;/P&gt;</description>
      <pubDate>Sun, 31 Dec 2023 14:09:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12469711#M161995</guid>
      <dc:creator>WRahmanK</dc:creator>
      <dc:date>2023-12-31T14:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Length, width and Thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12469784#M161996</link>
      <description>&lt;P&gt;What version of Inventor are you using? Oriented rangebox has been implemented in later versions of Inventor.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Dec 2023 16:09:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calculate-length-width-and-thickness/m-p/12469784#M161996</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2023-12-31T16:09:19Z</dc:date>
    </item>
  </channel>
</rss>

