Part: geometry extensions minor code clean up
This commit is contained in:
@@ -56,7 +56,6 @@
|
||||
#include <gp_Vec.hxx>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <Base/Persistence.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ using namespace Part;
|
||||
std::string GeometryBoolExtensionPy::representation(void) const
|
||||
{
|
||||
std::stringstream str;
|
||||
long id = getGeometryBoolExtensionPtr()->getValue();
|
||||
double val = getGeometryBoolExtensionPtr()->getValue();
|
||||
str << "<GeometryBoolExtension (" ;
|
||||
|
||||
if(getGeometryBoolExtensionPtr()->getName().size()>0)
|
||||
str << "\'" << getGeometryBoolExtensionPtr()->getName() << "\', ";
|
||||
|
||||
str << (id==0?"False":"True") << ") >";
|
||||
str << (val?"True":"False") << ") >";
|
||||
|
||||
|
||||
return str.str();
|
||||
@@ -62,16 +62,16 @@ int GeometryBoolExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
PyObject* Id;
|
||||
if (PyArg_ParseTuple(args, "O!", &PyBool_Type, &Id)) {
|
||||
this->getGeometryBoolExtensionPtr()->setValue(PyObject_IsTrue(Id) ? true : false);
|
||||
PyObject* val;
|
||||
if (PyArg_ParseTuple(args, "O!", &PyBool_Type, &val)) {
|
||||
this->getGeometryBoolExtensionPtr()->setValue(PyObject_IsTrue(val) ? true : false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
char * pystr;
|
||||
if (PyArg_ParseTuple(args, "O!s", &PyBool_Type, &Id, &pystr)) {
|
||||
this->getGeometryBoolExtensionPtr()->setValue(PyObject_IsTrue(Id) ? true : false);
|
||||
if (PyArg_ParseTuple(args, "O!s", &PyBool_Type, &val, &pystr)) {
|
||||
this->getGeometryBoolExtensionPtr()->setValue(PyObject_IsTrue(val) ? true : false);
|
||||
this->getGeometryBoolExtensionPtr()->setName(pystr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,13 +34,13 @@ using namespace Part;
|
||||
std::string GeometryDoubleExtensionPy::representation(void) const
|
||||
{
|
||||
std::stringstream str;
|
||||
double id = getGeometryDoubleExtensionPtr()->getValue();
|
||||
double val = getGeometryDoubleExtensionPtr()->getValue();
|
||||
str << "<GeometryDoubleExtension (" ;
|
||||
|
||||
if(getGeometryDoubleExtensionPtr()->getName().size()>0)
|
||||
str << "\'" << getGeometryDoubleExtensionPtr()->getName() << "\', ";
|
||||
|
||||
str << id << ") >";
|
||||
str << val << ") >";
|
||||
|
||||
|
||||
return str.str();
|
||||
@@ -62,16 +62,16 @@ int GeometryDoubleExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
double Id;
|
||||
if (PyArg_ParseTuple(args, "d", &Id)) {
|
||||
this->getGeometryDoubleExtensionPtr()->setValue(Id);
|
||||
double val;
|
||||
if (PyArg_ParseTuple(args, "d", &val)) {
|
||||
this->getGeometryDoubleExtensionPtr()->setValue(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
char * pystr;
|
||||
if (PyArg_ParseTuple(args, "ds", &Id,&pystr)) {
|
||||
this->getGeometryDoubleExtensionPtr()->setValue(Id);
|
||||
if (PyArg_ParseTuple(args, "ds", &val,&pystr)) {
|
||||
this->getGeometryDoubleExtensionPtr()->setValue(val);
|
||||
this->getGeometryDoubleExtensionPtr()->setName(pystr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ PyObject* GeometryExtensionPy::copy(PyObject *args)
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, 0);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create copy of geometry");
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create copy of the geometry extension");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ using namespace Part;
|
||||
std::string GeometryIntExtensionPy::representation(void) const
|
||||
{
|
||||
std::stringstream str;
|
||||
long id = getGeometryIntExtensionPtr()->getValue();
|
||||
long val = getGeometryIntExtensionPtr()->getValue();
|
||||
str << "<GeometryIntExtension (" ;
|
||||
|
||||
if(getGeometryIntExtensionPtr()->getName().size()>0)
|
||||
str << "\'" << getGeometryIntExtensionPtr()->getName() << "\', ";
|
||||
|
||||
str << id << ") >";
|
||||
str << val << ") >";
|
||||
|
||||
|
||||
return str.str();
|
||||
@@ -62,16 +62,16 @@ int GeometryIntExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
long Id;
|
||||
if (PyArg_ParseTuple(args, "l", &Id)) {
|
||||
this->getGeometryIntExtensionPtr()->setValue(Id);
|
||||
long val;
|
||||
if (PyArg_ParseTuple(args, "l", &val)) {
|
||||
this->getGeometryIntExtensionPtr()->setValue(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
char * pystr;
|
||||
if (PyArg_ParseTuple(args, "ls", &Id,&pystr)) {
|
||||
this->getGeometryIntExtensionPtr()->setValue(Id);
|
||||
if (PyArg_ParseTuple(args, "ls", &val,&pystr)) {
|
||||
this->getGeometryIntExtensionPtr()->setValue(val);
|
||||
this->getGeometryIntExtensionPtr()->setName(pystr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user