Analyze a catproduct.CATScript
Language="VBSCRIPT"
Option Explicit
Sub catmain()
Dim rootprod As Product
Set rootprod = CATIA.ActiveDocument.Product
Dim indent As Integer
indent = 0
Call dumpProduct(rootprod, indent)
End Sub
Sub dumpProduct(aProd As Product, indent As Integer)
Dim ix As String
Dim i As Integer
For i = 1 To indent
ix = ix & " "
Next
Dim docname As String
docname = aProd.ReferenceProduct.Parent.Name
Dim theType As String
If InStr(docname, ".CATProduct") > 0 Then
theType = "Product"
ElseIf InStr(docname, ".CATPart") > 0 Then
theType = "Part"
Else
theType = "Unknown"
End If
'Debug.Print ix & aProd.PartNumber & " is a " & theType
If theType = "Product" Then
For i = 1 To aProd.Products.count
Call dumpProduct(aProd.Products.Item(i), indent + 1)
Next
End If
End Sub
Regards
Fernando