<?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: Measure.ExtentsHeight reporting wrong value in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/measure-extentsheight-reporting-wrong-value/m-p/4960278#M125099</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks logging case through ADN where you provided the demo document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you switch off the visibility of the XY workplane, the value of&amp;nbsp;Measure.ExtentsHeight is correct.&amp;nbsp;&amp;nbsp;Measure.ExtentsHeight, Length and Width are actually the range box of the surface body. The extent of a workplane should not be covered in. I also checked SurfaceBody.RangeBox of Inventor API, it reports the correct values. So I doubt this is a problem with iLogic wrapped functions of&amp;nbsp;Measure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The workaround is to get&amp;nbsp;SurfaceBody.RangeBox and calculate the&amp;nbsp;Height, Length and Width&amp;nbsp;yourself. The below is a demo. It assumes there is only one surfacebody in this document and 3 parameters are available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'calculate length of part in x axis and place this dimension in length custom parameter&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'length = Measure.ExtentsHeight&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'MsgBox( length)&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;doc &lt;STRONG&gt;=&lt;/STRONG&gt; &lt;STRONG&gt;ThisDoc&lt;/STRONG&gt;.&lt;STRONG&gt;Document&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;def &lt;STRONG&gt;=&lt;/STRONG&gt; doc.ComponentDefinition&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'assume the part has only one surface body&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;sb &lt;STRONG&gt;=&lt;/STRONG&gt; def.SurfaceBodies&lt;STRONG&gt;(1)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'rangebox&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;minPt &lt;STRONG&gt;=&lt;/STRONG&gt; sb.RangeBox.MinPoint&lt;/P&gt;
&lt;P align="left"&gt;maxPt &lt;STRONG&gt;=&lt;/STRONG&gt; sb.RangeBox.MaxPoint&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'calculate the range along X-Y-Z&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' the unit of core API uses centimeter, so needs to convert it to unit of document&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;oUOM &lt;STRONG&gt;=&lt;/STRONG&gt; doc.UnitsOfMeasure&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' X is extent length:&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;X &lt;STRONG&gt;=&lt;/STRONG&gt; Math.abs&lt;STRONG&gt;(&lt;/STRONG&gt;minPt.X &lt;STRONG&gt;-&lt;/STRONG&gt; maxPt.X&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;length &lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp; oUOM.ConvertUnits&lt;STRONG&gt;(&lt;/STRONG&gt;X,"cm" ,oUOM.LengthUnits &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' Y is extent width:&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;Y &lt;STRONG&gt;=&lt;/STRONG&gt; Math.abs&lt;STRONG&gt;(&lt;/STRONG&gt;minPt.Y &lt;STRONG&gt;-&lt;/STRONG&gt; maxPt.Y&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;width &lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp; oUOM.ConvertUnits&lt;STRONG&gt;(&lt;/STRONG&gt;Y,"cm" ,oUOM.LengthUnits &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' Z is extent height:&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;Z &lt;STRONG&gt;=&lt;/STRONG&gt; Math.abs&lt;STRONG&gt;(&lt;/STRONG&gt;minPt.Z &lt;STRONG&gt;-&lt;/STRONG&gt; maxPt.Z&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;height &lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp; oUOM.ConvertUnits&lt;STRONG&gt;(&lt;/STRONG&gt;Z,"cm" ,oUOM.LengthUnits &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Apr 2014 10:38:35 GMT</pubDate>
    <dc:creator>xiaodong_liang</dc:creator>
    <dc:date>2014-04-15T10:38:35Z</dc:date>
    <item>
      <title>Measure.ExtentsHeight reporting wrong value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/measure-extentsheight-reporting-wrong-value/m-p/4945604#M125098</link>
      <description>&lt;P&gt;Good morning all. I'm having a weird problem where my "stock" parts contain a rule to measure their length in the z-axis (used for HSS tubes, rods, angles etc.) so that I can create a liste of cuts to make for my guys on the workshop floor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having an issue with this one part where Measure.ExtentsHeight reports the wrong value. The true length of the part is 42 inches, the reported value by the iLogic code is 46.2 inches.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anything cause such a discrepancy?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any pointers would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 12:29:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/measure-extentsheight-reporting-wrong-value/m-p/4945604#M125098</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-09T12:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Measure.ExtentsHeight reporting wrong value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/measure-extentsheight-reporting-wrong-value/m-p/4960278#M125099</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks logging case through ADN where you provided the demo document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you switch off the visibility of the XY workplane, the value of&amp;nbsp;Measure.ExtentsHeight is correct.&amp;nbsp;&amp;nbsp;Measure.ExtentsHeight, Length and Width are actually the range box of the surface body. The extent of a workplane should not be covered in. I also checked SurfaceBody.RangeBox of Inventor API, it reports the correct values. So I doubt this is a problem with iLogic wrapped functions of&amp;nbsp;Measure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The workaround is to get&amp;nbsp;SurfaceBody.RangeBox and calculate the&amp;nbsp;Height, Length and Width&amp;nbsp;yourself. The below is a demo. It assumes there is only one surfacebody in this document and 3 parameters are available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'calculate length of part in x axis and place this dimension in length custom parameter&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'length = Measure.ExtentsHeight&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'MsgBox( length)&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;doc &lt;STRONG&gt;=&lt;/STRONG&gt; &lt;STRONG&gt;ThisDoc&lt;/STRONG&gt;.&lt;STRONG&gt;Document&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;def &lt;STRONG&gt;=&lt;/STRONG&gt; doc.ComponentDefinition&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'assume the part has only one surface body&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;sb &lt;STRONG&gt;=&lt;/STRONG&gt; def.SurfaceBodies&lt;STRONG&gt;(1)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'rangebox&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;minPt &lt;STRONG&gt;=&lt;/STRONG&gt; sb.RangeBox.MinPoint&lt;/P&gt;
&lt;P align="left"&gt;maxPt &lt;STRONG&gt;=&lt;/STRONG&gt; sb.RangeBox.MaxPoint&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;'calculate the range along X-Y-Z&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' the unit of core API uses centimeter, so needs to convert it to unit of document&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;oUOM &lt;STRONG&gt;=&lt;/STRONG&gt; doc.UnitsOfMeasure&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' X is extent length:&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;X &lt;STRONG&gt;=&lt;/STRONG&gt; Math.abs&lt;STRONG&gt;(&lt;/STRONG&gt;minPt.X &lt;STRONG&gt;-&lt;/STRONG&gt; maxPt.X&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;length &lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp; oUOM.ConvertUnits&lt;STRONG&gt;(&lt;/STRONG&gt;X,"cm" ,oUOM.LengthUnits &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' Y is extent width:&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;Y &lt;STRONG&gt;=&lt;/STRONG&gt; Math.abs&lt;STRONG&gt;(&lt;/STRONG&gt;minPt.Y &lt;STRONG&gt;-&lt;/STRONG&gt; maxPt.Y&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;width &lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp; oUOM.ConvertUnits&lt;STRONG&gt;(&lt;/STRONG&gt;Y,"cm" ,oUOM.LengthUnits &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&lt;EM&gt;' Z is extent height:&lt;/EM&gt;&lt;/P&gt;
&lt;P align="left"&gt;Z &lt;STRONG&gt;=&lt;/STRONG&gt; Math.abs&lt;STRONG&gt;(&lt;/STRONG&gt;minPt.Z &lt;STRONG&gt;-&lt;/STRONG&gt; maxPt.Z&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;height &lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp; oUOM.ConvertUnits&lt;STRONG&gt;(&lt;/STRONG&gt;Z,"cm" ,oUOM.LengthUnits &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2014 10:38:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/measure-extentsheight-reporting-wrong-value/m-p/4960278#M125099</guid>
      <dc:creator>xiaodong_liang</dc:creator>
      <dc:date>2014-04-15T10:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Measure.ExtentsHeight reporting wrong value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/measure-extentsheight-reporting-wrong-value/m-p/5634377#M125100</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came across this post when I was having issues with Measure.Extents giving incorrect values within an assembly. Range.Box may be the way to go but how can this be adapted for use with an assembly please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2015 10:36:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/measure-extentsheight-reporting-wrong-value/m-p/5634377#M125100</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-14T10:36:55Z</dc:date>
    </item>
  </channel>
</rss>

