08-17-2023
06:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-17-2023
06:47 AM
Hi @ober2558,
You could do as folowing :
Sub Main
Dim doc As AssemblyDocument = ThisApplication.ActiveDocument
Dim occs As ComponentOccurrences = doc.ComponentDefinition.Occurrences
Dim mass As Double
For Each refDoc As Document In doc.AllReferencedDocuments
If TypeOf refDoc Is AssemblyDocument Then Continue For
Dim qty As Integer = occs.AllReferencedOccurrences(refDoc).Count
If Not refDoc.ComponentDefinition.IsContentMember Then Continue For
Dim list As New List(Of String)
list.Add("ISO 4032 M12")
list.Add("ISO 4032 M10")
list.Add("ISO 4032 M16")
If list.Contains(refDoc.DisplayName) = False Then Continue For
mass += refDoc.ComponentDefinition.MassProperties.Mass * qty
Next
MessageBox.Show(mass & " kg")
End SubSimply change the names in the list.add(name) method.
You can add more lines if desired.
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"