use history in OCCT - fuse

This commit is contained in:
Joachim Schoeberl 2021-08-30 22:00:58 +02:00
parent bd5699d5f1
commit b9588627f0
2 changed files with 20 additions and 3 deletions

View File

@ -312,7 +312,7 @@ namespace netgen
{
// CSGeometry * geo = new CSGeometry;
char key[100], name[100], classname[100], sname[100];
char key[100], name[100], classname[100], sname[150];
int ncoeff, i, j;
NgArray<double> coeff;
@ -622,7 +622,7 @@ namespace netgen
{
static int cntsurfs = 0;
cntsurfs++;
char name[15];
char name[20];
sprintf (name, "nnsurf%d", cntsurfs);
AddSurface (name, surf);
}

View File

@ -540,6 +540,7 @@ public:
BRepBuilderAPI_MakeFace builder(surf, 1e-8);
for (auto w : wires)
builder.Add(w);
wires.clear();
return builder.Face();
}
@ -746,9 +747,25 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
{ return shape.Located(loc); })
.def("__add__", [] (const TopoDS_Shape & shape1, const TopoDS_Shape & shape2) {
auto fused = BRepAlgoAPI_Fuse(shape1, shape2).Shape();
// auto fused = BRepAlgoAPI_Fuse(shape1, shape2).Shape();
// return fused;
BRepAlgoAPI_Fuse builder(shape1, shape2);
#ifdef OCC_HAVE_HISTORY
Handle(BRepTools_History) history = builder.History ();
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE })
for (auto & s : { shape1, shape2 })
for (TopExp_Explorer e(s, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
}
#endif
auto fused = builder.Shape();
// make one face when fusing in 2D
// from https://gitlab.onelab.info/gmsh/gmsh/-/issues/627
int cntsolid = 0;