Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CATScript - How Do I know if an object is a part or a product below a product 1

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
In a CATScript CATIA appears to consider both part leaves and product leaves as "Products" (typename). What would be a way to differentiate between the two?

Thanks,
Jeff
 
Replies continue below

Recommended for you

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor