BRepAlgoAPI_Cut Problem

Hi all,

I have a quader where I cut out buildings - both are solids; I use BRepAlgoAPI_Cut. Most of the time it works, but sometimes when performing BRepAlgoAPI_Cut(Shape1, Shape2) I get as result a shape representing the part of Shape2 that is inside of Shape1. Does anyone know why that is happening?

Thanks a lot!

Dennis

zaigaochen's picture

i have almost problem.did you solve the problem??

Volker's picture

Check the Volume of your solids. I assume, one is negative, ie the orientation is wrong (your exterior is "in" the solid).

static double GetVolume(TopoDS_Shape shape)
// http://www.opencascade.org/org/forum/thread_15471/
{
GProp_GProps System;
BRepGProp::VolumeProperties(shape, System);
return System.Mass();
}

if (GetVolume(Shape1) < 0.0) Shape1.Reverse();
if (GetVolume(Shape2) < 0.0) Shape2.Reverse();
newShape = BRepAlgoAPI_Cut(Shape1, Shape2);