<?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 Issue with measure tool in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-measure-tool/m-p/7894293#M82717</link>
    <description>&lt;P&gt;I am trying to create a bit of code in visual studio (VB.Net) that will allow me to select 2 or more parts in an assembly (1 primary and x number of secondary items).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My model tree is:&lt;/P&gt;&lt;P&gt;- Top level assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB Assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Components&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB Screen 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB Screen 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to measure the distance between occurrence of the PCB assembly, with each occurrence of the top level assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below and&amp;nbsp;errors on the measure line if the&amp;nbsp;first "for... each" loop in included.&amp;nbsp;(e.g. If I pick a PCB (primary) and a screen (secondary) as I assume it's not reading the occurrence correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I pass the PCB assembly (comp_occ1) to the measure function it works (but just for the PCB occurrence).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone shed some light on what I'm missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; asmDoc &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;AssemblyDocument&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; = inventorApp.ActiveDocument &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;' Active Assembly&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; oOccs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrences&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; = asmDoc.ComponentDefinition.Occurrences &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;' Occurrences in active assembly&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; comp_occ1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrence&lt;/FONT&gt; &lt;FONT color="#008000" face="Consolas" size="2"&gt;' Primary Occurrence&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; comp_occ2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrence&lt;/FONT&gt; &lt;FONT color="#008000" face="Consolas" size="2"&gt;'Second Occurrence &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; seccomparray &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;New&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ArrayList&lt;/FONT&gt; &lt;FONT color="#008000" face="Consolas" size="2"&gt;' Array of all secondary components&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; cont2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;NameValueMap&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; = inventorApp.TransientObjects.CreateNameValueMap &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;' Used for measure command&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; distance2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Double&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; SubAsmdoc &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;AssemblyDocument&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; compdef &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;AssemblyComponentDefinition&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;comp_occ1 = inventorApp.CommandManager.Pick(Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;SelectionFilterEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kAssemblyOccurrenceFilter, &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Select Prmimary Item (E.g. PCB Assy)"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SubAsmdoc = inventorApp.Documents.ItemByName(comp_occ1.ReferencedFileDescriptor.FullFileName)&lt;/P&gt;&lt;P&gt;compdef = SubAsmdoc.ComponentDefinition&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;While&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;True&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;comp_occ2 = inventorApp.CommandManager.Pick(Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;SelectionFilterEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kAssemblyOccurrenceFilter, &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Select Secondary Item(s) (E.g. Screen)"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;If&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; IsNothing(comp_occ2) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Exit While&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;seccomparray.Add(comp_occ2)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;End&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;While&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;For&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Each&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; occ &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrence&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;In&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; SubAsmdoc.ComponentDefinition.Occurrences&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;For&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Each&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; seccomp &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;In&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; seccomparray&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Try&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;distance2 = inventorApp.MeasureTools.GetMinimumDistance( _&lt;/P&gt;&lt;P&gt;occ.Name, seccomp, _&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;InferredTypeEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kNoInference, _&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;InferredTypeEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kNoInference, _&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;cont2)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Catch&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Gap = &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Measure Failed"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;End&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Try&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 14:01:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-03-29T14:01:24Z</dc:date>
    <item>
      <title>Issue with measure tool</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-measure-tool/m-p/7894293#M82717</link>
      <description>&lt;P&gt;I am trying to create a bit of code in visual studio (VB.Net) that will allow me to select 2 or more parts in an assembly (1 primary and x number of secondary items).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My model tree is:&lt;/P&gt;&lt;P&gt;- Top level assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB Assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Components&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB Screen 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - PCB Screen 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to measure the distance between occurrence of the PCB assembly, with each occurrence of the top level assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below and&amp;nbsp;errors on the measure line if the&amp;nbsp;first "for... each" loop in included.&amp;nbsp;(e.g. If I pick a PCB (primary) and a screen (secondary) as I assume it's not reading the occurrence correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I pass the PCB assembly (comp_occ1) to the measure function it works (but just for the PCB occurrence).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone shed some light on what I'm missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; asmDoc &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;AssemblyDocument&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; = inventorApp.ActiveDocument &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;' Active Assembly&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; oOccs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrences&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; = asmDoc.ComponentDefinition.Occurrences &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;' Occurrences in active assembly&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; comp_occ1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrence&lt;/FONT&gt; &lt;FONT color="#008000" face="Consolas" size="2"&gt;' Primary Occurrence&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; comp_occ2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrence&lt;/FONT&gt; &lt;FONT color="#008000" face="Consolas" size="2"&gt;'Second Occurrence &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; seccomparray &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;New&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ArrayList&lt;/FONT&gt; &lt;FONT color="#008000" face="Consolas" size="2"&gt;' Array of all secondary components&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; cont2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;NameValueMap&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; = inventorApp.TransientObjects.CreateNameValueMap &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;' Used for measure command&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; distance2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Double&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; SubAsmdoc &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;AssemblyDocument&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; compdef &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;AssemblyComponentDefinition&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;comp_occ1 = inventorApp.CommandManager.Pick(Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;SelectionFilterEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kAssemblyOccurrenceFilter, &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Select Prmimary Item (E.g. PCB Assy)"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SubAsmdoc = inventorApp.Documents.ItemByName(comp_occ1.ReferencedFileDescriptor.FullFileName)&lt;/P&gt;&lt;P&gt;compdef = SubAsmdoc.ComponentDefinition&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;While&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;True&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;comp_occ2 = inventorApp.CommandManager.Pick(Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;SelectionFilterEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kAssemblyOccurrenceFilter, &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Select Secondary Item(s) (E.g. Screen)"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;If&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; IsNothing(comp_occ2) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Exit While&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;seccomparray.Add(comp_occ2)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;End&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;While&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;For&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Each&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; occ &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComponentOccurrence&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;In&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; SubAsmdoc.ComponentDefinition.Occurrences&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;For&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Each&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; seccomp &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;In&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; seccomparray&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Try&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;distance2 = inventorApp.MeasureTools.GetMinimumDistance( _&lt;/P&gt;&lt;P&gt;occ.Name, seccomp, _&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;InferredTypeEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kNoInference, _&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Inventor.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;InferredTypeEnum&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.kNoInference, _&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;cont2)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Catch&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Gap = &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Measure Failed"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;End&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Try&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 14:01:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-measure-tool/m-p/7894293#M82717</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-29T14:01:24Z</dc:date>
    </item>
  </channel>
</rss>

