×
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

Identify a CATIA Component from a CATIA Product

Identify a CATIA Component from a CATIA Product

Identify a CATIA Component from a CATIA Product

(OP)
Hi there,

I'm working on a CATIA macro that need to check wether the current product is a real product (with its own .CATProduct file) or a component. The tree icon is different, so this must be stored somewhere...

ex :

for i = 1 to prod_count

if CurrentProd.Products.Item(i) <<is a product>> then
<<do stuffs>>
else

if CurrentProd.Products.Item(i) <<is a component>> then
<<do other stuffs>>
end if
end if


Thanks if you can help me,

Victor

RE: Identify a CATIA Component from a CATIA Product

Hi

CODE --> CATScript

Language="VBSCRIPT"
Sub CATMain()
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products

For i = 1 To products1.Count
NameOfProdPart = products1.Item(i).ReferenceProduct.Parent.Name

If Right(NameOfProdPart,7) = "CATPart" Then
Msgbox "Part! " & NameOfProdPart
Elseif Right(NameOfProdPart,7) = "Product" Then

If NameOfProdPart = product1.Name & ".CATProduct" Then
Msgbox "Component! " & NameOfProdPart
Else
Msgbox "Product! " & NameOfProdPart
End If

End If
Next
End Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Identify a CATIA Component from a CATIA Product

(OP)
Thank you very much, I did'nt tought it would be that easy.

RE: Identify a CATIA Component from a CATIA Product


Try to use

sType = TypeName(products1.Item(i))

sType will be "Product", "Part", "Body", "Document", "Hybridbody", ...

Cheers,
Alex


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