mesh - vis in py

This commit is contained in:
Joachim Schoeberl 2014-10-09 17:17:11 +00:00
parent f77b4bf60a
commit 34b90d5254
2 changed files with 60 additions and 14 deletions

View File

@ -127,6 +127,7 @@ namespace netgen
void VisualSceneGeometry :: BuildScene (int zoomall) void VisualSceneGeometry :: BuildScene (int zoomall)
{ {
cout << "vs-csg::Build" << endl; cout << "vs-csg::Build" << endl;
VisualScene::BuildScene(zoomall); // setting light ...
Box<3> box; Box<3> box;
int hasp = 0; int hasp = 0;
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++) for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
@ -532,7 +533,7 @@ namespace bp = boost::python;
void ExportCSGVis() void ExportCSGVis()
{ {
std::string nested_name = "csgvis"; std::string nested_name = "csgvis";
if (bp::scope()) if (bp::scope())
nested_name = bp::extract<std::string>(bp::scope().attr("__name__") + ".csgvis"); nested_name = bp::extract<std::string>(bp::scope().attr("__name__") + ".csgvis");

View File

@ -35,21 +35,21 @@ namespace netgen
pointnumberlist = 0; pointnumberlist = 0;
domainsurflist = 0; domainsurflist = 0;
vstimestamp = GetTimeStamp(); vstimestamp = -1; // GetTimeStamp();
selecttimestamp = GetTimeStamp(); selecttimestamp = -1; // GetTimeStamp();
filledtimestamp = GetTimeStamp(); filledtimestamp = -1; // GetTimeStamp();
linetimestamp = GetTimeStamp(); linetimestamp = -1; // GetTimeStamp();
edgetimestamp = GetTimeStamp(); edgetimestamp = -1; // GetTimeStamp();
pointnumbertimestamp = GetTimeStamp(); pointnumbertimestamp = -1; // GetTimeStamp();
tettimestamp = GetTimeStamp(); tettimestamp = -1; // GetTimeStamp();
prismtimestamp = GetTimeStamp(); prismtimestamp = -1; // GetTimeStamp();
hextimestamp = GetTimeStamp(); hextimestamp = -1; // GetTimeStamp();
pyramidtimestamp = GetTimeStamp(); pyramidtimestamp = -1; // GetTimeStamp();
badeltimestamp = GetTimeStamp(); badeltimestamp = -1; // GetTimeStamp();
identifiedtimestamp = GetTimeStamp(); identifiedtimestamp = -1; // GetTimeStamp();
domainsurftimestamp = GetTimeStamp(); domainsurftimestamp = -1; // GetTimeStamp();
selface = -1; selface = -1;
@ -3524,3 +3524,48 @@ namespace netgen
} }
#ifdef NG_PYTHON
#include <boost/python.hpp>
#include <../general/ngpython.hpp>
namespace bp = boost::python;
void ExportMeshVis()
{
using namespace netgen;
ModuleScope myscope("meshvis");
vispar.drawcolorbar = true;
vispar.drawnetgenlogo = true;
vispar.drawcoordinatecross = true;
vispar.drawfilledtrigs = true;
vispar.drawdomainsurf = true;
vispar.drawhexes = true;
vispar.drawtets = true;
vispar.drawprisms = true;
vispar.drawoutline = true;
bp::class_<VisualSceneMesh, shared_ptr<VisualSceneMesh>>
("VisualSceneMesh", bp::no_init)
.def("Draw", &VisualSceneMesh::DrawScene)
;
bp::def("VS", FunctionPointer
([](shared_ptr<Mesh> mesh)
{
auto vs = make_shared<VisualSceneMesh>();
vs->SetMesh(mesh);
return vs;
}));
bp::def("MouseMove", FunctionPointer
([](VisualSceneMesh &vsmesh, int oldx, int oldy, int newx, int
newy, char mode)
{
vsmesh.MouseMove(oldx, oldy, newx, newy, mode);
}));
}
BOOST_PYTHON_MODULE(libvisual)
{
ExportMeshVis();
}
#endif