Message 1 of 3
Identifying occurrences in assembly

Not applicable
11-11-2014
06:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to identify different occurrences in my assembly and its subassemblies,
so far I'm traversing down the assembly tree like this;
Sub Main() On Error Resume Next
Dim oDoc As AssemblyDocument oDoc = ThisDoc.Document oDoc.ObjectVisibility.AllWorkFeatures() = True Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = oDoc.ComponentDefinition oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").Activate Dim occBoolean As Boolean occBoolean = False Dim oOcc As Inventor.ComponentOccurrence For Each oOcc In oAsmCompDef.Occurrences oOcc.SetDesignViewRepresentation("Default", True) MsgBox(oOcc.Definition) If oOcc.SubOccurrences.Count = 0 Then Else Call processAllSubOcc(oOcc) End If Next InventorVb.DocumentUpdate() End Sub Private Sub processAllSubOcc(Occ As Inventor.ComponentOccurrence) Dim oSubCompOcc As ComponentOccurrence For Each oSubCompOcc In Occ.SubOccurrences
If oSubCompOcc.SubOccurrences.Count = 0 Then Else oSubCompOcc.Visible = occBoolean Call processAllSubOcc(oSubCompOcc) End If Next End Sub
The problem is that I can't tell the occurrences apart as they are just "occurrences". Well, I can tell the assemblies and part documents by looking at the DefinitionDocumentType property of the component occurrence, but what about work features? How do I identify work planes or axes as occurrences in an assembly?
Help is much appreciated!