mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-15 02:18:33 +05:00
Merge branch 'std_exception_inv_arg' into 'master'
use std invalid argument instead of Exception in py constructor See merge request ngsolve/netgen!685
This commit is contained in:
commit
ddf64c8250
@ -167,12 +167,9 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m)
|
||||
|
||||
|
||||
py::class_<gp_Pnt2d>(m, "gp_Pnt2d", "2d OCC point")
|
||||
.def(py::init([] (py::tuple pnt)
|
||||
.def(py::init([] (std::tuple<double,double> pnt)
|
||||
{
|
||||
if (py::len(pnt) != 2)
|
||||
throw Exception("need 2-tuple to create gp_Pnt2d");
|
||||
return gp_Pnt2d(py::cast<double>(pnt[0]),
|
||||
py::cast<double>(pnt[1]));
|
||||
return gp_Pnt2d(get<0>(pnt), get<1>(pnt));
|
||||
}))
|
||||
.def(py::init([] (double x, double y) {
|
||||
return gp_Pnt2d(x, y);
|
||||
|
Loading…
Reference in New Issue
Block a user