Part: Wrap PyArg_ParseTupleAndKeywords
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
#include <Base/PyWrapParseTupleAndKeywords.h>
|
||||
#include <Base/VectorPy.h>
|
||||
|
||||
#include "EllipsePy.h"
|
||||
@@ -53,18 +54,18 @@ PyObject *EllipsePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Py
|
||||
// constructor method
|
||||
int EllipsePy::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_Ellipse) ellipse = Handle(Geom_Ellipse)::DownCast(getGeomEllipsePtr()->handle());
|
||||
ellipse->SetMajorRadius(2.0);
|
||||
ellipse->SetMinorRadius(1.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* keywords_e[] = {"Ellipse",nullptr};
|
||||
static const std::array<const char *, 2> keywords_e {"Ellipse", nullptr};
|
||||
PyErr_Clear();
|
||||
PyObject *pElips;
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(EllipsePy::Type), &pElips)) {
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(EllipsePy::Type), &pElips)) {
|
||||
EllipsePy* pEllipse = static_cast<EllipsePy*>(pElips);
|
||||
Handle(Geom_Ellipse) Elips1 = Handle(Geom_Ellipse)::DownCast
|
||||
(pEllipse->getGeomEllipsePtr()->handle());
|
||||
@@ -74,13 +75,13 @@ int EllipsePy::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 EllipsePy::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();
|
||||
|
||||
Reference in New Issue
Block a user