Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
fakeru
354 Views, 2 Replies

Box.IsDisjoint Method

I'm trying to suppress with VBA all occurrences in assembly based on the condition if they intersect a part(cube:1).

I'm using rangeboxes for that and IsDisjoint methond. However nothing works as I expect.

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

 

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.

 

Regards

Alexandru

Autodesk Inventor 2015 Certified Professional