Display color on V3d_Viewer

Sorry for posting unneccessary things on this forum.
i found the code i need in OCC's sample code.
as you know, different parts of STEP AP214 have different colors. According to the OCC's sample(CImportExport.proj) it doesn't display the color on v3d_viewer. It just display the framework.
which part of CimportExport I should look at to display the color also?

helloha's picture

we can add the color but it's not what I want. are there any ways to retreieve the original color of STEP and get it displayed on V3d_viewer?

helloha's picture

by using STEPControlReader, topods_shape result = new reader.oneshape() returns the shape recognized by OCC. but the color of step 214 are cut off or get lost and didn't get displayed on V3d_viewer accordign to the sample (CImportExport)
I already looked at the XDE, i can read and write to XDE from STEP but is there anyway to get display XDE on V3d_Viewer so that i can take the snapshot of STEP as image file.
thanks

Patrik Mueller's picture

Hi,

if you want to work with XDE take a look at the XCAFPrs_AISObject for displaying shapes...

Greets,

Patrik

helloha's picture

TDF_Label label = Lab_Shapes.Value(i);
TopoDS_Shape cshape = Assembly->GetShape(label);
if(one_Colors->GetColor(cshape,XCAFDoc_ColorSurf,one_Color))
{
cout<Display(aAISShape);"

How to connect XCAFOrs_AISObject with AIS_InteractiveContext to display it there?
thx a lot

Patrik Mueller's picture

Hi,

first you have to add an Handle_TPrsStd_AISViewer to your viewer:

Handle_TPrsStd_AISViewer PrsAISViewer = TPrsStd_AISViewer::New(...);

for adding a shape you have to do something like this:

Handle_XCAFPrs_AISObject actObject = new XCAFPrs_AISObject(result);

I hope I haven't forgot something - I've written this out of my head.

I'm not online for the next 2 weeks - you have to try it by yourself.

Good luck,

Patrik

helloha's picture

thx i will try it. i'm wondering is there anyways to run the OCC code on visual studio 2005?if i include or #include
#include
#include
#include
#include
#include
#include
#include
...
i got the following error but if i run it on Visual Studio 6.0, error are gone.
but i need it to be run on 2005.
thanks
winthan