diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp
index ae01cbf998..1f9cc5bbd6 100644
--- a/src/Mod/Part/App/AppPart.cpp
+++ b/src/Mod/Part/App/AppPart.cpp
@@ -62,6 +62,8 @@
#include "Geometry2d.h"
#include "Mod/Part/App/GeometryIntExtensionPy.h"
#include "Mod/Part/App/GeometryStringExtensionPy.h"
+#include "Mod/Part/App/GeometryBoolExtensionPy.h"
+#include "Mod/Part/App/GeometryDoubleExtensionPy.h"
#include "Mod/Part/App/TopoShapePy.h"
#include "Mod/Part/App/TopoShapeVertexPy.h"
#include "Mod/Part/App/TopoShapeFacePy.h"
@@ -359,6 +361,8 @@ PyMOD_INIT_FUNC(Part)
Base::Interpreter().addType(&Part::GeometryIntExtensionPy ::Type,partModule,"GeometryIntExtension");
Base::Interpreter().addType(&Part::GeometryStringExtensionPy ::Type,partModule,"GeometryStringExtension");
+ Base::Interpreter().addType(&Part::GeometryBoolExtensionPy ::Type,partModule,"GeometryBoolExtension");
+ Base::Interpreter().addType(&Part::GeometryDoubleExtensionPy ::Type,partModule,"GeometryDoubleExtension");
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef BRepOffsetAPIDef = {
@@ -487,6 +491,8 @@ PyMOD_INIT_FUNC(Part)
Part::GeometryExtension ::init();
Part::GeometryIntExtension ::init();
Part::GeometryStringExtension ::init();
+ Part::GeometryBoolExtension ::init();
+ Part::GeometryDoubleExtension ::init();
Part::Geometry ::init();
Part::GeomPoint ::init();
Part::GeomCurve ::init();
diff --git a/src/Mod/Part/App/CMakeLists.txt b/src/Mod/Part/App/CMakeLists.txt
index 1053c1ef43..d2582cc562 100644
--- a/src/Mod/Part/App/CMakeLists.txt
+++ b/src/Mod/Part/App/CMakeLists.txt
@@ -54,6 +54,8 @@ generate_from_xml(GeometryPy)
generate_from_xml(GeometryExtensionPy)
generate_from_xml(GeometryIntExtensionPy)
generate_from_xml(GeometryStringExtensionPy)
+generate_from_xml(GeometryBoolExtensionPy)
+generate_from_xml(GeometryDoubleExtensionPy)
generate_from_xml(GeometryCurvePy)
generate_from_xml(BoundedCurvePy)
generate_from_xml(TrimmedCurvePy)
@@ -220,6 +222,10 @@ SET(Python_SRCS
GeometryIntExtensionPyImp.cpp
GeometryStringExtensionPy.xml
GeometryStringExtensionPyImp.cpp
+ GeometryBoolExtensionPy.xml
+ GeometryBoolExtensionPyImp.cpp
+ GeometryDoubleExtensionPy.xml
+ GeometryDoubleExtensionPyImp.cpp
GeometryCurvePy.xml
GeometryCurvePyImp.cpp
BoundedCurvePy.xml
diff --git a/src/Mod/Part/App/GeometryBoolExtensionPy.xml b/src/Mod/Part/App/GeometryBoolExtensionPy.xml
new file mode 100644
index 0000000000..3b90799d7f
--- /dev/null
+++ b/src/Mod/Part/App/GeometryBoolExtensionPy.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+ A GeometryExtension extending geometry objects with a boolean.
+
+
+
+
+ returns the value of the GeometryBoolExtension.
+
+
+
+
+
+
diff --git a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp
new file mode 100644
index 0000000000..6801a6db25
--- /dev/null
+++ b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp
@@ -0,0 +1,104 @@
+/***************************************************************************
+ * Copyright (c) 2019 Abdullah Tahiri *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#include "PreCompiled.h"
+
+#include "GeometryDefaultExtension.h"
+
+#include "GeometryBoolExtensionPy.h"
+#include "GeometryBoolExtensionPy.cpp"
+
+using namespace Part;
+
+// returns a string which represents the object e.g. when printed in python
+std::string GeometryBoolExtensionPy::representation(void) const
+{
+ std::stringstream str;
+ long id = getGeometryBoolExtensionPtr()->getValue();
+ str << "getName().size()>0)
+ str << "\'" << getGeometryBoolExtensionPtr()->getName() << "\', ";
+
+ str << (id==0?"False":"True") << ") >";
+
+
+ return str.str();
+}
+
+PyObject *GeometryBoolExtensionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
+{
+ // create a new instance of the python object and the Twin object
+ return new GeometryBoolExtensionPy(new GeometryBoolExtension);
+}
+
+// constructor method
+int GeometryBoolExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
+{
+
+ if (PyArg_ParseTuple(args, "")) {
+ // default extension
+ return 0;
+ }
+
+ PyErr_Clear();
+ PyObject* Id;
+ if (PyArg_ParseTuple(args, "O!", &PyBool_Type, &Id)) {
+ this->getGeometryBoolExtensionPtr()->setValue(PyObject_IsTrue(Id) ? 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);
+ this->getGeometryBoolExtensionPtr()->setName(pystr);
+ return 0;
+ }
+
+ PyErr_SetString(PyExc_TypeError, "GeometryBoolExtension constructor accepts:\n"
+ "-- empty parameter list\n"
+ "-- Boolean\n"
+ "-- Boolean, string\n");
+ return -1;
+}
+
+Py::Boolean GeometryBoolExtensionPy::getValue(void) const
+{
+ return Py::Boolean(this->getGeometryBoolExtensionPtr()->getValue());
+}
+
+void GeometryBoolExtensionPy::setValue(Py::Boolean value)
+{
+ this->getGeometryBoolExtensionPtr()->setValue(value);
+}
+
+PyObject *GeometryBoolExtensionPy::getCustomAttributes(const char* /*attr*/) const
+{
+ return 0;
+}
+
+int GeometryBoolExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+{
+ return 0;
+}
diff --git a/src/Mod/Part/App/GeometryDefaultExtension.cpp b/src/Mod/Part/App/GeometryDefaultExtension.cpp
index a39137aa1f..a125e75651 100644
--- a/src/Mod/Part/App/GeometryDefaultExtension.cpp
+++ b/src/Mod/Part/App/GeometryDefaultExtension.cpp
@@ -32,6 +32,8 @@
#include "GeometryStringExtensionPy.h"
#include "GeometryIntExtensionPy.h"
+#include "GeometryBoolExtensionPy.h"
+#include "GeometryDoubleExtensionPy.h"
using namespace Part;
@@ -121,4 +123,36 @@ PyObject * GeometryDefaultExtension::getPyObject(void)
return new GeometryStringExtensionPy(new GeometryStringExtension(*this));
}
+// ---------- GeometryBoolExtension ----------
+TYPESYSTEM_SOURCE_TEMPLATE_T(Part::GeometryBoolExtension,Part::GeometryExtension)
+template <>
+PyObject * GeometryDefaultExtension::getPyObject(void)
+{
+ return new GeometryBoolExtensionPy(new GeometryBoolExtension(*this));
+}
+
+template <>
+void GeometryDefaultExtension::Restore(Base::XMLReader &reader)
+{
+ restoreNameAttribute(reader);
+
+ value = (bool)reader.getAttributeAsInteger("value");
+}
+
+// ---------- GeometryDoubleExtension ----------
+TYPESYSTEM_SOURCE_TEMPLATE_T(Part::GeometryDoubleExtension,Part::GeometryExtension)
+
+template <>
+PyObject * GeometryDefaultExtension::getPyObject(void)
+{
+ return new GeometryDoubleExtensionPy(new GeometryDoubleExtension(*this));
+}
+
+template <>
+void GeometryDefaultExtension::Restore(Base::XMLReader &reader)
+{
+ restoreNameAttribute(reader);
+
+ value = reader.getAttributeAsFloat("value");
+}
diff --git a/src/Mod/Part/App/GeometryDefaultExtension.h b/src/Mod/Part/App/GeometryDefaultExtension.h
index 5f983610e7..105ba753e2 100644
--- a/src/Mod/Part/App/GeometryDefaultExtension.h
+++ b/src/Mod/Part/App/GeometryDefaultExtension.h
@@ -94,14 +94,21 @@ namespace Part {
template <>
inline GeometryDefaultExtension::GeometryDefaultExtension():value(0){}
+ template <>
+ inline GeometryDefaultExtension::GeometryDefaultExtension():value(0.0f){}
+
// instantiate the types so that other translation units (python wrappers) can access template
//constructors other than the default.
template class GeometryDefaultExtension;
template class GeometryDefaultExtension;
+ template class GeometryDefaultExtension;
+ template class GeometryDefaultExtension;
// Prefer alias to typedef item 9
using GeometryIntExtension = GeometryDefaultExtension;
using GeometryStringExtension = GeometryDefaultExtension;
+ using GeometryBoolExtension = GeometryDefaultExtension;
+ using GeometryDoubleExtension = GeometryDefaultExtension;
}
#endif // PART_GEOMETRYDEFAULTEXTENSION_H
diff --git a/src/Mod/Part/App/GeometryDoubleExtensionPy.xml b/src/Mod/Part/App/GeometryDoubleExtensionPy.xml
new file mode 100644
index 0000000000..0c0a3c2385
--- /dev/null
+++ b/src/Mod/Part/App/GeometryDoubleExtensionPy.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+ A GeometryExtension extending geometry objects with a double.
+
+
+
+
+ returns the value of the GeometryDoubleExtension.
+
+
+
+
+
+
diff --git a/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp b/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp
new file mode 100644
index 0000000000..361350bd14
--- /dev/null
+++ b/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp
@@ -0,0 +1,106 @@
+/***************************************************************************
+ * Copyright (c) 2019 Abdullah Tahiri *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#include "PreCompiled.h"
+
+#include "GeometryDefaultExtension.h"
+
+#include "GeometryDoubleExtensionPy.h"
+#include "GeometryDoubleExtensionPy.cpp"
+
+using namespace Part;
+
+// returns a string which represents the object e.g. when printed in python
+std::string GeometryDoubleExtensionPy::representation(void) const
+{
+ std::stringstream str;
+ double id = getGeometryDoubleExtensionPtr()->getValue();
+ str << "getName().size()>0)
+ str << "\'" << getGeometryDoubleExtensionPtr()->getName() << "\', ";
+
+ str << id << ") >";
+
+
+ return str.str();
+}
+
+PyObject *GeometryDoubleExtensionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
+{
+ // create a new instance of the python object and the Twin object
+ return new GeometryDoubleExtensionPy(new GeometryDoubleExtension);
+}
+
+// constructor method
+int GeometryDoubleExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
+{
+
+ if (PyArg_ParseTuple(args, "")) {
+ // default extension
+ return 0;
+ }
+
+ PyErr_Clear();
+ double Id;
+ if (PyArg_ParseTuple(args, "d", &Id)) {
+ this->getGeometryDoubleExtensionPtr()->setValue(Id);
+ return 0;
+ }
+
+ PyErr_Clear();
+ char * pystr;
+ if (PyArg_ParseTuple(args, "ds", &Id,&pystr)) {
+ this->getGeometryDoubleExtensionPtr()->setValue(Id);
+ this->getGeometryDoubleExtensionPtr()->setName(pystr);
+ return 0;
+ }
+
+ PyErr_SetString(PyExc_TypeError, "GeometryDoubleExtension constructor accepts:\n"
+ "-- empty parameter list\n"
+ "-- double\n"
+ "-- double, string\n");
+ return -1;
+}
+
+Py::Float GeometryDoubleExtensionPy::getValue(void) const
+{
+ return Py::Float(this->getGeometryDoubleExtensionPtr()->getValue());
+}
+
+void GeometryDoubleExtensionPy::setValue(Py::Float value)
+{
+ this->getGeometryDoubleExtensionPtr()->setValue(float(value));
+}
+
+
+
+PyObject *GeometryDoubleExtensionPy::getCustomAttributes(const char* /*attr*/) const
+{
+ return 0;
+}
+
+int GeometryDoubleExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+{
+ return 0;
+}