From 9e14f2ceb85a8e53470fc2345910bcdc0b0deff6 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Sun, 6 Nov 2016 18:25:38 +0100 Subject: [PATCH] pyb11 fixes --- libsrc/csg/python_csg.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index 8fc33039..9cd9390d 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -254,7 +254,7 @@ DLL_HEADER void ExportCSG(py::module &m) })) ; - bp::class_,shared_ptr>> ("SplineCurve3d") + py::class_,shared_ptr>> (m,"SplineCurve3d") .def ("AddPoint", FunctionPointer ([] (SplineGeometry<3> & self, double x, double y, double z) { @@ -273,16 +273,15 @@ DLL_HEADER void ExportCSG(py::module &m) })) ; - bp::class_,boost::noncopyable> ("SplineSurface", - "A surface for co dim 2 integrals on the splines", bp::no_init) - .def("__init__", bp::make_constructor (FunctionPointer - ([](const shared_ptr base, bp::list cuts) + py::class_> (m, "SplineSurface", + "A surface for co dim 2 integrals on the splines") + .def("__init__", FunctionPointer ([](const shared_ptr base, py::list cuts) { auto primitive = dynamic_cast (base->GetSolid()->GetPrimitive()); auto acuts = new Array(); - for(int i = 0; i> sps(cuts[i]); + py::extract> sps(cuts[i]); if(!sps.check()) throw NgException("Cut must be SurfacePrimitive in constructor of SplineSurface!"); auto sp = dynamic_cast(sps()->GetSolid()->GetPrimitive()); @@ -294,21 +293,21 @@ DLL_HEADER void ExportCSG(py::module &m) if(!primitive) throw NgException("Base is not a SurfacePrimitive in constructor of SplineSurface!"); return make_shared(primitive,acuts); - }),bp::default_call_policies(),(bp::arg("base"), bp::arg("cuts")=bp::list()))) + }),(py::arg("base"), py::arg("cuts")=py::list())) .def("AddPoint", FunctionPointer ([] (SplineSurface & self, double x, double y, double z, bool hpref) { self.AppendPoint(Point<3>(x,y,z),hpref); return self.GetNP()-1; }), - (bp::arg("self"),bp::arg("x"),bp::arg("y"),bp::arg("z"),bp::arg("hpref")=false)) + py::arg("x"),py::arg("y"),py::arg("z"),py::arg("hpref")=false) .def("AddSegment", FunctionPointer ([] (SplineSurface & self, int i1, int i2, string bcname, double maxh) { auto str = new string(bcname); self.AppendSegment(new LineSeg<3>(self.GetPoint(i1),self.GetPoint(i2)),str,maxh); }), - (bp::arg("self"),bp::arg("pnt1"),bp::arg("pnt2"),bp::arg("bcname")="default", bp::arg("maxh")=-1.)) + py::arg("pnt1"),py::arg("pnt2"),py::arg("bcname")="default", py::arg("maxh")=-1.) ; py::class_> (m, "Solid") @@ -496,7 +495,7 @@ DLL_HEADER void ExportCSG(py::module &m) for(auto p : surf->GetPoints()) self.AddUserPoint(p); }), - (bp::arg("self"), bp::arg("SplineSurface"))) + py::arg("SplineSurface")) .def("CloseSurfaces", FunctionPointer ([] (CSGeometry & self, shared_ptr s1, shared_ptr s2, py::list aslices )