<?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: Measuring distance from assembly occurrence feature to Assembly World plane feature in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11150086#M137817</link>
    <description>&lt;P&gt;I knew I was going to have figure out Proxy geometry sooner or later, this forced me into that moment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Creating the Proxy plane and using the MeasureTools was the winning combination.&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2022 15:16:43 GMT</pubDate>
    <dc:creator>llorden4</dc:creator>
    <dc:date>2022-05-05T15:16:43Z</dc:date>
    <item>
      <title>Measuring distance from assembly occurrence feature to Assembly World plane feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11149405#M137787</link>
      <description>&lt;P&gt;Using a null entry works for constraining inserted occurrence features to the world UCS of the assembly file, but it appears a null entry isn't allowed with the measure tools features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dist&lt;/SPAN&gt; = &lt;SPAN&gt;Measure&lt;/SPAN&gt;.&lt;SPAN&gt;MinimumDistance&lt;/SPAN&gt;(&lt;SPAN&gt;"Part:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"YZ Plane"&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;, &lt;SPAN&gt;"XZ Plane"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;This returns an error that part "" cannot be found.&amp;nbsp; How am I supposed to measure distances between work features of an occurrence to my world work features?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="llorden4_0-1651749477137.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1063403iD5786700CC4FEBEC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="llorden4_0-1651749477137.png" alt="llorden4_0-1651749477137.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 11:18:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11149405#M137787</guid>
      <dc:creator>llorden4</dc:creator>
      <dc:date>2022-05-05T11:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring distance from assembly occurrence feature to Assembly World plane feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11149484#M137789</link>
      <description>&lt;P&gt;I'm on my phone so can't try it out right now but "", is an empty string not null. Null is VB is 'nothing'&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 12:01:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11149484#M137789</guid>
      <dc:creator>basautomationservices</dc:creator>
      <dc:date>2022-05-05T12:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring distance from assembly occurrence feature to Assembly World plane feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11149552#M137791</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/560097"&gt;@llorden4&lt;/a&gt;.&amp;nbsp; Those two built-in tools for measuring stuff don't always suit every need...that's for sure.&amp;nbsp; But the similar method found under the ThisApplication.&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-240D2F92-2701-4D9D-BCE7-02759538E2FC" target="_blank" rel="noopener"&gt;MeasureTools.GetMinimumDistance()&lt;/A&gt; is likely going to be a better fit in a scenario like that.&amp;nbsp; And if that doesn't work either, you will just have to do it the hard way...using object geometry properties.&amp;nbsp; WorkPlanes have a Plane property that obviously returns a Plane.&amp;nbsp; You can follow the trail of properties and methods branching from those geometry objects for measurement type purposes.&lt;/P&gt;
&lt;P&gt;Here is a mixed example...going the longer route, just in case it may be needed.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oOcc As ComponentOccurrence = PickComponent
	If IsNothing(oOcc) Then Exit Sub
	Dim oOccWPlane1 As WorkPlane = oOcc.Definition.WorkPlanes.Item(1)
	Dim oOccWPlane1Proxy As WorkPlaneProxy = Nothing
	oOcc.CreateGeometryProxy(oOccWPlane1, oOccWPlane1Proxy)
	Dim oADef As AssemblyComponentDefinition = oOcc.Parent
	oAWPlane1 = oADef.WorkPlanes.Item(1)
	Dim oDist1, oDist2 As Double
	If oOccWPlane1Proxy.Plane.IsParallelTo(oAWPlane1.Plane, 0.0001) Then
		oDist1 = oOccWPlane1Proxy.Plane.DistanceTo(oAWPlane1.Plane.RootPoint)
		oDist2 = ThisApplication.MeasureTools.GetMinimumDistance(oOccWPlane1Proxy.Plane, oAWPlane1.Plane)
	Else
		MsgBox("The two planes were not parallel.",,"") : Exit Sub
	End If
	MsgBox("oDist1 = " &amp;amp; oDist1 &amp;amp; vbCrLf &amp;amp; "oDist2 = " &amp;amp; oDist2,,"")
End Sub

Function PickComponent(Optional oPrompt As String = vbNullString) As ComponentOccurrence
	oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select a Component.")
	If IsNothing(oObj) OrElse (TypeOf oObj Is ComponentOccurrence = False) Then Return Nothing
	Dim oOcc As ComponentOccurrence = oObj
	Return oOcc
End Function&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 May 2022 12:24:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11149552#M137791</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-05T12:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring distance from assembly occurrence feature to Assembly World plane feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11150086#M137817</link>
      <description>&lt;P&gt;I knew I was going to have figure out Proxy geometry sooner or later, this forced me into that moment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Creating the Proxy plane and using the MeasureTools was the winning combination.&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 15:16:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/measuring-distance-from-assembly-occurrence-feature-to-assembly/m-p/11150086#M137817</guid>
      <dc:creator>llorden4</dc:creator>
      <dc:date>2022-05-05T15:16:43Z</dc:date>
    </item>
  </channel>
</rss>

