Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attacher: Py: introduce Py interface of AttachableObject
Small - just the introduction. Support for Py features based on AttachableObject. Redirect Part2DObjectPython's father to be AttachableObjectPython.
- Loading branch information
Showing
7 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd"> | ||
<PythonExport | ||
Father="PartFeaturePy" | ||
Name="AttachableObjectPy" | ||
Twin="AttachableObject" | ||
TwinPointer="AttachableObject" | ||
Include="Mod/Part/App/AttachableObject.h" | ||
Namespace="Part" | ||
FatherInclude="Mod/Part/App/PartFeaturePy.h" | ||
FatherNamespace="Part"> | ||
<Documentation> | ||
<Author Licence="LGPL" Name="DeepSOIC" EMail="vv.titov@gmail.com" /> | ||
<UserDocu>This object represents an attachable object with OCC shape.</UserDocu> | ||
</Documentation> | ||
<Methode Name="positionBySupport"> | ||
<Documentation> | ||
<UserDocu>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.</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
</PythonExport> | ||
</GenerateModel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("<Part::AttachableObject>"); | ||
} | ||
|
||
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; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters