Saturday, June 13, 2009

Cut started working


Succeeded to make the Cut work. Now it cuts through all, will add in the property grid also the option to Cut with a depth. The screenshot contains an Extrusion on an ellipse and with a Cut on them.

Will continue fixing bugs at Extrude, improving the magic points and fixing Cut.

The Cut through all is made like the following:

// Make a prism that will cut through all objects
OCBRepPrimAPI_MakePrism cutPrism = new OCBRepPrimAPI_MakePrism(cuttingShape, vec, false, true);
OCTopoDS_Shape cutPrismShape = cutPrism.Shape();

// On all shapes from the scene apply Cut
OCBRepAlgoAPI_Cut cut = new OCBRepAlgoAPI_Cut(topoShape, cutPrismShape);
OCTopoDS_Shape shapeCut = cut.Shape();
if (!shapeCut.IsNull())
{
// Add the result at the compund shape
shapeBuilder.Add(resShape, shapeCut);
}

The code to make the result shape like a compund:
OCTopoDS_Compound compoundShape = new OCTopoDS_Compound();
OCBRep_Builder shapeBuilder = new OCBRep_Builder();
shapeBuilder.MakeCompound(compoundShape);
OCTopoDS_Shape resShape = compoundShape as OCTopoDS_Shape;

// Add each shape cut at the compound shape
shapeBuilder.Add(resShape, shapeCut);

No comments: