1
/***************************************************************************
2
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
4
* This file is part of FreeCAD. *
6
* FreeCAD is free software: you can redistribute it and/or modify it *
7
* under the terms of the GNU Lesser General Public License as *
8
* published by the Free Software Foundation, either version 2.1 of the *
9
* License, or (at your option) any later version. *
11
* FreeCAD is distributed in the hope that it will be useful, but *
12
* WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14
* Lesser General Public License for more details. *
16
* You should have received a copy of the GNU Lesser General Public *
17
* License along with FreeCAD. If not, see *
18
* <https://www.gnu.org/licenses/>. *
20
**************************************************************************/
22
#include "PreCompiled.h"
25
#include "ModelPropertyPy.h"
27
#include "ModelPropertyPy.cpp"
29
using namespace Materials;
31
// returns a string which represents the object e.g. when printed in python
32
std::string ModelPropertyPy::representation() const
34
ModelPropertyPy::PointerType ptr = getModelPropertyPtr();
35
std::stringstream str;
36
str << "Property [Name=(";
37
str << ptr->getName().toStdString();
39
str << ptr->getPropertyType().toStdString();
41
str << ptr->getUnits().toStdString();
43
str << ptr->getURL().toStdString();
44
str << "), Description=(";
45
str << ptr->getDescription().toStdString();
51
PyObject* ModelPropertyPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
53
// never create such objects with the constructor
54
return new ModelPropertyPy(new ModelProperty());
58
int ModelPropertyPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
63
Py::String ModelPropertyPy::getName() const
65
return Py::String(getModelPropertyPtr()->getName().toStdString());
68
Py::String ModelPropertyPy::getType() const
70
return Py::String(getModelPropertyPtr()->getPropertyType().toStdString());
73
Py::String ModelPropertyPy::getUnits() const
75
return Py::String(getModelPropertyPtr()->getUnits().toStdString());
78
Py::String ModelPropertyPy::getURL() const
80
return Py::String(getModelPropertyPtr()->getURL().toStdString());
83
Py::String ModelPropertyPy::getDescription() const
85
return Py::String(getModelPropertyPtr()->getDescription().toStdString());
88
PyObject* ModelPropertyPy::getCustomAttributes(const char* /*attr*/) const
93
int ModelPropertyPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)