How to render coloured image from AP214 STP file

I have a STEP file downloaded from internet (attached).
This file when viewed in something like Cadfaster Quickstep shows color and material as I would expect, because its a model of an electronic component with body, pins, etc.

But when we load this into our viewer derived from OCC viewer code, no color is shown on our picture. I know there is color info in the STEP file, just can't get my head round what is needed to access or extract it and pass it across to the display.

We are using the following elements/functions to do this....

- use STEPControl_Reader to read the STEP file
- then this code to grab the contents
Standard_Integer nbs = aReader.NbShapes();
if (nbs!=0)
{
ShapeSequence = new TopTools_HSequenceOfShape();
Standard_Integer i;
for (i=1; i {
TopoDS_Shape Shape=aReader.Shape(i);
ShapeSequence->Append(Shape);
}
}

- then AISContext stuff etc to draw the shape(s).

Not sure what else you would need to know, but I know our OCC viewer code used the toolkit viewer code as a starting point and we wouldn't have diverged too far from that.

Yours in hope!
David.

Attachments: 
Roman Lygin's picture

Hi David,
You will need to use XDE (eXtended Data Exchange). See XDE User's Guide for details.
Check out how CAD Exchanger (http://www.cadexchanger.com) would display your models.

Roman

Forum supervisor's picture

Hello David,

You may retrieve colors from a STEP and visualize the model with colors using XDE functionality available in Open CASCADE Technology.
In Draw Test Harness, you may try the following sequence of commands that illustrates the use of XDE:

pload DATAEXCHANGE
ReadStep D1 d:/2520-6002_step.stp
XShow D1
vfit
# Then click in the viewer and press 'S' to activate shading mode

We also have an Advanced XDE Sample that features a nice GUI and additional functions - see the snapshot attached.
For more information about Advanced Samples please consult the page at http://www.opencascade.org/support/products/advsamples/ .

Best regards,
Forum supervisor

Attachments: 
pulsonix's picture

Hi guys,

Thanks for the quick response, we rather guessed that more work would be required to achieve coloured results. We'll probably have to push that thought to one side for now, but at least we know where to start looking when we want to give it a go.

David