1
/***************************************************************************
2
* Copyright (c) 2019 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
24
#include "PreCompiled.h"
26
#include "GeometryDefaultExtension.h"
28
#include "GeometryDoubleExtensionPy.h"
29
#include "GeometryDoubleExtensionPy.cpp"
33
// returns a string which represents the object e.g. when printed in python
34
std::string GeometryDoubleExtensionPy::representation() const
36
std::stringstream str;
37
double val = getGeometryDoubleExtensionPtr()->getValue();
38
str << "<GeometryDoubleExtension (" ;
40
if(!getGeometryDoubleExtensionPtr()->getName().empty())
41
str << "\'" << getGeometryDoubleExtensionPtr()->getName() << "\', ";
49
PyObject *GeometryDoubleExtensionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
51
// create a new instance of the python object and the Twin object
52
return new GeometryDoubleExtensionPy(new GeometryDoubleExtension);
56
int GeometryDoubleExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
59
if (PyArg_ParseTuple(args, "")) {
66
if (PyArg_ParseTuple(args, "d", &val)) {
67
this->getGeometryDoubleExtensionPtr()->setValue(val);
73
if (PyArg_ParseTuple(args, "ds", &val,&pystr)) {
74
this->getGeometryDoubleExtensionPtr()->setValue(val);
75
this->getGeometryDoubleExtensionPtr()->setName(pystr);
79
PyErr_SetString(PyExc_TypeError, "GeometryDoubleExtension constructor accepts:\n"
80
"-- empty parameter list\n"
82
"-- double, string\n");
86
Py::Float GeometryDoubleExtensionPy::getValue() const
88
return Py::Float(this->getGeometryDoubleExtensionPtr()->getValue());
91
void GeometryDoubleExtensionPy::setValue(Py::Float value)
93
this->getGeometryDoubleExtensionPtr()->setValue(float(value));
98
PyObject *GeometryDoubleExtensionPy::getCustomAttributes(const char* /*attr*/) const
103
int GeometryDoubleExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)