Add compnent occurences crash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This line crashes Inventor and I can't make out what the problem is, can anyone see why? Thanks Dave
' Get the active assembly.
Dim oAsmDoc As AssemblyDocument
oAsmDoc = m_inventorApplication.ActiveDocument
' Get the assembly component definition.
Dim oAsmDef As AssemblyComponentDefinition
oAsmDef = oAsmDoc.ComponentDefinition
' Get all of the leaf occurrences of the assembly.
Dim oLeafOccs As ComponentOccurrencesEnumerator
oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences
' Iterate through the occurrences and print the name.
Dim oOcc As ComponentOccurrence '' tried Dim oOcc as Object as well
For Each oOcc In oLeafOccs
'Debug.Print(oOcc.Name)
Comps.Add(oOcc) ''' crashes INVENTOR (dim comps as Objectcollection ' I can't change this)
Next