Hello!
I am reading your example step-file wavy-cube.stp
The file has two STYLED_ITEM with name 'color':
#191 = COLOUR_RGB('',0.321568635616,0.341176475329,0.431372551983);
#206 = COLOUR_RGB('',0.745098043297,0.325490203104,0.133333336917);
my code:
STEPCAFControl_Reader Reader;
.....
IFSelect_ReturnStatus stat = Reader.ReadFile(filename.ToCString());
.....
// print all colors
TDF_LabelSequence colors;
_colorTool->GetColors(colors);
for (TDF_LabelSequence::Iterator it_colors(colors); it_colors.More(); it_colors.Next())
{
TDF_Label label = it_colors.Value();
Quantity_ColorRGBA rgba;
_colorTool->GetColor(label, rgba);
Quantity_Color rgb = rgba.GetRGB();
Handle(TDataStd_Name) name;
label.FindAttribute(TDataStd_Name::GetID(), name);
TCollection_ExtendedString str = name->Get();
wprintf(L"%s ==>> RGBA = %.3f, %.3f, %.3f, %.3f\n", str.ToExtString(), rgb.Red(), rgb.Green(), rgb.Blue(), rgba.Alpha());
}
Result:
GRAY37 (#151827FF) ==>> RGBA = 0.084, 0.095, 0.156, 1.000
CHOCOLATE3 (#831604FF) ==>> RGBA = 0.515, 0.087, 0.016, 1.000
I have to questions
1) why names are changed?
2) why values of rgb are changed?
I am reading your example step-file wavy-cube.stp
The file has two STYLED_ITEM with name 'color':
#191 = COLOUR_RGB('',0.321568635616,0.341176475329,0.431372551983);
#206 = COLOUR_RGB('',0.745098043297,0.325490203104,0.133333336917);
my code:
STEPCAFControl_Reader Reader;
.....
IFSelect_ReturnStatus stat = Reader.ReadFile(filename.ToCString());
.....
// print all colors
TDF_LabelSequence colors;
_colorTool->GetColors(colors);
for (TDF_LabelSequence::Iterator it_colors(colors); it_colors.More(); it_colors.Next())
{
TDF_Label label = it_colors.Value();
Quantity_ColorRGBA rgba;
_colorTool->GetColor(label, rgba);
Quantity_Color rgb = rgba.GetRGB();
Handle(TDataStd_Name) name;
label.FindAttribute(TDataStd_Name::GetID(), name);
TCollection_ExtendedString str = name->Get();
wprintf(L"%s ==>> RGBA = %.3f, %.3f, %.3f, %.3f\n", str.ToExtString(), rgb.Red(), rgb.Green(), rgb.Blue(), rgba.Alpha());
}
Result:
GRAY37 (#151827FF) ==>> RGBA = 0.084, 0.095, 0.156, 1.000
CHOCOLATE3 (#831604FF) ==>> RGBA = 0.515, 0.087, 0.016, 1.000
I have to questions
1) why names are changed?
2) why values of rgb are changed?