<?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: Box.IsDisjoint Method in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/box-isdisjoint-method/m-p/5998200#M61081</link>
    <description>&lt;P&gt;I found the solution myself. I had to delcare and set the rangebox of each occurrence:&lt;/P&gt;&lt;P&gt;Dim oRB As Box&lt;BR /&gt;Set oRB = oOcc.RangeBox&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the entire code looks like this:&lt;/P&gt;&lt;PRE&gt;Public Sub CopySketch()

 Dim AssDoc As Inventor.AssemblyDocument
 Set AssDoc = ThisApplication.ActiveDocument
        Dim oAsmCompDef As Inventor.AssemblyComponentDefinition
        Set oAsmCompDef = AssDoc.ComponentDefinition
        Dim oOcc As ComponentOccurrence
        
        Dim CutBox As Box
       Set CutBox = AssDoc.ComponentDefinition.Occurrences.ItemByName("Cube:1").Definition.RangeBox
        For Each oOcc In oAsmCompDef.Occurrences
        
         Dim oRB As Box
        Set oRB = oOcc.RangeBox
            If oRB.IsDisjoint(CutBox) = True Then

                oOcc.Suppress
            End If
        Next

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jan 2016 20:55:09 GMT</pubDate>
    <dc:creator>fakeru</dc:creator>
    <dc:date>2016-01-20T20:55:09Z</dc:date>
    <item>
      <title>Box.IsDisjoint Method</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/box-isdisjoint-method/m-p/5995653#M61048</link>
      <description>&lt;P&gt;I'm trying to suppress with VBA all occurrences in assembly based on the condition if they intersect a part(cube:1).&lt;/P&gt;&lt;P&gt;I'm using rangeboxes for that and IsDisjoint methond. However nothing works as I expect.&lt;/P&gt;&lt;PRE&gt;Public Sub CutBox()
Dim AssDoc As AssemblyDocument
 Set AssDoc = ThisApplication.ActiveDocument
        Dim oAsmCompDef As Inventor.AssemblyComponentDefinition
        Set oAsmCompDef = AssDoc.ComponentDefinition
        Dim oOcc As ComponentOccurrence
        
        Dim CutBox As Box
       Set CutBox = AssDoc.ComponentDefinition.Occurrences.ItemByName("Cube:1").Definition.RangeBox
        For Each oOcc In oAsmCompDef.Occurrences
            If oOcc.Definition.RangeBox.IsDisjoint(CutBox) = True Then
                oOcc.Suppress
            End If
        Next

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea what's wrong? I'm sure that some occurrences' rangebox do not intersect the cube's part range box, but Inventor doesn't suppress those occurrences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Alexandru&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 15:28:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/box-isdisjoint-method/m-p/5995653#M61048</guid>
      <dc:creator>fakeru</dc:creator>
      <dc:date>2016-01-19T15:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Box.IsDisjoint Method</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/box-isdisjoint-method/m-p/5998200#M61081</link>
      <description>&lt;P&gt;I found the solution myself. I had to delcare and set the rangebox of each occurrence:&lt;/P&gt;&lt;P&gt;Dim oRB As Box&lt;BR /&gt;Set oRB = oOcc.RangeBox&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the entire code looks like this:&lt;/P&gt;&lt;PRE&gt;Public Sub CopySketch()

 Dim AssDoc As Inventor.AssemblyDocument
 Set AssDoc = ThisApplication.ActiveDocument
        Dim oAsmCompDef As Inventor.AssemblyComponentDefinition
        Set oAsmCompDef = AssDoc.ComponentDefinition
        Dim oOcc As ComponentOccurrence
        
        Dim CutBox As Box
       Set CutBox = AssDoc.ComponentDefinition.Occurrences.ItemByName("Cube:1").Definition.RangeBox
        For Each oOcc In oAsmCompDef.Occurrences
        
         Dim oRB As Box
        Set oRB = oOcc.RangeBox
            If oRB.IsDisjoint(CutBox) = True Then

                oOcc.Suppress
            End If
        Next

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 20:55:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/box-isdisjoint-method/m-p/5998200#M61081</guid>
      <dc:creator>fakeru</dc:creator>
      <dc:date>2016-01-20T20:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Box.IsDisjoint Method</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/box-isdisjoint-method/m-p/6000248#M61125</link>
      <description>&lt;P&gt;Actually that didn't fix the problem.&lt;/P&gt;&lt;P&gt;The code doesn't work in a consisten manner. Occurrences are being suppressed not based on the rangeboxes interference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Later edit:&lt;/P&gt;&lt;P&gt;Now it seems like I found the problem. It was in this line:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Set CutBox = AssDoc.ComponentDefinition.Occurrences.ItemByName("Cube:1").Definition.RangeBox&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Changed to&lt;/P&gt;&lt;PRE&gt;Set CutBox = AssDoc.ComponentDefinition.Occurrences.ItemByName("Cube:1").RangeBox&lt;/PRE&gt;&lt;P&gt;And it worked&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 21:09:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/box-isdisjoint-method/m-p/6000248#M61125</guid>
      <dc:creator>fakeru</dc:creator>
      <dc:date>2016-01-21T21:09:49Z</dc:date>
    </item>
  </channel>
</rss>

