Sketcher::SketchPy Class Reference

The python export class for Sketch. More...

#include <SketchPy.h>

Inheritance diagram for Sketcher::SketchPy:
Base::PersistencePy Base::BaseClassPy Base::PyObjectBase

List of all members.

Public Types

typedef SketchPointerType

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.
PyObjectgetCustomAttributes (const char *attr) const
 getter method for special attributes (e.g. dynamic ones)
virtual PyParentObjectGetParents (void)
SketchgetSketchPtr (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 PyObjectPyMake (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



PyObjectaddConstraint (PyObject *args)
 implementer for the addConstraint() method
PyObjectaddGeometry (PyObject *args)
 implementer for the addGeometry() method
PyObjectclear (PyObject *args)
 implementer for the clear() method
PyObjectmovePoint (PyObject *args)
 implementer for the movePoint() method
PyObjectsolve (PyObject *args)
 implementer for the solve() method
static PyObjectstaticCallback_addConstraint (PyObject *self, PyObject *args)
 callback for the addConstraint() method
static PyObjectstaticCallback_addGeometry (PyObject *self, PyObject *args)
 callback for the addGeometry() method
static PyObjectstaticCallback_clear (PyObject *self, PyObject *args)
 callback for the clear() method
static PyObjectstaticCallback_movePoint (PyObject *self, PyObject *args)
 callback for the movePoint() method
static PyObjectstaticCallback_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 PyObjectstaticCallback_getConstraint (PyObject *self, void *closure)
 getter callback for the Constraint attribute
static PyObjectstaticCallback_getConstraints (PyObject *self, void *closure)
 getter callback for the Constraints attribute
static PyObjectstaticCallback_getGeometries (PyObject *self, void *closure)
 getter callback for the Geometries attribute
static PyObjectstaticCallback_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

Detailed Description

The python export class for Sketch.

Definition at line 20 of file SketchPy.h.


Member Typedef Documentation

Reimplemented from Base::PersistencePy.

Definition at line 36 of file SketchPy.h.


Constructor & Destructor Documentation

SketchPy::SketchPy ( Sketch pcObject,
PyTypeObject *  T = &Type 
)

Definition at line 652 of file SketchPy.cpp.

Referenced by PyMake().

SketchPy::~SketchPy (  ) 

Definition at line 661 of file SketchPy.cpp.


Member Function Documentation

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().

PyObject * SketchPy::addConstraint ( PyObject args  ) 
PyObject * SketchPy::addGeometry ( PyObject args  ) 

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.

PyObject * SketchPy::clear ( PyObject args  ) 

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.

PyObject * SketchPy::movePoint ( PyObject args  ) 

implementer for the movePoint() method

Definition at line 129 of file SketchPyImp.cpp.

References getSketchPtr(), Py::new_reference_to(), and Base::VectorPy::Type.

int SketchPy::PyInit ( PyObject ,
PyObject  
) [virtual]

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.

PyObject * SketchPy::PyMake ( struct _typeobject *  ,
PyObject ,
PyObject  
) [static]

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().

PyObject * SketchPy::solve ( PyObject args  ) 

implementer for the solve() method

Definition at line 63 of file SketchPyImp.cpp.

References getSketchPtr(), and Py::new_reference_to().

PyObject * SketchPy::staticCallback_addConstraint ( PyObject self,
PyObject args 
) [static]
PyObject * SketchPy::staticCallback_addGeometry ( PyObject self,
PyObject args 
) [static]
PyObject * SketchPy::staticCallback_clear ( PyObject self,
PyObject args 
) [static]
PyObject * SketchPy::staticCallback_getConstraint ( PyObject self,
void *  closure 
) [static]

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().

PyObject * SketchPy::staticCallback_getConstraints ( PyObject self,
void *  closure 
) [static]

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().

PyObject * SketchPy::staticCallback_getGeometries ( PyObject self,
void *  closure 
) [static]

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().

PyObject * SketchPy::staticCallback_getShape ( PyObject self,
void *  closure 
) [static]

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().

PyObject * SketchPy::staticCallback_movePoint ( PyObject self,
PyObject args 
) [static]
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().

PyObject * SketchPy::staticCallback_solve ( PyObject self,
PyObject args 
) [static]

Member Data Documentation

PyGetSetDef SketchPy::GetterSetter [static]
Initial value:
 {
    {"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]
Initial value:
 {
    {"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().


The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:02:47 2011 for FreeCAD by  doxygen 1.6.1