mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
Don't copy occ shape in OCCGeometry ctor by default
This commit is contained in:
parent
0da6aeb94f
commit
239cdf694f
@ -52,17 +52,30 @@
|
|||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
void LoadOCCInto(OCCGeometry* occgeo, const char* filename);
|
void LoadOCCInto(OCCGeometry* occgeo, const char* filename);
|
||||||
|
void PrintContents (OCCGeometry * geom);
|
||||||
|
|
||||||
std::map<Handle(TopoDS_TShape), ShapeProperties> OCCGeometry::global_shape_properties;
|
std::map<Handle(TopoDS_TShape), ShapeProperties> OCCGeometry::global_shape_properties;
|
||||||
std::map<Handle(TopoDS_TShape), std::vector<OCCIdentification>> OCCGeometry::identifications;
|
std::map<Handle(TopoDS_TShape), std::vector<OCCIdentification>> OCCGeometry::identifications;
|
||||||
|
|
||||||
OCCGeometry::OCCGeometry(const TopoDS_Shape& _shape, int aoccdim)
|
OCCGeometry::OCCGeometry(const TopoDS_Shape& _shape, int aoccdim, bool copy)
|
||||||
{
|
{
|
||||||
auto filename = GetTempFilename();
|
if(copy)
|
||||||
step_utils::WriteSTEP(_shape, filename.c_str());
|
{
|
||||||
LoadOCCInto(this, filename.c_str());
|
auto filename = GetTempFilename();
|
||||||
occdim = aoccdim;
|
step_utils::WriteSTEP(_shape, filename.c_str());
|
||||||
std::remove(filename.c_str());
|
LoadOCCInto(this, filename.c_str());
|
||||||
|
occdim = aoccdim;
|
||||||
|
std::remove(filename.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shape = _shape;
|
||||||
|
changed = 1;
|
||||||
|
occdim = aoccdim;
|
||||||
|
BuildFMap();
|
||||||
|
CalcBoundingBox();
|
||||||
|
PrintContents (this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * aReader)
|
string STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * aReader)
|
||||||
|
@ -298,7 +298,7 @@ namespace netgen
|
|||||||
vmap.Clear();
|
vmap.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
OCCGeometry(const TopoDS_Shape& _shape, int aoccdim = 3);
|
OCCGeometry(const TopoDS_Shape& _shape, int aoccdim = 3, bool copy = false);
|
||||||
|
|
||||||
Mesh::GEOM_TYPE GetGeomType() const override
|
Mesh::GEOM_TYPE GetGeomType() const override
|
||||||
{ return Mesh::GEOM_OCC; }
|
{ return Mesh::GEOM_OCC; }
|
||||||
|
@ -126,7 +126,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
|
|||||||
.def(py::init<const TopoDS_Shape&>(), py::arg("shape"),
|
.def(py::init<const TopoDS_Shape&>(), py::arg("shape"),
|
||||||
"Create Netgen OCCGeometry from existing TopoDS_Shape")
|
"Create Netgen OCCGeometry from existing TopoDS_Shape")
|
||||||
*/
|
*/
|
||||||
.def(py::init([] (const TopoDS_Shape& shape, int occdim)
|
.def(py::init([] (const TopoDS_Shape& shape, int occdim, bool copy)
|
||||||
{
|
{
|
||||||
auto geo = make_shared<OCCGeometry> (shape, occdim);
|
auto geo = make_shared<OCCGeometry> (shape, occdim);
|
||||||
// ng_geometry = geo;
|
// ng_geometry = geo;
|
||||||
@ -134,7 +134,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
|
|||||||
// geo->BuildFMap();
|
// geo->BuildFMap();
|
||||||
// geo->CalcBoundingBox();
|
// geo->CalcBoundingBox();
|
||||||
return geo;
|
return geo;
|
||||||
}), py::arg("shape"), py::arg("dim")=3,
|
}), py::arg("shape"), py::arg("dim")=3, py::arg("copy")=false,
|
||||||
"Create Netgen OCCGeometry from existing TopoDS_Shape")
|
"Create Netgen OCCGeometry from existing TopoDS_Shape")
|
||||||
|
|
||||||
.def(py::init([] (const std::vector<TopoDS_Shape> shapes)
|
.def(py::init([] (const std::vector<TopoDS_Shape> shapes)
|
||||||
|
Loading…
Reference in New Issue
Block a user