Using BRepAlgoAPI_Cut to subtract from a shell

I need to create a hole in a shell and after some google searches I found many people suggested using the boolean subtraction operation "Cut". So I did a cut of a solid from a relatively simple shell to do this, but instead of it removing the intersection, it returned only the intersection. What am I doing wrong?

Here is basically how I called it:

TopoDS_Shape shell = ...;
TopoDS_Shape solid = ...;

TopoDS_Shape cut = BRepAlgoAPI_Cut(shell, solid);

Attached is an infographic showing you exactly what happened.

Attachments: 
Kevin Malachowski's picture

Never mind. Turn out if I use BRepAlgoAPI_Common it works exactly as I want it to... even though the names seem completely backwards, at least in my opinion.

Kevin Malachowski's picture

Another correction: The reason my code was acting as the opposite as I previously expected was because I was careless in the direction of adding points to my solid. For anyone who doesn't know, it is important to notice the direction of the cross-vector of a plane. Clockwise points means the vector points out, counterclockwise means it points in. These are important to notice when using the boolean operations,

jelle's picture

Thanks Kevin, that's meaningful to share here...

Sharad Verma's picture

This is useful

Thanks.. :)

Umesh Worlikar's picture

Useful indeed!

Thanks.