Wed, 03/25/2015 - 22:39

Hello,

I was considering ways to use OCC in a direct modelling application. For clarity, I will describe what I mean through an example:

Let's say I create a box using BRepPrimAPI_MakeBox. Now let's say I would like to 'extrude' one of the faces in its normal direction to create a 'longer box'. Instead of using BRepFeat_MakePrism (which uses BRepSweep classes under the hood) to create the new topology, is it possible to modify the geometry of the existing box directly to accomplish the same task?

I have experimented using BRepTools_Modifier and BRepTools_TrsfModification in this vain:

...

TopoDS_Shape result; // this should be the 'extruded' box

TopoDS_Shape originalBox; // the original box is stored here

TopoDS_Face face; // target face is stored here

gp_Dir extrudeVector;

extrudeVector.SetCoord(xpos, ypos, zpos)

gp_Trsf trans = gp_Trsf();

trans.SetTranslation(extrudeVector);

Handle(BRepTools_TrsfModification) shapeModifier = new BRepTools_TrsfModification(trans);

BRepTools_Modifier brepModifier(face, shapeModifier);

result = brepModifier.ModifiedShape(face);// this is only the transformed face. Not the result I am looking for.

...

Perhaps this is possible by selecting the plane in which the face lies, translating the plane along the desired vector, and then somehow rebuilding the topology of the original box. I cannot seem to find a nice OCC interface for these kind of operations, and I suspect that is because such operations are not possible.

The general question is, is it possible to directly modify geometric properties of a model (to include transformations, modifying geometric parameters, etc.) such that the topology is automatically rebuilt to reflect these changes? The ideal solution would even handle cases where new geometry is created during the operation. I am familiar with the BRepBuilderAPI_MakeShape and BRepBuilderAPI_ModifyShape interfaces, but these are not sufficient for solving this problem.

Has anyone here explored this concept?

Kind Regards,

Eric

Thu, 03/26/2015 - 00:30

Hello Eric,

Take a look at the OCAF sample

Thanks