Doubts with labels and attributes associate to them.

Hi,

I'm having some issues trying to get all attributes associated to a specific label.
Scenario:
Right now I'm focused on getting Materials, Colors and Names from a label. As I can see all of them are attributes:
https://dev.opencascade.org/doc/refman/html/class_t_d_f___attribute.html

My main idea was to iterate all over the attributes TDF_AttributeIterator attrIter(label); but the only attributes that I'm finding are the ones related to TDataStd_TreeNode, TDataStd_Name... but no attributes related to colors.
If I use the GetColor() from XCAFDoc_ColorTool with the same label I get colors...

What I'm not understanding about attributes? Shouldn't I get colors with the AttributeIterator?

Best regards.

Dmitrii Pasukhin's picture

Hello,

Color is not an attirbute, it is a reference on ColorLabel. So, when you call GetColor() you get reference ColorLabel and extract Color from ColorLabel, that exist on 0:1:2 label

 

Best regards, Dmitrii.

 

Attachments: 
Lorenzo Napl's picture

In that case seeing the previous link that I attached on the post, XCAFDoc_ColorTool could be an attribute and could be used to extract colors?
By the way, the screenshots that you attached come from a specific tool? Seems very useful to investigate the tree structure of a CAD...

Best regards!

Dmitrii Pasukhin's picture

Color is an attribute. But attribute attached to the ColorLabel.

It is QT application named "Inspector", part of OCCT repo. You can build it by youreself, or dowload full installation from Download - Open CASCADE Technology

Documentation: Inspector - Open CASCADE Technology Documentation

Best regards, Dmitrii.

Dmitrii Pasukhin's picture

If you working on copying labels. Please take a look into XCafDoc_Editor::CopyLabels (occt 7.7.0 and above). It helps to copy ShLabels with attached attributes.

Best regards, Dmitrii.