diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp
index 576df44a5..f573eef8e 100644
--- a/src/Mod/Part/App/AppPart.cpp
+++ b/src/Mod/Part/App/AppPart.cpp
@@ -229,6 +229,7 @@ PyMODINIT_FUNC initPart()
Part::Feature ::init();
Part::FeatureExt ::init();
Part::AttachableObject ::init();
+ Part::AttachableObjectPython::init();
Part::BodyBase ::init();
Part::FeaturePython ::init();
Part::FeatureGeometrySet ::init();
diff --git a/src/Mod/Part/App/AttachableObject.cpp b/src/Mod/Part/App/AttachableObject.cpp
index b1e615516..9a4e90913 100644
--- a/src/Mod/Part/App/AttachableObject.cpp
+++ b/src/Mod/Part/App/AttachableObject.cpp
@@ -30,6 +30,8 @@
#include
#include
+#include
+#include "AttachableObjectPy.h"
using namespace Part;
@@ -151,4 +153,22 @@ void AttachableObject::updateAttacherVals()
this->superPlacement.getValue());
}
+namespace App {
+/// @cond DOXERR
+ PROPERTY_SOURCE_TEMPLATE(Part::AttachableObjectPython, Part::AttachableObject)
+ template<> const char* Part::AttachableObjectPython::getViewProviderName(void) const {
+ return "PartGui::ViewProviderPython";
+ }
+ template<> PyObject* Part::AttachableObjectPython::getPyObject(void) {
+ if (PythonObject.is(Py::_None())) {
+ // ref counter is set to 1
+ PythonObject = Py::Object(new FeaturePythonPyT(this),true);
+ }
+ return Py::new_reference_to(PythonObject);
+ }
+/// @endcond
+
+// explicit template instantiation
+ template class PartExport FeaturePythonT;
+}
diff --git a/src/Mod/Part/App/AttachableObject.h b/src/Mod/Part/App/AttachableObject.h
index 96313456e..251df56a3 100644
--- a/src/Mod/Part/App/AttachableObject.h
+++ b/src/Mod/Part/App/AttachableObject.h
@@ -104,6 +104,8 @@ private:
};
+typedef App::FeaturePythonT AttachableObjectPython;
+
} // namespace Part
#endif // PARTATTACHABLEOBJECT_H
diff --git a/src/Mod/Part/App/AttachableObjectPy.xml b/src/Mod/Part/App/AttachableObjectPy.xml
new file mode 100644
index 000000000..443f5a645
--- /dev/null
+++ b/src/Mod/Part/App/AttachableObjectPy.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ This object represents an attachable object with OCC shape.
+
+
+
+ positionBySupport(): Reposition object based on Support, MapMode and MapPathParameter properties.
+Returns True if attachment calculation was successful, false if object is not attached and Placement wasn't updated,
+and raises an exception if attachment calculation fails.
+
+
+
+
diff --git a/src/Mod/Part/App/AttachableObjectPyImp.cpp b/src/Mod/Part/App/AttachableObjectPyImp.cpp
new file mode 100644
index 000000000..349274d7b
--- /dev/null
+++ b/src/Mod/Part/App/AttachableObjectPyImp.cpp
@@ -0,0 +1,48 @@
+
+#include "PreCompiled.h"
+
+#include "Mod/Part/App/AttachableObject.h"
+#include "OCCError.h"
+
+// inclusion of the generated files (generated out of AttachableObjectPy.xml)
+#include "AttachableObjectPy.h"
+#include "AttachableObjectPy.cpp"
+
+using namespace Part;
+
+// returns a string which represents the object e.g. when printed in python
+std::string AttachableObjectPy::representation(void) const
+{
+ return std::string("");
+}
+
+PyObject* AttachableObjectPy::positionBySupport(PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return 0;
+ bool bAttached = false;
+ try{
+ bAttached = this->getAttachableObjectPtr()->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 *AttachableObjectPy::getCustomAttributes(const char* /*attr*/) const
+{
+ return 0;
+}
+
+int AttachableObjectPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+{
+ return 0;
+}
+
+
diff --git a/src/Mod/Part/App/CMakeLists.txt b/src/Mod/Part/App/CMakeLists.txt
index a223b4d2d..68a718123 100644
--- a/src/Mod/Part/App/CMakeLists.txt
+++ b/src/Mod/Part/App/CMakeLists.txt
@@ -69,6 +69,7 @@ generate_from_xml(RectangularTrimmedSurfacePy)
generate_from_xml(SurfaceOfExtrusionPy)
generate_from_xml(SurfaceOfRevolutionPy)
generate_from_xml(PartFeaturePy)
+generate_from_xml(AttachableObjectPy)
generate_from_xml(Part2DObjectPy)
generate_from_xml(TopoShapePy)
generate_from_xml(TopoShapeCompoundPy)
@@ -216,6 +217,8 @@ SET(Python_SRCS
SurfaceOfRevolutionPyImp.cpp
PartFeaturePy.xml
PartFeaturePyImp.cpp
+ AttachableObjectPy.xml
+ AttachableObjectPyImp.cpp
Part2DObjectPy.xml
Part2DObjectPyImp.cpp
TopoShapePy.xml
diff --git a/src/Mod/Part/App/Part2DObjectPy.xml b/src/Mod/Part/App/Part2DObjectPy.xml
index 7172b2fb9..299bcd84d 100644
--- a/src/Mod/Part/App/Part2DObjectPy.xml
+++ b/src/Mod/Part/App/Part2DObjectPy.xml
@@ -1,13 +1,13 @@