I am using to compare shapes as they come from different sources and IsEqual cannot be used. For some faces common returns empty compound. Here is a code to reproduce, as well as the brep file of the shape:
BRep_Builder reader1, reader2; TopoDS_Shape face1, face2; BRepTools::Read(face1, "D:/test/faulty_face.brep", reader1); BRepTools::Read(face2, "D:/test/faulty_face.brep", reader2); BRepAlgoAPI_Common common_builder; TopTools_ListOfShape s1_list, s2_list; s1_list.Append(face1); s2_list.Append(face2); common_builder.SetArguments(s1_list); common_builder.SetTools(s2_list); common_builder.Build(); common_builder.DumpWarnings(std::cout); common_builder.DumpErrors(std::cout); if (common_builder.Shape().IsNull()) std::cout << "Shape is null!" << std::endl; ShapeAlgorithms::writeBrepFile(common_builder.Shape(), "D:/test/compared.brep");
As a result, no warnings or errors are dumped to cout, shape is not null, and the compared.brep is an empty compound. So, what is causing the problem? Is this a bug in algorithm? Or is the shape wrong? What could be the workaround?