The way XCAFDoc_ColorTool works has changed
I upgraded my pyocc from 7.7.0 to 7.7.2 I have put the following code
doc_str = TCollection_ExtendedString("doc")
doc = TDocStd_Document(doc_str)
shape_tool = XCAFDoc_DocumentTool_ShapeTool(doc.Main())
color_tool = XCAFDoc_DocumentTool_ColorTool(doc.Main())
replace with
doc = TDocStd_Document("doc")
shape_tool = XCAFDoc_DocumentTool.ShapeTool(doc.Main())
color_tool = XCAFDoc_DocumentTool.ColorTool(doc.Main())
The method color_tool.GetInstanceColor(shape, 0, c) works fine but color_tool.GetColor(label, 0, c) doesn't, what is the reason for this?
I am attaching the code that works fine in pyocc 7.7.0, it does not work in pyocc 7.7.2.
readStepWithColor.txt
It seems like you can get the color with XCAFDoc_ColorTool.GetColor(), instead of color_tool.GetColor().
@tpaviot is this intended behaviour?
It seems like you can get the color with XCAFDoc_ColorTool.GetColor(), instead of color_tool.GetColor().
@tpaviot is this intended behaviour?
The
color_tool I'm using is defined like this. I don't think I can create an instance of XCAFDoc_ColorTool without XCAFDoc_DocumentTool.
It seems like you can get the color with XCAFDoc_ColorTool.GetColor(), instead of color_tool.GetColor(). @tpaviot is this intended behaviour?
The
color_toolI'm using is defined like this. I don't think I can create an instance of XCAFDoc_ColorTool without XCAFDoc_DocumentTool.
You do not have to create an instance. Just call the function.
daniel1v
Thank you very much, dear daniel1v. The method you provided does work. In the pyocc source code, the XCAFDoc_ColorTool.GetColor method does not use the @staticmethod decorator, but calling it directly is effective. Following your advice, the code is now running correctly.
daniel1v
Thank you very much, dear daniel1v. The method you provided does work. In the pyocc source code, the XCAFDoc_ColorTool.GetColor method does not use the @staticmethod decorator, but calling it directly is effective. Following your advice, the code is now running correctly.
Yeah, that confused me too.
The