2
/***************************************************************************
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 "AttachExtensionPy.h"
26
#include "AttachExtensionPy.cpp"
27
#include "AttachEnginePy.h"
33
// returns a string which represents the object e.g. when printed in python
34
std::string AttachExtensionPy::representation() const
36
return {"<Part::AttachableObject>"};
39
PyObject* AttachExtensionPy::positionBySupport(PyObject *args)
41
if (!PyArg_ParseTuple(args, ""))
43
bool bAttached = false;
45
bAttached = this->getAttachExtensionPtr()->positionBySupport();
46
} catch (Standard_Failure& e) {
47
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
49
} catch (Base::Exception &e) {
53
return Py::new_reference_to(Py::Boolean(bAttached));
56
PyObject* AttachExtensionPy::changeAttacherType(PyObject *args)
59
if (!PyArg_ParseTuple(args, "s", &typeName))
63
ret = this->getAttachExtensionPtr()->changeAttacherType(typeName);
64
} catch (Standard_Failure& e) {
65
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
67
} catch (Base::Exception &e) {
71
return Py::new_reference_to(Py::Boolean(ret));
74
Py::Object AttachExtensionPy::getAttacher() const
77
this->getAttachExtensionPtr()->attacher(); //throws if attacher is not set
78
} catch (Base::Exception&) {
83
return Py::Object( new Attacher::AttachEnginePy(this->getAttachExtensionPtr()->attacher().copy()), true);
84
} catch (Standard_Failure& e) {
85
throw Py::Exception(Part::PartExceptionOCCError, e.GetMessageString());
86
} catch (Base::Exception &e) {
88
throw Py::Exception();
93
PyObject *AttachExtensionPy::getCustomAttributes(const char* /*attr*/) const
98
int AttachExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)