Mon, 08/31/2020 - 23:43
Hi,
To read and triangulate my STEP files, I use OpenCascade 6.9.x and tried to upgrade to 7.4.0.
However, since my 7.4.0, i can not retrieve the colors of some of my step file shapes anymore. I would usually recursively iterate through my shapes to get the surface colors, but it doesn't work anymore as the aColorTool->GetColor now always returns false. Is use OpenCascade 7.4.0 with a ISO-10303-21 STEP file.
Any idea of any major change since 6.9.x that could cause that ? I feel like the color tool doesn't make the "link" anymore with the shapes... Thank you !
bool CAD_reader::queryColor(const TopoDS_Shape& shape, Quantity_Color& color)
{
color.SetValues(0.5, 0.5, 0.5, Quantity_TOC_RGB);
if (aColorTool->GetColor(shape, XCAFDoc_ColorGen, color))
return true;
else if (aColorTool->GetColor(shape, XCAFDoc_ColorCurv, color))
return true;
else if (aColorTool->GetColor(shape, XCAFDoc_ColorSurf, color))
return true;
return false;
};
Please note that I tried the last CADAssistant to check and the colors show well in it
Tue, 09/01/2020 - 09:59
You do not show what "aColorTool" is. We read STEP colors like this:
Hope it helps,
Benjamin
Tue, 09/01/2020 - 15:12
Thanks for your answer ! Sorry if I didn't say what aColorTool is, it is actually this :
I'm going to try your approach but it seems very different from mine. I'll tell you if it worked !
My approach is that once i have all the root shapes using GetShapes, i just iterate over their children shapes recursively to get the colors with aColorTool. It used to work, but it it broken since 7.x.x ...
You can also note that the colors can be found with the same tool using GetColors, and this piece of code still works to find all the colors (without them being assigned to shapes specifically unfortunately). That's why it's very strange.
Mon, 09/14/2020 - 01:28
Any news on this bug? We've been fighting on it for a few weeks now...
To give it more context, this issue occurs when our STEP File only has a shape as the root, and the faces of this root shape are colored. When our STEP file has subshapes it works pretty fine we can get the colors of these subshapes.
I can still find all the colors of the document with the code above, but there is no way i can get the faces associated with these respective colors...
Does anyone from OpenCascade could tell me what changed since 6.9.1 on XCAF color getting logic?
Mon, 11/09/2020 - 13:53
I don't recall any cardinal changes in XCAF document structure related to colors since OCCT 6.9.1.
So I believe that it remains the same, just some STEP reader bugfix(es) probably corrected previously misplaced color labels in some specific cases.
As XCAFPrs_AISObject displays colors of the model correctly - there is no reason to consider XCAF document being broken / lost colors.
So I would try to prepare a minimal code snippet reproducing the issue detached from application code and STEP file sample to see where the problem in code might appear and suggest an update.