Message 1 of 5
In AllReferencedDocuments: Filter out Parts which are referenced because of linked parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a function which runs through all referenced documents in an assembly. I basically use this because it is faster that using Occurrences. But it will pull in parts which are referenced because of linked parameters (and possibly derived too, though I didn't check that yet).
If assembly has Part 1 and Part 2, but Part 1 has parameters linked to Part 3, I would like to avoid reading Part 3. Just read Part 1 and 2.
In a For loop like this how can I filter out parts which are referenced as such?
Thank you much!
Dim oDoc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument
For Each oRefDoc As Inventor.Document In oDoc.AllReferencedDocuments
'Avoid parts with following properties
If oRefDoc.ComponentDefinition.Document.IsModifiable = False Then Continue For
'If oRefDoc.ComponentDefinition.Suppressed Then Continue For
If TypeOf oRefDoc.ComponentDefinition Is VirtualComponentDefinition Then Continue For
If oRefDoc.ComponentDefinition.BOMStructure <> BOMStructureEnum.kNormalBOMStructure Then Continue For
' Get the PropertySets object.
Dim oPropSets As PropertySets = oRefDoc.PropertySets
' Get the design tracking property set.
Dim oPropSet As PropertySet = oPropSets.Item("Design Tracking Properties")
' Get the part number iProperty
Dim oPartName As String = oRefDoc.PropertySets("Design Tracking Properties").Item("Part Number").Value
' Get the description iProperty
Dim odescr As String = oRefDoc.PropertySets("Design Tracking Properties").Item("Description").Value
'MessageBox.Show(oPartName)
MessageBox.Show("Part Name: " & oPartName & vbLf & "Description: " & odescr)
Next