TopoDS_Compound / TopoDS_Solid

Hi

I have created some SOLID primitives using the
BRepPrimAPI* classes.

I export this using the IGES classes
and import the same IGES file using the IGES classes.

When I check the 'shapeType' of this imported
BREP/TopoDS_Shape, it identifies it as 'TopoDS_Compound'
and not as 'TopoDS_Solid'.
The 'TopoDS_Compound' data type can be used for
grouping any of the TopoDS_Shape sub-types.

I want OCC to identify the imported OCC primitive solids as 'TopoDS_Solid' type.
Is it possible ???

thanks and regards

- pg

Rob Bachrach's picture

If you look in the IGES FORMAT User's Guide, you will see that the IGES reader only creates a TopoDS_Solid from an IGES 186:manifold solid entity. Likewise, the writer will only create 186 entities when brep mode is active. Brep mode is inactive by default. So, in your writer code, you would need:

Interface_Static::SetIVal("write.iges.brep.mode", 1);

PG's picture

Hi
Thanks for suggestions.
Actually before I export to IGES, I checked the ShapeType after
creating cone/cylinder primitive .. it is of type TopoDS_Compound
and when I do boolean operation on this 2 primitives, ....
it is of type TopoDS_Solid.

Why is this so ?

Rob Bachrach's picture

I may misunderstand your question...

If you are creating 2 primitives, each individual primitive is a solid, but the pair can only be grouped in a compound or composite solid. If you iterate through the contents of the compound, you should see the 2 solids. After all, 2 separate primitives do not make a single solid. When you perform a boolean operation (assuming the primitives overlap), you are combining them into a single, new solid

PG's picture

Hello Bob,
I know each individual primitive is a solid, but OCC's
function query on the individual primitive ( TopoDS_Shape)
using the 'ShapeType', says it is of type 'TopoDS_Compound'.
(see the code below)
BRepPrimAPI_MakeCylinder cylinder(axis, radius, height);
cout << "shapeType is " << cylinder.Shape().ShapeType()"\n";

And also when 2 primitives are booleaned, it is of of ShapeType 'TopoDS_Solid'.

Which is correct ?

regards
- PG

Rob Bachrach's picture

I don't know what you mean. I created a console application with 2 lines of code:

BRepPrimAPI_MakeCylinder cylinder(gp::XOY(), 1.0, 3.0);
cout << "shapeType is " << cylinder.Shape().ShapeType() << endl;

The code outputs "shapeType is 2". According to TopAbs_ShapeEnum, 2 is a SOLID. Are you sure you just don't have your values confused?