mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
use history in OCCT - fuse
This commit is contained in:
parent
bd5699d5f1
commit
b9588627f0
@ -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);
|
||||
}
|
||||
|
@ -540,6 +540,7 @@ public:
|
||||
BRepBuilderAPI_MakeFace builder(surf, 1e-8);
|
||||
for (auto w : wires)
|
||||
builder.Add(w);
|
||||
wires.clear();
|
||||
return builder.Face();
|
||||
}
|
||||
|
||||
@ -746,8 +747,24 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user