Obtaining the newly exposed surface of a cut.

Hi.

I have two solids, call them A and B. These are nice solids, in fact they're closed single-shell triangular meshes.

I create the object A-B by cutting with BRepAlgoAPI_Cut. A part of the the shell of A-B isn't in A's shell, it's made up of points which are somewhere inside A AND are on the surface of B, therefore they are on the surface of A-B. My question is, how do I access this part of the shell of A-B?

I read in BRepAlgoAPI_BooleanOperation that it calculates something called the "interference" of A and B and I suspect this is relevant but I couldn't understand the underlying data structure for the Interference.

Thanks for any help.

- Aviv

avivh's picture

The features in OpenCascade far exceed the quality of the documentation. Since no comments were made on my earlier post, I must say that they also exceed the quality of the support in the forum. Ah well, considering the library is free, I can't complain.

The following method gives a partial answer to my question:
TopTools_ListOfShape&
BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_Shape& aS)

Given a face Fb from B, Modified(Fb) will return the parts of Fb which were included in the result shape A-B. Since the operation we did was cutting, Modified(Fb) are exactly the parts of Fb which are inside A. This is great news for me because these faces some of the ones I seek.

Unfortunately, there's another type of face which I also need, and isn't included in the Modified set. I'm talking about faces of B which are entirely inside A, and therefore become faces in A-B without any modifications. I was hoping the Generated() method in the same class would return this type of faces. Again, this method is poorly documented, I'm not sure what it does. In fact, it always seems to return empty lists. I looked at the code and it seems that Generated won't return anything for Solid-Solid BOPs, but it will work for Shell-Solid BOPs. I don't know if that's intentional.

I'd be grateful for any help to clear up this matter.

avivh's picture

I also have a fall-back plan to get the faces I metioned in the earlier post. Since these faces are exactly equal to faces in B (they weren't modified!), I can find them by brute force: go over each face in A-B and check if it's identical to some face in B (except that it's reversed). It should work although it isn't efficient or elegant.

Bearloga's picture

It will be efficient if you use the maps with hashing. Have a look at TopExp::MapShapes method and at the description of the class TCollection_IndexedMap.