Part: Wrap PyArg_ParseTupleAndKeywords

This commit is contained in:
Chris Hennes
2023-08-25 15:34:26 -05:00
parent 8fe9d7e879
commit 0e8be10b90
32 changed files with 547 additions and 440 deletions
+12 -11
View File
@@ -27,6 +27,7 @@
#endif
#include <Base/GeometryPyCXX.h>
#include <Base/PyWrapParseTupleAndKeywords.h>
#include <Base/VectorPy.h>
#include "HyperbolaPy.h"
@@ -53,18 +54,18 @@ PyObject *HyperbolaPy::PyMake(struct _typeobject *, PyObject *, PyObject *) //
// constructor method
int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds)
{
char* keywords_n[] = {nullptr};
if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) {
static const std::array<const char *, 1> keywords_n {nullptr};
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "", keywords_n)) {
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
hyperbola->SetMajorRadius(2.0);
hyperbola->SetMinorRadius(1.0);
return 0;
}
char* keywords_e[] = {"Hyperbola",nullptr};
static const std::array<const char *, 2> keywords_e {"Hyperbola", nullptr};
PyErr_Clear();
PyObject *pHypr;
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(HyperbolaPy::Type), &pHypr)) {
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(HyperbolaPy::Type), &pHypr)) {
HyperbolaPy* pHyperbola = static_cast<HyperbolaPy*>(pHypr);
Handle(Geom_Hyperbola) Hypr1 = Handle(Geom_Hyperbola)::DownCast
(pHyperbola->getGeomHyperbolaPtr()->handle());
@@ -74,13 +75,13 @@ int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds)
return 0;
}
char* keywords_ssc[] = {"S1","S2","Center",nullptr};
static const std::array<const char *, 4> keywords_ssc{"S1", "S2", "Center", nullptr};
PyErr_Clear();
PyObject *pV1, *pV2, *pV3;
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc,
&(Base::VectorPy::Type), &pV1,
&(Base::VectorPy::Type), &pV2,
&(Base::VectorPy::Type), &pV3)) {
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc,
&(Base::VectorPy::Type), &pV1,
&(Base::VectorPy::Type), &pV2,
&(Base::VectorPy::Type), &pV3)) {
Base::Vector3d v1 = static_cast<Base::VectorPy*>(pV1)->value();
Base::Vector3d v2 = static_cast<Base::VectorPy*>(pV2)->value();
Base::Vector3d v3 = static_cast<Base::VectorPy*>(pV3)->value();
@@ -97,11 +98,11 @@ int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds)
return 0;
}
char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",nullptr};
static const std::array<const char *, 4> keywords_cmm {"Center","MajorRadius","MinorRadius",nullptr};
PyErr_Clear();
PyObject *pV;
double major, minor;
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!dd", keywords_cmm,
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!dd", keywords_cmm,
&(Base::VectorPy::Type), &pV,
&major, &minor)) {
Base::Vector3d c = static_cast<Base::VectorPy*>(pV)->value();