From 92dbe6aeb0aa360b83c56c32c082175bd754f742 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sat, 18 Oct 2014 14:41:20 +0000 Subject: [PATCH] maxh in python - csg --- libsrc/csg/python_csg.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index b9841a10..386b5980 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -16,6 +16,7 @@ class SPSolid shared_ptr s1, s2; Solid * solid; int bc = -1; + double maxh = -1; string material; bool owner; public: @@ -89,6 +90,24 @@ public: } } } + + void SetMaxH(int amaxh) + { + if (maxh == -1) + { + maxh = amaxh; + if (s1) s1 -> SetMaxH(maxh); + if (s2) s2 -> SetMaxH(maxh); + if (op == TERM) + { + Primitive * prim = solid -> GetPrimitive(); + for (int i = 0; i < prim->GetNSurfaces(); i++) + prim->GetSurface(i).SetMaxH (maxh); + } + } + } + + private: optyp op; }; @@ -148,6 +167,8 @@ void ExportCSG() .def ("bc", FunctionPointer([](shared_ptr & self, int nr) -> shared_ptr { self->SetBC(nr); return self; })) + .def ("maxh", FunctionPointer([](shared_ptr & self, double maxh) -> shared_ptr + { self->SetMaxH(maxh); return self; })) .def ("mat", FunctionPointer([](shared_ptr & self, string mat) -> shared_ptr { self->SetMaterial(mat); return self; })) .def ("mat", &SPSolid::GetMaterial)