-
1
- #1
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Sub Main()
Dim CATIA
Dim doc, prod
Set CATIA = GetObject(, "CATIA.Application")
Set doc = CATIA.ActiveDocument
Set prod = CATIA.ActiveDocument.Product
Dim dict
Set dict = GetProductBOM(doc, prod)
Dim k As Variant
For Each k In dict.Keys
Debug.Print k, dict(k)
Next
End Sub
Function GetProductBOM(doc, prod)
Dim dict
Dim curr As Product
Dim dictKey As String
Set dict = CreateObject("Scripting.Dictionary")
For Each curr In prod.Products
Do
dictKey = curr.PartNumber
If dict.Exists(dictKey) Then
dict(dictKey) = dict(dictKey) + 1
Else
dict.Add dictKey, 1
End If
Loop While False
Next
Set GetProductBOM = dict
End Function