I'm trying to build some 3d models for export to a 3D meshing program and I'm having some issues with the modeling of adjacent volumes.
Here is the problem. I'm looking at a very simple example, imagine a cube A of size (1,1,1) sitting on top of cube B of size (3,3,3), aligned vertically. I want to be able to mesh each one separately (they could be of different materials), but have a consistent mesh. The bottom side of cube A touches the top side of cube B; the size of the overlap being a 1x1 square. Now, the issue in trying to mesh this structure (build as a TopoDS_CompSolid or TopoDS_Compound) is that the top side of cube B and bottom side of cube A are meshed separately, which causes problems with non-aligned points on that face (hence the mesh is not consistent).
What I want would be an operation such that, given the two cubes laying on top of each other, extracts this common rectangle and rebuilds the two shapes (cubes) in such a way that the common face is part of both cube A and cube B. This way, in the mesher, the common face is meshed exactly once, and the 3d mesh could be build from there.
I've tried to use BRepAlgoAPI_Fuse and BRepBuilderAPI_Sewing, but the first one creates a single shape out of cube A and B (I still want to mesh each one separately, since in my model they could be of different materials) and the second one seems to output the empty shell of the two cubes, so only 2d meshing works.