I'm working on this problem that looks at detecting touching faces between two solids, and replacing them so they are shared between the two solids. In particular, I'm having problems with the following case (a small cylinder inside a larger one, their bottom faces being aligned):
TopoDS_Solid cyl1 = BRepPrimAPI_MakeCylinder(3, 1).Solid();
TopoDS_Solid cyl2 = BRepPrimAPI_MakeCylinder(1, 1).Solid();
cyl1 = cut cyl2 from cyl1
After this step, faces touching each other are identified (F1 the cylindrical face of the small cylinder, and F2 the round face on top of the small cylinder), and BRepTools_ReShape is used to replace F1 and F2 in cyl1 with the corresponding faces in cyl2.
After applying ReShape, the corresponding faces in each solid are checked against each other. For both F1 and F2, the result of IsPartner is TRUE, result of IsSame is TRUE, and result of IsEqual is FALSE. Before applying ReShape, all three were FALSE. However, when saving the compound of the two solids, F1 is saved twice (as if there are two distinct but equal faces that occupy the same location, and thus not shared between the two solids), whereas F2 is saved once (and thus shared between the two solids). Since F1 is not shared, the model cannot be meshed correctly.
Changing the orientation of the faces to correspond to each other and/or applying ShapeFix_Solid does not change the outcome -- there are still too many faces in the BREP file.
How can this happen? Is there anything else I should do before saving the two solids in a BREP file?
Any help is appreciated (I've had this problem for a long time).