How to color STEP model by its original color?

Dear all,
I load a STEP model by STEPControl_Reader, and display it in my context. But I found that its color is different from my model in Solidworks. In Solidworks it's colorful, however in OCC it's completely yellow....... Could you tell me how to make my STEP model look like the one in Solidworks?
Thanks in advance!!

Kirill Gavrilov's picture

STEPControl_Reader produces a TopoDS_Shape, which is a topological shape defining geometry, but doesn't have any names, colors, materials or any other attributes that could be assigned to model. You'll need to use STEPCAFControl_Reader to translate STEP into XCAF document preserving this kind of information. It could be then displayed colorful using XCAFPrs_AISObject in case if you are using OCCT 3D Viewer.

华裔 程's picture

Sorry Kirill, I just start to learn how to use OCC and I don't understand really well about how to use STEPCAFControl_Reader and XCAFPrs_AISObject to archieve my goal.
Could you please attach a little simple piece of code to help me understand better? I would appreciate it very much. TAT.

sOup x's picture

Watch this tutorial by Quaoar. 

华裔 程's picture

Thanks~ I've watched this tutorial. But Quaoar only show how to set the TopoDS_Shape model's color. And I need to get the color of the step model I read then put it on my XDE model...... :(