From 5c5e84b4bcbcb8f39f3d5b24f9fec101d8d89bcf Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Wed, 26 Aug 2015 15:44:37 +0200 Subject: [PATCH] bcm modification for names --- libsrc/csg/python_csg.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index 58f6034e..275c53e4 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -329,7 +329,12 @@ DLL_HEADER void ExportCSG() { bp::tuple tup = bp::extract (bcmod[i]) (); auto mod_solid = bp::extract> (tup[0]) (); - auto mod_nr = bp::extract (tup[1])(); + int mod_nr = -1; + string * bcname = nullptr; + bp::object val = tup[1]; + if (bp::extract(val).check()) mod_nr = bp::extract (val)(); + if (bp::extract(val).check()) bcname = new string ( bp::extract (val)()); + Array si; mod_solid -> GetSolid() -> GetSurfaceIndices (si); // cout << "change bc on surfaces: " << si << " to " << mod_nr << endl; @@ -337,12 +342,13 @@ DLL_HEADER void ExportCSG() for (int j = 0; j < si.Size(); j++) { CSGeometry::BCModification bcm; - bcm.bcname = NULL; + bcm.bcname = bcname ? new string (*bcname) : nullptr; bcm.tlonr = tlonr; bcm.si = si[j]; bcm.bcnr = mod_nr; self.bcmodifications.Append (bcm); } + delete bcname; } }),