Reducing model in STEP file

Hello,
Hi, I'm a new OpenCascade user. I want to read a 3d model from a STEP AP214 file, do some reduction on the shapes included (removing small faces, removing internal wires, etc.) and save the model to another STEP file. Up to now I'm able to do the reduction work on a shape and get a new reduced shape. How can I manage to replace the existing shapes by the new ones without loss of material, color and position information?

Thanks in advance!
Dieter

Rob Bachrach's picture

My guess is that you would want to use the STEPCAFControl_Writer and STEPCAFControl_Reader to read and write your files. Then, in theory, you could access the shapes in the document, reduce them, and replace them while keeping all the other document settings on the labels.

Rob

dieterdw's picture

Hello Bob,

you are right, I'm using the STEPCAFControl_Reader and STEPCAFControl_Writer. Here is a snip of code I'm using to replace the origiinal shape:

...
label = free_label_shapes.Value(i);
shape = assembly->GetShape(label);

reducedShape = removeInternalWires(shape, minArea); // reduction is done here
assembly->SetShape(label, workShape);
...

When viewing the resulting model, I cannot see any difference to the original model, i. e. there result of the reduction is not visible.

When using
assembly->AddShape(workShape, Standard_True);
instead of
assembly->SetShape(label, workShape);
the shape has been reduced but the position and the color of the shape got lost.

lqw1001's picture

I am also doing that,and I get a reduced shape having no volume. Do you have notice that?