Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How to differentiate the product and Component object fro assembly product list. On CATIA V5 , using c#.net API

Yuvraj026

Mechanical
Dec 26, 2023
1
Hi,

I able to exact product list from CATIA V5 CATproduct file. But I want to separate the product and components object,

If anyone have idea about that, please help me the solution.

Thanks
 
This is not the right forum for your question.

Now don't be so lazy; take the time to find an appropriate forum here for your question, re-post it there, and delete this one.
 
Product differs from component by the way it's stored: one has it's own separate CATProduct document, the other one resides within a document that contains it.

So what you want to do is to get to that CATProduct and check if it's root object is the one you've started from.

Code:
Function IsComponent(prd)
  Dim doc: Set doc = prd.ReferenceProduct.Parent
  IsComponent = doc.Product.PartNumber <> prd.PartNumber
End Function
 
Product differs from component by the way it's stored: one has it's own separate CATProduct document, the other one resides within a document that contains it.

So what you want to do is to get to that CATProduct and check if it's root object is the one you've started from.

Code:
Function IsComponent(prd)
  Dim doc: Set doc = prd.ReferenceProduct.Parent
  IsComponent = doc.Product.PartNumber <> prd.PartNumber
End Function
Hello Cthulhu. Maybe you know what is my problem. In product I'm trying to copy few publicated bodies from same parts and paste to another part. But you know if the parts are same it only takes first parts bodies. I'm working on vb.net. Could you give me a clue?

For example there is part_b part_b.1 part_b.3 ...... I'm taking bodies from all this parts. It works manually. But in code side it only take first parts body. It only shows "part_b!" So now I'm trying with instance names but didn't figure it out yet.

If you can share a mail I can send my whole code and project as well. I miss COE Forum but you know...


Snipaste_2025-02-15_17-47-13.jpg
 
Last edited:
Hello Cthulhu. Maybe you know what is my problem. In product I'm trying to copy few publicated bodies from same parts and paste to another part. But you know if the parts are same it only takes first parts bodies. I'm working on vb.net. Could you give me a clue?

For example there is part_b part_b.1 part_b.3 ...... I'm taking bodies from all this parts. It works manually. But in code side it only take first parts body. It only shows "part_b!" So now I'm trying with instance names but didn't figure it out yet.

If you can share a mail I can send my whole code and project as well. I miss COE Forum but you know...


View attachment 4956
Hi.

Your question is off the topic, you should start a new thread and post your copy-paste code there.
 

Part and Inventory Search

Sponsor