08-17-2023
07:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-17-2023
07:10 AM
What about this one? I used your exemple. The code will check if the document name contains the input words you specify in the list :
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
If Not refDoc.ComponentDefinition.IsContentMember Then Continue For
Dim list As New List(Of String)
list.Add("X 25-25 Profile")
Dim check As Boolean = False
For Each s As String In list
If refDoc.DisplayName.Contains(s) Then
check = True
Exit For
End If
Next
If check = False Then Continue For
Dim qty As Integer = occs.AllReferencedOccurrences(refDoc).Count
mass += refDoc.ComponentDefinition.MassProperties.Mass * qty
Next
MessageBox.Show(mass & " kg")
End SubKind 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"