1
/***************************************************************************
2
* Copyright (c) 2007 Werner Mayer <wmayer[at]users.sourceforge.net> *
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
***************************************************************************/
23
#include "PreCompiled.h"
25
#include <Base/PyWrapParseTupleAndKeywords.h>
27
#include "PartFeature.h"
29
// inclusion of the generated files (generated out of PartFeaturePy.xml)
30
#include "PartFeaturePy.h"
31
#include "PartFeaturePy.cpp"
36
// returns a string which represent the object e.g. when printed in python
37
std::string PartFeaturePy::representation() const
39
return {"<Part::PartFeature>"};
42
PyObject *PartFeaturePy::getElementHistory(PyObject *args, PyObject *kwds) {
44
PyObject *recursive = Py_True;
45
PyObject *sameType = Py_False;
46
PyObject *showName = Py_False;
48
static const std::array<const char *, 5> kwlist{"elementName", "recursive", "sameType", "showName", nullptr};
49
if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "s|OOO", kwlist, &name, &recursive, &sameType, &showName)) {
53
auto feature = getFeaturePtr();
55
bool showObjName = PyObject_IsTrue(showName);
58
for (auto &history: Feature::getElementHistory(feature, name,
59
PyObject_IsTrue(recursive), PyObject_IsTrue(sameType))) {
63
ret.setItem(0, Py::TupleN(Py::String(history.obj->getFullName()),
64
Py::String(history.obj->Label.getValue())));
66
ret.setItem(0, Py::Object(history.obj->getPyObject(), true));
68
ret.setItem(0, Py::Int(history.tag));
70
ret.setItem(1, Py::String(history.element.appendToBuffer(tmp)));
71
Py::List intermedates;
72
for (auto &h: history.intermediates) {
74
intermedates.append(Py::String(h.appendToBuffer(tmp)));
76
ret.setItem(2, intermedates);
79
return Py::new_reference_to(list);
83
PyObject *PartFeaturePy::getCustomAttributes(const char* ) const
88
int PartFeaturePy::setCustomAttributes(const char* , PyObject *)