
Tue, 07/16/2024 - 12:03
I have read the STEP file and transferred it into a document. While iterating through the labels and their child labels, I used the following API to determine whether a label is an assembly or a part.
XCAFDoc_ShapeTool::IsAssembly(label)
However, some part labels are being treated as assemblies. Upon further investigation, I found that the child labels inside a part label contain information about materials.
My question is: is there a way to determine whether a label is related to an assembly or a part?
Tue, 07/16/2024 - 12:26
Hello,
part labels itself can't be an assembly. Their refLabel can be assembly and usually it is assembly. Please be caraful when you extracting reference from the shape label.
Unfortunately, I don't fully understand your issue :(
You can implement your own iterating logis, for example : https://github.com/Open-Cascade-SAS/OCCT/blob/76df27830b8229fad7f2046c03...
One of the way is using iterator(current implementation based on pre-collection of the labels into internal maps, please do not modify tree after loading iterator):
Best regards, Dmitrii.
Tue, 07/16/2024 - 14:09
I have created my own classes, Assembly and Part, where I store the labels for each.
While iterating through the document, I first check whether the label is a reference. Then, I use XCAFDoc_ShapeTool::IsAssembly(label) to determine if it is an assembly. If it is an assembly, I iterate through it again.
However, in some cases, labels that I know are parts (verified by their names) are identified as assemblies, which is quite confusing to me.
Tue, 07/16/2024 - 14:38
Labels, that you know that they are parts, cilould you explain? It should be just Manifold solid? Or face/assembly?
In some scenarios OCCT convert compound that should be a simple shape into assembly, probably it can be modified by special parameter. I'm not sure about your case without any samples:)
Best regards, Dmitrii.
Wed, 07/17/2024 - 12:24
Hi Dimitrii,
I am working on project where I need to store information in Assembly part configuration. I have to two classes as
Now I need to fill this classes while traversing through document.
I am considering the Document where all labels are store is like tree structure.
So when I iterate through the assembly, (Child labels),
1) I am expecting label for parts. So cross verify this, I checked the name of labels. (To cross verify load model in CAD assistance and check part name )
Up to this everything is fine and model is loaded properly. but there are no material present in the shape.
To get the material from shape I again have to iterate through sub levels of shape. Then get the material and apply it to shape.
2) When I iterating through the assembly, cross verify the name (part name). some Parts are treated as assembly because of compound shape as you said.
So this is creating confusion for me. That I am not able to distinguish between part and assembly using label only.
Correct me if I am wrong and Thank you for your help.