a75a98ef27
This is the result of running OCCT's upgrade script provided with OCCT 7.0. See https://www.opencascade.com/content/freecad-occt710-and-windows-rtti-data-missing#comment-form and https://www.forum.freecadweb.org/viewtopic.php?f=4&t=21405&start=120#p169019 for why this is necessary for OCCT >= 7.1
88 lines
2.5 KiB
C++
88 lines
2.5 KiB
C++
|
|
#include "PreCompiled.h"
|
|
|
|
#include "Mod/Part/App/AttachExtension.h"
|
|
#include "OCCError.h"
|
|
|
|
#include "AttachEnginePy.h"
|
|
|
|
// inclusion of the generated files (generated out of AttachExtensionPy.xml)
|
|
#include "AttachExtensionPy.h"
|
|
#include "AttachExtensionPy.cpp"
|
|
|
|
using namespace Part;
|
|
|
|
// returns a string which represents the object e.g. when printed in python
|
|
std::string AttachExtensionPy::representation(void) const
|
|
{
|
|
return std::string("<Part::AttachableObject>");
|
|
}
|
|
|
|
PyObject* AttachExtensionPy::positionBySupport(PyObject *args)
|
|
{
|
|
if (!PyArg_ParseTuple(args, ""))
|
|
return 0;
|
|
bool bAttached = false;
|
|
try{
|
|
bAttached = this->getAttachExtensionPtr()->positionBySupport();
|
|
} catch (Standard_Failure) {
|
|
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
|
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
|
|
return NULL;
|
|
} catch (Base::Exception &e) {
|
|
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
|
return NULL;
|
|
}
|
|
return Py::new_reference_to(Py::Boolean(bAttached));
|
|
}
|
|
|
|
PyObject* AttachExtensionPy::changeAttacherType(PyObject *args)
|
|
{
|
|
const char* typeName;
|
|
if (!PyArg_ParseTuple(args, "s", &typeName))
|
|
return 0;
|
|
bool ret;
|
|
try{
|
|
ret = this->getAttachExtensionPtr()->changeAttacherType(typeName);
|
|
} catch (Standard_Failure) {
|
|
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
|
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
|
|
return NULL;
|
|
} catch (Base::Exception &e) {
|
|
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
|
return NULL;
|
|
}
|
|
return Py::new_reference_to(Py::Boolean(ret));
|
|
}
|
|
|
|
Py::Object AttachExtensionPy::getAttacher(void) const
|
|
{
|
|
try {
|
|
this->getAttachExtensionPtr()->attacher(); //throws if attacher is not set
|
|
} catch (Base::Exception) {
|
|
return Py::None();
|
|
}
|
|
|
|
try {
|
|
return Py::Object( new Attacher::AttachEnginePy(this->getAttachExtensionPtr()->attacher().copy()), true);
|
|
} catch (Standard_Failure) {
|
|
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
|
throw Py::Exception(Part::PartExceptionOCCError, e->GetMessageString());
|
|
} catch (Base::Exception &e) {
|
|
throw Py::Exception(Base::BaseExceptionFreeCADError, e.what());
|
|
}
|
|
|
|
}
|
|
|
|
PyObject *AttachExtensionPy::getCustomAttributes(const char* /*attr*/) const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int AttachExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|