×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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

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

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

https://picasaweb.google.com/102257836106335725208

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources