mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
new Python function SetGeometryObject to allow visualization of Python-generated geometries in Netgen GUI
This commit is contained in:
parent
ecb7dd5dae
commit
50650d91f9
@ -485,6 +485,12 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
extern VisualScene *vs;
|
||||
extern shared_ptr<Mesh> mesh;
|
||||
extern shared_ptr<NetgenGeometry> ng_geometry;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NG_PYTHON
|
||||
@ -521,6 +527,21 @@ DLL_HEADER void ExportCSGVis()
|
||||
{
|
||||
vsgeom.MouseMove(oldx, oldy, newx, newy, mode);
|
||||
}));
|
||||
bp::def("SetGeometryObject", FunctionPointer
|
||||
([](shared_ptr<CSGeometry> geo)
|
||||
{
|
||||
|
||||
geo->FindIdenticSurfaces(1e-6);
|
||||
geo->CalcTriangleApproximation(0.01, 20);
|
||||
ng_geometry = geo;
|
||||
mesh.reset();
|
||||
auto avs = new VisualSceneGeometry();
|
||||
|
||||
avs->SetGeometry(geo.get());
|
||||
vs = avs;
|
||||
vs->SetBackGroundColor(1);
|
||||
|
||||
}));
|
||||
}
|
||||
BOOST_PYTHON_MODULE(libcsgvis)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user