From df327f8665bc8117ec2e787c408cd67d60ec67c2 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Thu, 11 Dec 2014 09:04:49 +0000 Subject: [PATCH] bcmodifiers from python --- libsrc/csg/python_csg.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index 0f929662..6f9e1bcc 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -288,7 +288,7 @@ void ExportCSG() self.Save (filename); })) .def("Add", FunctionPointer - ([] (CSGeometry & self, shared_ptr solid) + ([] (CSGeometry & self, shared_ptr solid, bp::list bcmod) { solid->AddSurfaces (self); solid->GiveUpOwner(); @@ -296,7 +296,30 @@ void ExportCSG() self.GetTopLevelObject(tlonr) -> SetMaterial(solid->GetMaterial()); self.GetTopLevelObject(tlonr) -> SetRGB(solid->GetRed(),solid->GetGreen(),solid->GetBlue()); self.GetTopLevelObject(tlonr)->SetTransparent(solid->IsTransparent()); - })) + + // bcmod is list of tuples ( solid, bcnr ) + for (int i = 0; i < bp::len(bcmod); i++) + { + bp::tuple tup = bp::extract (bcmod[i]) (); + auto mod_solid = bp::extract> (tup[0]) (); + auto mod_nr = bp::extract (tup[1])(); + Array si; + mod_solid -> GetSolid() -> GetSurfaceIndices (si); + cout << "change bc on surfaces: " << si << " to " << mod_nr << endl; + + for (int j = 0; j < si.Size(); j++) + { + CSGeometry::BCModification bcm; + bcm.bcname = NULL; + bcm.tlonr = tlonr; + bcm.si = si[j]; + self.bcmodifications.Append (bcm); + } + } + + }), + (bp::arg("self"), bp::arg("solid"), bp::arg("bcmod")=bp::list()) + ) .def("CloseSurfaces", FunctionPointer ([] (CSGeometry & self, shared_ptr s1, shared_ptr s2, int reflevels)