diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index 17458b90..11aae246 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -212,7 +212,7 @@ DLL_HEADER void ExportCSG(py::module &m) py::class_> (m, "SplineSurface", "A surface for co dim 2 integrals on the splines") - .def("__init__", FunctionPointer ([](SplineSurface* instance, shared_ptr base, py::list cuts) + .def(py::init([](shared_ptr base, py::list cuts) { auto primitive = dynamic_cast (base->GetSolid()->GetPrimitive()); auto acuts = make_shared>>(); @@ -225,12 +225,11 @@ DLL_HEADER void ExportCSG(py::module &m) if(sp) acuts->Append(shared_ptr(sp)); else - throw NgException("Cut must be SurfacePrimitive in constructor of SplineSurface!"); + throw Exception("Cut must be SurfacePrimitive in constructor of SplineSurface!"); } if(!primitive) - throw NgException("Base is not a SurfacePrimitive in constructor of SplineSurface!"); - new (instance) SplineSurface(shared_ptr(primitive),acuts); - py::object obj = py::cast(instance); + throw Exception("Base is not a SurfacePrimitive in constructor of SplineSurface!"); + return make_shared(shared_ptr(primitive),acuts); }),py::arg("base"), py::arg("cuts")=py::list()) .def("AddPoint", FunctionPointer ([] (SplineSurface & self, double x, double y, double z, bool hpref)