01-20-2016
12:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-20-2016
12:51 PM
I found the solution myself. I had to delcare and set the rangebox of each occurrence:
Dim oRB As Box
Set oRB = oOcc.RangeBox
So the entire code looks like this:
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
Autodesk Inventor 2015 Certified Professional