Part: geometry extensions minor code clean up

This commit is contained in:
Abdullah Tahiri
2019-02-14 06:33:06 +01:00
committed by wmayer
parent 42bc279941
commit 5a435f8d84
5 changed files with 22 additions and 23 deletions

View File

@@ -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;
}