Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi There,
I am trying to figure out a easy way of counting all visible parts with certain iProperties. Until now I made the bellow code which is working OK but it is counting only parts that are in main assembly, I can't figure it out how to access the parts from mine subassemblies.
Tanks in advance for your help
'Assembly object as ComponentDefinition
Dim oAsmComp As AssemblyDocument = ThisDoc.Document
oAsmCompDef = oAsmComp.ComponentDefinition
Dim iQtyTotlal As Integer = 0
Dim iQty18MB As Integer = 0
Dim iQtyMDF As Integer = 0
Dim iQty38SP As Integer = 0
Dim iQty10MB As Integer = 0
For Each oOccurrence In oAsmCompDef.Occurrences
Dim oName As String
oName = oOccurrence.Name
'18 MB
Dim MB18 As String = iProperties.Value(oName, "Project", "Description")
If MB18.Contains("18 MB") Then
If Component.Visible(oName) = True Then
iQty18MB += 1
iQtyTotlal+=1
End If
End If
Dim MB10 As String = iProperties.Value(oName, "Project", "Description")
If MB18.Contains("10 MB") Then
If Component.Visible(oName) = True Then
iQty10MB += 1
iQtyTotlal+=1
End If
End If
If iProperties.Value(oName, "Project", "Description") = "38 SP" Then
If Component.Visible(oName) = True Then
iQty38SP += 1
iQtyTotlal+=1
End If
End If
If iProperties.Value(oName, "Project", "Description") = "18 MDF" Then
If Component.Visible(oName) = True Then
iQtyMDF += 1
iQtyTotlal+=1
End If
End If
' End if
Next
MsgBox("Into this assembly are: " & vbCrLf & vbCrLf & vbCrLf _
& iQty38SP & " - Visible 38mm Block-Panels." & vbCrLf & vbCrLf _
& iQty18MB & " - Visible 18mm Panels." & vbCrLf & vbCrLf _
& iQty10MB & " - Visible 10mm Panels." & vbCrLf & vbCrLf _
& iQtyMDF & " - Visible MDF's." & vbCrLf & vbCrLf & vbCrLf _
& iQtyTotlal & " - In Total." _
, vbOKOnly, "QTY of visible panels into this assemly")
Solved! Go to Solution.