The python export class for Sketch. More...
#include <SketchPy.h>
Public Types | |
typedef Sketch * | PointerType |
Public Member Functions | |
PyObject * | _getattr (char *attr) |
GetAttribute implementation This method implements the retriavel of object attributes. | |
virtual PyObject * | _repr (void) |
_repr method Overide this method to return a string object with some invormation about the object. | |
int | _setattr (char *attr, PyObject *value) |
SetAttribute implementation This method implements the seting of object attributes. | |
PyObject * | getCustomAttributes (const char *attr) const |
getter method for special attributes (e.g. dynamic ones) | |
virtual PyParentObject * | GetParents (void) |
Sketch * | getSketchPtr (void) const |
getter for the object handled by this class | |
virtual PyTypeObject * | GetType (void) |
virtual int | PyInit (PyObject *args, PyObject *k) |
PyInit method Overide this method to initialize a newly created instance of the class (Constuctor). | |
std::string | representation (void) const |
int | setCustomAttributes (const char *attr, PyObject *obj) |
setter for special attributes (e.g. dynamic ones) | |
SketchPy (Sketch *pcObject, PyTypeObject *T=&Type) | |
~SketchPy () | |
Static Public Member Functions | |
static PyObject * | PyMake (struct _typeobject *, PyObject *, PyObject *) |
Static Public Attributes | |
static PyGetSetDef | GetterSetter [] |
Attribute structure of SketchPy. | |
static PyMethodDef | Methods [] |
Methods structure of SketchPy. | |
static PyParentObject | Parents [] = { PARENTSSketcherSketchPy } |
static PyTypeObject | Type |
Type structure of SketchPy. | |
callbacks and implementers for the python object methods | |
| |
PyObject * | addConstraint (PyObject *args) |
implementer for the addConstraint() method | |
PyObject * | addGeometry (PyObject *args) |
implementer for the addGeometry() method | |
PyObject * | clear (PyObject *args) |
implementer for the clear() method | |
PyObject * | movePoint (PyObject *args) |
implementer for the movePoint() method | |
PyObject * | solve (PyObject *args) |
implementer for the solve() method | |
static PyObject * | staticCallback_addConstraint (PyObject *self, PyObject *args) |
callback for the addConstraint() method | |
static PyObject * | staticCallback_addGeometry (PyObject *self, PyObject *args) |
callback for the addGeometry() method | |
static PyObject * | staticCallback_clear (PyObject *self, PyObject *args) |
callback for the clear() method | |
static PyObject * | staticCallback_movePoint (PyObject *self, PyObject *args) |
callback for the movePoint() method | |
static PyObject * | staticCallback_solve (PyObject *self, PyObject *args) |
callback for the solve() method | |
callbacks and implementers for the python object attributes | |
| |
Py::Int | getConstraint (void) const |
getter for the Constraint attribute | |
Py::Tuple | getConstraints (void) const |
getter for the Constraints attribute | |
Py::Tuple | getGeometries (void) const |
getter for the Geometries attribute | |
Py::Object | getShape (void) const |
getter for the Shape attribute | |
static PyObject * | staticCallback_getConstraint (PyObject *self, void *closure) |
getter callback for the Constraint attribute | |
static PyObject * | staticCallback_getConstraints (PyObject *self, void *closure) |
getter callback for the Constraints attribute | |
static PyObject * | staticCallback_getGeometries (PyObject *self, void *closure) |
getter callback for the Geometries attribute | |
static PyObject * | staticCallback_getShape (PyObject *self, void *closure) |
getter callback for the Shape attribute | |
static int | staticCallback_setConstraint (PyObject *self, PyObject *value, void *closure) |
setter callback for the Constraint attribute | |
static int | staticCallback_setConstraints (PyObject *self, PyObject *value, void *closure) |
setter callback for the Constraints attribute | |
static int | staticCallback_setGeometries (PyObject *self, PyObject *value, void *closure) |
setter callback for the Geometries attribute | |
static int | staticCallback_setShape (PyObject *self, PyObject *value, void *closure) |
setter callback for the Shape attribute |
The python export class for Sketch.
Definition at line 20 of file SketchPy.h.
typedef Sketch* Sketcher::SketchPy::PointerType |
Reimplemented from Base::PersistencePy.
Definition at line 36 of file SketchPy.h.
Definition at line 652 of file SketchPy.cpp.
Referenced by PyMake().
SketchPy::~SketchPy | ( | ) |
Definition at line 661 of file SketchPy.cpp.
PyObject * SketchPy::_getattr | ( | char * | attr | ) | [virtual] |
GetAttribute implementation This method implements the retriavel of object attributes.
If you want to implement attributes in your class, reimplement this method. You have to call the method of the base class. Note: if you reimplement _gettattr() in a inheriting class you need to call the method of the base class! Otherwise even the methods of the object will disapiear!
Reimplemented from Base::PersistencePy.
Definition at line 676 of file SketchPy.cpp.
References Base::Console(), getCustomAttributes(), Methods, Base::Exception::ReportException(), and Base::Exception::what().
PyObject * SketchPy::_repr | ( | void | ) | [virtual] |
_repr method Overide this method to return a string object with some invormation about the object.
PyObject *MeshFeaturePy::_repr(void) { std::stringstream a; a << "MeshFeature: [ "; a << "some realy important info about the object!"; a << "]" << std::endl; return Py_BuildValue("s", a.str().c_str()); }
Reimplemented from Base::PersistencePy.
Definition at line 668 of file SketchPy.cpp.
References representation().
int SketchPy::_setattr | ( | char * | attr, | |
PyObject * | value | |||
) | [virtual] |
SetAttribute implementation This method implements the seting of object attributes.
If you want to implement attributes in your class, reimplement this method. You have to call the method of the base class.
Reimplemented from Base::PersistencePy.
Definition at line 744 of file SketchPy.cpp.
References Base::Console(), Base::Exception::ReportException(), setCustomAttributes(), and Base::Exception::what().
implementer for the addConstraint() method
Definition at line 81 of file SketchPyImp.cpp.
References Sketcher::Sketch::addConstraint(), Sketcher::Sketch::addConstraints(), draftlibs::dxfReader::error(), Sketcher::ConstraintPy::getConstraintPtr(), getSketchPtr(), Py::new_reference_to(), and Sketcher::ConstraintPy::Type.
implementer for the addGeometry() method
Definition at line 68 of file SketchPyImp.cpp.
References Part::GeomLineSegment::clone(), getSketchPtr(), Py::new_reference_to(), and Py_Return.
implementer for the clear() method
Definition at line 120 of file SketchPyImp.cpp.
References getSketchPtr(), and Py::new_reference_to().
Py::Int SketchPy::getConstraint | ( | void | ) | const |
getter for the Constraint attribute
Definition at line 143 of file SketchPyImp.cpp.
Referenced by staticCallback_getConstraint().
Py::Tuple SketchPy::getConstraints | ( | void | ) | const |
getter for the Constraints attribute
Definition at line 149 of file SketchPyImp.cpp.
Referenced by staticCallback_getConstraints().
PyObject * SketchPy::getCustomAttributes | ( | const char * | attr | ) | const |
getter method for special attributes (e.g. dynamic ones)
Reimplemented from Base::PersistencePy.
Definition at line 169 of file SketchPyImp.cpp.
Referenced by _getattr().
Py::Tuple SketchPy::getGeometries | ( | void | ) | const |
getter for the Geometries attribute
Definition at line 155 of file SketchPyImp.cpp.
References Sketcher::Sketch::getPyGeometry(), and getSketchPtr().
Referenced by staticCallback_getGeometries().
virtual PyParentObject* Sketcher::SketchPy::GetParents | ( | void | ) | [inline, virtual] |
Reimplemented from Base::PersistencePy.
Definition at line 28 of file SketchPy.h.
Py::Object SketchPy::getShape | ( | void | ) | const |
getter for the Shape attribute
Definition at line 160 of file SketchPyImp.cpp.
References getSketchPtr().
Referenced by staticCallback_getShape().
Sketch * SketchPy::getSketchPtr | ( | void | ) | const |
getter for the object handled by this class
Definition at line 803 of file SketchPy.cpp.
References Base::PyObjectBase::_pcTwinPointer.
Referenced by addConstraint(), addGeometry(), clear(), getGeometries(), getShape(), movePoint(), and solve().
virtual PyTypeObject* Sketcher::SketchPy::GetType | ( | void | ) | [inline, virtual] |
Reimplemented from Base::PersistencePy.
Definition at line 27 of file SketchPy.h.
implementer for the movePoint() method
Definition at line 129 of file SketchPyImp.cpp.
References getSketchPtr(), Py::new_reference_to(), and Base::VectorPy::Type.
PyInit method Overide this method to initialize a newly created instance of the class (Constuctor).
Reimplemented from Base::PersistencePy.
Definition at line 56 of file SketchPyImp.cpp.
Reimplemented from Base::PersistencePy.
Definition at line 49 of file SketchPyImp.cpp.
References SketchPy().
std::string SketchPy::representation | ( | void | ) | const |
Reimplemented from Base::PersistencePy.
Definition at line 44 of file SketchPyImp.cpp.
Referenced by _repr().
int SketchPy::setCustomAttributes | ( | const char * | attr, | |
PyObject * | obj | |||
) |
setter for special attributes (e.g. dynamic ones)
Reimplemented from Base::PersistencePy.
Definition at line 174 of file SketchPyImp.cpp.
Referenced by _setattr().
implementer for the solve() method
Definition at line 63 of file SketchPyImp.cpp.
References getSketchPtr(), and Py::new_reference_to().
callback for the addConstraint() method
Definition at line 289 of file SketchPy.cpp.
References Base::Console(), Base::PyObjectBase::isConst(), Base::PyObjectBase::isValid(), Base::PyObjectBase::PyObjectBase(), Base::Exception::ReportException(), and Base::Exception::what().
callback for the addGeometry() method
Definition at line 213 of file SketchPy.cpp.
References Base::Console(), Base::PyObjectBase::isConst(), Base::PyObjectBase::isValid(), Base::PyObjectBase::PyObjectBase(), Base::Exception::ReportException(), and Base::Exception::what().
callback for the clear() method
Definition at line 365 of file SketchPy.cpp.
References Base::Console(), Base::PyObjectBase::isConst(), Base::PyObjectBase::isValid(), Base::PyObjectBase::PyObjectBase(), Base::Exception::ReportException(), and Base::Exception::what().
getter callback for the Constraint attribute
Definition at line 517 of file SketchPy.cpp.
References getConstraint(), Base::PyObjectBase::isValid(), Py::new_reference_to(), and Base::PyObjectBase::PyObjectBase().
getter callback for the Constraints attribute
Definition at line 549 of file SketchPy.cpp.
References getConstraints(), Base::PyObjectBase::isValid(), Py::new_reference_to(), and Base::PyObjectBase::PyObjectBase().
getter callback for the Geometries attribute
Definition at line 581 of file SketchPy.cpp.
References getGeometries(), Base::PyObjectBase::isValid(), Py::new_reference_to(), and Base::PyObjectBase::PyObjectBase().
getter callback for the Shape attribute
Definition at line 613 of file SketchPy.cpp.
References getShape(), Base::PyObjectBase::isValid(), Py::new_reference_to(), and Base::PyObjectBase::PyObjectBase().
callback for the movePoint() method
Definition at line 441 of file SketchPy.cpp.
References Base::Console(), Base::PyObjectBase::isConst(), Base::PyObjectBase::isValid(), Base::PyObjectBase::PyObjectBase(), Base::Exception::ReportException(), and Base::Exception::what().
int SketchPy::staticCallback_setConstraint | ( | PyObject * | self, | |
PyObject * | value, | |||
void * | closure | |||
) | [static] |
setter callback for the Constraint attribute
Definition at line 535 of file SketchPy.cpp.
References Base::PyObjectBase::isValid(), and Base::PyObjectBase::PyObjectBase().
int SketchPy::staticCallback_setConstraints | ( | PyObject * | self, | |
PyObject * | value, | |||
void * | closure | |||
) | [static] |
setter callback for the Constraints attribute
Definition at line 567 of file SketchPy.cpp.
References Base::PyObjectBase::isValid(), and Base::PyObjectBase::PyObjectBase().
int SketchPy::staticCallback_setGeometries | ( | PyObject * | self, | |
PyObject * | value, | |||
void * | closure | |||
) | [static] |
setter callback for the Geometries attribute
Definition at line 599 of file SketchPy.cpp.
References Base::PyObjectBase::isValid(), and Base::PyObjectBase::PyObjectBase().
int SketchPy::staticCallback_setShape | ( | PyObject * | self, | |
PyObject * | value, | |||
void * | closure | |||
) | [static] |
setter callback for the Shape attribute
Definition at line 631 of file SketchPy.cpp.
References Base::PyObjectBase::isValid(), and Base::PyObjectBase::PyObjectBase().
callback for the solve() method
Definition at line 137 of file SketchPy.cpp.
References Base::Console(), Base::PyObjectBase::isConst(), Base::PyObjectBase::isValid(), Base::PyObjectBase::PyObjectBase(), Base::Exception::ReportException(), and Base::Exception::what().
PyGetSetDef SketchPy::GetterSetter [static] |
{ {"Constraint", (getter) staticCallback_getConstraint, (setter) staticCallback_setConstraint, "0: exactly constraint, -1 under-constraint, 1 over-constraint", NULL }, {"Constraints", (getter) staticCallback_getConstraints, (setter) staticCallback_setConstraints, "Tuple of all constrains in this sketch", NULL }, {"Geometries", (getter) staticCallback_getGeometries, (setter) staticCallback_setGeometries, "Tuple of all geometric elements in this sketch", NULL }, {"Shape", (getter) staticCallback_getShape, (setter) staticCallback_setShape, "Resulting shape from the sketch geometry", NULL }, {NULL, NULL, NULL, NULL, NULL} }
Attribute structure of SketchPy.
Reimplemented from Base::PersistencePy.
Definition at line 25 of file SketchPy.h.
PyMethodDef SketchPy::Methods [static] |
{ {"solve", (PyCFunction) staticCallback_solve, METH_VARARGS, "solve the actuall set of geometry and constraints" }, {"addGeometry", (PyCFunction) staticCallback_addGeometry, METH_VARARGS, "add a geometric object to the sketch" }, {"addConstraint", (PyCFunction) staticCallback_addConstraint, METH_VARARGS, "add an constraint object to the sketch" }, {"clear", (PyCFunction) staticCallback_clear, METH_VARARGS, "clear the sketch" }, {"movePoint", (PyCFunction) staticCallback_movePoint, METH_VARARGS, "\n movePoint(GeoIndex,PointPos,Vector,[relative]) - move a given point (or curve)\n to another location.\n It moves the specified point (or curve) to the given location by adding some\n temporary weak constraints and solve the sketch.\n This method is mostly used to allow the user to drag some portions of the sketch\n in real time by e.g. the mouse and it works only for underconstrained portions of\n the sketch.\n The argument 'relative', if present, states if the new location is given\n relatively to the current one.\n " }, {NULL, NULL, 0, NULL} }
Methods structure of SketchPy.
Reimplemented from Base::PersistencePy.
Definition at line 24 of file SketchPy.h.
Referenced by _getattr().
PyParentObject SketchPy::Parents = { PARENTSSketcherSketchPy } [static] |
Reimplemented from Base::PersistencePy.
Definition at line 26 of file SketchPy.h.
PyTypeObject SketchPy::Type [static] |
Type structure of SketchPy.
Reimplemented from Base::PersistencePy.
Definition at line 23 of file SketchPy.h.
Referenced by initSketcher().