Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
OpenMesh::Python Namespace Reference

Classes

class  CirculatorWrapperT
 
class  IteratorWrapperT
 
struct  MeshTraits
 

Typedefs

typedef
OpenMesh::TriMesh_ArrayKernelT
< MeshTraits
TriMesh
 
typedef
OpenMesh::PolyMesh_ArrayKernelT
< MeshTraits
PolyMesh
 

Functions

void expose_items ()
 
void expose_handles ()
 
void expose_status_bits_and_info ()
 
 BOOST_PYTHON_MODULE (openmesh)
 
template<class Circulator , class CenterEntityHandle >
void expose_circulator (const char *_name)
 
void expose_io ()
 
template<class Iterator , size_t(OpenMesh::ArrayKernel::*)() const n_items>
void expose_iterator (const char *_name)
 
template<class Mesh , class IndexHandle >
void set_status (Mesh &_self, IndexHandle _h, const OpenMesh::Attributes::StatusInfo &_info)
 
template<class Mesh , class PropHandle , class IndexHandle >
void set_property (Mesh &_self, PropHandle _ph, IndexHandle _h, const object &_value)
 
template<class Mesh , class PropHandle >
void set_property (Mesh &_self, PropHandle _ph, const object &_value)
 
template<class Mesh , class OtherMesh >
void assign_connectivity (Mesh &_self, const OtherMesh &_other)
 
template<class Mesh , class Iterator , size_t(ArrayKernel::*)() const n_items>
IteratorWrapperT< Iterator,
n_items > 
get_iterator (Mesh &_self)
 
template<class Mesh , class Iterator , size_t(ArrayKernel::*)() const n_items>
IteratorWrapperT< Iterator,
n_items > 
get_skipping_iterator (Mesh &_self)
 
template<class Mesh , class Circulator , class CenterEntityHandle >
CirculatorWrapperT< Circulator,
CenterEntityHandle > 
get_circulator (Mesh &_self, CenterEntityHandle _handle)
 
template<class Mesh >
void garbage_collection (Mesh &_self, list &_vh_to_update, list &_hh_to_update, list &_fh_to_update, bool _v=true, bool _e=true, bool _f=true)
 
template<class Mesh >
FaceHandle add_face (Mesh &_self, const list &_vhandles)
 
template<class Class >
void expose_type_specific_functions (Class &_class)
 
template<>
void expose_type_specific_functions (class_< PolyMesh > &_class)
 
template<>
void expose_type_specific_functions (class_< TriMesh > &_class)
 
template<class Mesh >
void expose_mesh (const char *_name)
 
template<class PropertyManager , class IndexHandle >
object propman_get_item (PropertyManager &_self, IndexHandle _handle)
 
template<class PropertyManager , class IndexHandle >
void propman_set_item (PropertyManager &_self, IndexHandle _handle, object _value)
 
template<class PropertyManager , class Iterator >
void propman_set_range (PropertyManager &_self, Iterator _it, object _value)
 
template<class PropertyManager , class Mesh >
bool property_exists (Mesh &_mesh, const char *_propname)
 
template<class PropHandle , class IndexHandle , class Iterator >
void expose_property_manager (const char *_name)
 
template<class Vector , class Scalar >
void set_item (Vector &_vec, int _index, Scalar _value)
 
template<class Vector , class Scalar >
Scalar get_item (Vector &_vec, int _index)
 
template<class Scalar , int N>
void expose_vec (const char *_name)
 

Variables

const IO::Options::Flag FLAG_DEFAULT = IO::Options::Default
 
const IO::Options::Flag FLAG_BINARY = IO::Options::Binary
 
const IO::Options::Flag FLAG_MSB = IO::Options::MSB
 
const IO::Options::Flag FLAG_LSB = IO::Options::LSB
 
const IO::Options::Flag FLAG_SWAP = IO::Options::Swap
 
const IO::Options::Flag FLAG_VERTEXNORMAL = IO::Options::VertexNormal
 
const IO::Options::Flag FLAG_VERTEXCOLOR = IO::Options::VertexColor
 
const IO::Options::Flag FLAG_VERTEXTEXCOORD = IO::Options::VertexTexCoord
 
const IO::Options::Flag FLAG_EDGECOLOR = IO::Options::EdgeColor
 
const IO::Options::Flag FLAG_FACENORMAL = IO::Options::FaceNormal
 
const IO::Options::Flag FLAG_FACECOLOR = IO::Options::FaceColor
 
const IO::Options::Flag FLAG_FACETEXCOORD = IO::Options::FaceTexCoord
 
const IO::Options::Flag FLAG_COLORALPHA = IO::Options::ColorAlpha
 
const IO::Options::Flag FLAG_COLORFLOAT = IO::Options::ColorFloat
 

Detailed Description

This namespace contains classes and functions that are used to expose OpenMesh to Python.

Function Documentation

template<class Mesh >
FaceHandle OpenMesh::Python::add_face ( Mesh _self,
const list &  _vhandles 
)

Add a new face from a Python list of vertex handles.

Template Parameters
MeshA Mesh type.
Parameters
_selfThe mesh instance that is to be used.
_vhandlesThe list of vertex handles.

Definition at line 179 of file Mesh.hh.

template<class Mesh , class OtherMesh >
void OpenMesh::Python::assign_connectivity ( Mesh _self,
const OtherMesh &  _other 
)

Thin wrapper for assign_connectivity.

Template Parameters
MeshA mesh type.
OtherMeshA mesh type.
Parameters
_selfThe mesh instance that is to be used.
_otherThe mesh from which the connectivity is to be copied.

Definition at line 97 of file Mesh.hh.

template<class Circulator , class CenterEntityHandle >
void OpenMesh::Python::expose_circulator ( const char *  _name)

Expose a circulator type to Python.

Template Parameters
CirculatorA circulator type.
Parameters
_nameThe name of the circulator type to be exposed.
Note
Circulators are wrapped by CirculatorWrapperT before they are exposed to Python, i.e. they are not exposed directly. This means that circulators that are passed from Python to C++ are instances of CirculatorWrapperT.

Definition at line 86 of file Circulator.hh.

void OpenMesh::Python::expose_handles ( )

Expose item and property handles to Python.

Definition at line 25 of file Bindings.cc.

void OpenMesh::Python::expose_io ( )

Expose the input/output functions and options to Python.

Definition at line 30 of file InputOutput.hh.

void OpenMesh::Python::expose_items ( )

Expose mesh items to Python.

Definition at line 15 of file Bindings.cc.

template<class Iterator , size_t(OpenMesh::ArrayKernel::*)() const n_items>
void OpenMesh::Python::expose_iterator ( const char *  _name)

Expose an iterator type to Python.

Template Parameters
IteratorAn iterator type.
n_itemsA member function pointer that points to the mesh function that returns the number of items to iterate over (e.g. n_vertices).
Parameters
_nameThe name of the iterator type to be exposed.
Note
Iterators are wrapped by IteratorWrapperT before they are exposed to Python, i.e. they are not exposed directly. This means that iterators that are passed from Python to C++ are instances of IteratorWrapperT.

Definition at line 108 of file Iterator.hh.

template<class Mesh >
void OpenMesh::Python::expose_mesh ( const char *  _name)

Expose a mesh type to Python.

Template Parameters
MeshA mesh type.
Parameters
_nameThe name of the mesh type to be exposed.

Definition at line 303 of file Mesh.hh.

template<class PropHandle , class IndexHandle , class Iterator >
void OpenMesh::Python::expose_property_manager ( const char *  _name)

Expose a property manager type to Python.

This function template is used to expose property managers to Python. The template parameters are used to instantiate the appropriate property manager type.

Template Parameters
PropHandleA property handle type (e.g. VPropHandle<object>).
IndexHandleThe appropriate handle type (e.g. VertexHandle for VPropHandle<object>).
IteratorA Python iterator type. This type is used to instantiate the propman_set_range function.
Parameters
_nameThe name of the property manager type to be exposed.

Definition at line 97 of file PropertyManager.hh.

void OpenMesh::Python::expose_status_bits_and_info ( )

Expose the StatusBits enum and StatusInfo class to Python.

Definition at line 59 of file Bindings.cc.

template<class Class >
void OpenMesh::Python::expose_type_specific_functions ( Class &  _class)

This function template is used to expose mesh member functions that are only available for a specific type of mesh (i.e. they are available for polygon meshes or triangle meshes, but not both).

Template Parameters
ClassA boost::python::class type.
Parameters
_classThe boost::python::class instance for which the member functions are to be defined.

Definition at line 200 of file Mesh.hh.

template<>
void OpenMesh::Python::expose_type_specific_functions ( class_< PolyMesh > &  _class)

Function template specialization for polygon meshes.

Definition at line 208 of file Mesh.hh.

template<>
void OpenMesh::Python::expose_type_specific_functions ( class_< TriMesh > &  _class)

Function template specialization for triangle meshes.

Definition at line 247 of file Mesh.hh.

template<class Scalar , int N>
void OpenMesh::Python::expose_vec ( const char *  _name)

Expose a vector type to Python.

This function template is used to expose vectors to Python. The template parameters are used to instantiate the appropriate vector type.

Template Parameters
ScalarA scalar type.
NThe dimension of the vector.
Parameters
_nameThe name of the vector type to be exposed.
Note
N must be either 2, 3 or 4.

Definition at line 55 of file Vector.hh.

template<class Mesh >
void OpenMesh::Python::garbage_collection ( Mesh _self,
list &  _vh_to_update,
list &  _hh_to_update,
list &  _fh_to_update,
bool  _v = true,
bool  _e = true,
bool  _f = true 
)

Garbage collection using lists instead of vectors to keep track of a set of handles.

Template Parameters
MeshA Mesh type.
Parameters
_selfThe mesh instance that is to be used.
_vh_to_updateThe list of vertex handles to be updated.
_hh_to_updateThe list of halfedge handles to be updated.
_fh_to_updateThe list of face handles to be updated.
_vRemove deleted vertices?
_eRemove deleted edges?
_fRemove deleted faces?

Definition at line 147 of file Mesh.hh.

template<class Mesh , class Circulator , class CenterEntityHandle >
CirculatorWrapperT<Circulator, CenterEntityHandle> OpenMesh::Python::get_circulator ( Mesh _self,
CenterEntityHandle  _handle 
)

Get a circulator.

Template Parameters
MeshA Mesh type.
CirculatorA circulator type.
CenterEntityHandleThe appropriate handle type.
Parameters
_selfThe mesh instance that is to be used.
_handleThe handle of the item to circulate around.

Definition at line 128 of file Mesh.hh.

template<class Mesh , class Iterator , size_t(ArrayKernel::*)() const n_items>
IteratorWrapperT<Iterator, n_items> OpenMesh::Python::get_iterator ( Mesh _self)

Get an iterator.

Definition at line 105 of file Mesh.hh.

template<class Mesh , class Iterator , size_t(ArrayKernel::*)() const n_items>
IteratorWrapperT<Iterator, n_items> OpenMesh::Python::get_skipping_iterator ( Mesh _self)

Get a skipping iterator.

Definition at line 113 of file Mesh.hh.

template<class PropertyManager , class Mesh >
bool OpenMesh::Python::property_exists ( Mesh _mesh,
const char *  _propname 
)

Thin wrapper for propertyExists.

Template Parameters
PropertyManagerA property manager type.
MeshA mesh type.
Parameters
_meshThe mesh that is used to check if the property exists.
_propnameThe name of the property.

Definition at line 77 of file PropertyManager.hh.

template<class PropertyManager , class IndexHandle >
object OpenMesh::Python::propman_get_item ( PropertyManager &  _self,
IndexHandle  _handle 
)

Implementation of Python's __getitem__ magic method.

Template Parameters
PropertyManagerA property manager type.
IndexHandleThe appropriate handle type.
Parameters
_selfThe property manager instance that is to be used.
_handleThe index of the property value to be returned.
Returns
The requested property value.

Definition at line 24 of file PropertyManager.hh.

template<class PropertyManager , class IndexHandle >
void OpenMesh::Python::propman_set_item ( PropertyManager &  _self,
IndexHandle  _handle,
object  _value 
)

Implementation of Python's __setitem__ magic method.

Template Parameters
PropertyManagerA property manager type.
IndexHandleThe appropriate handle type.
Parameters
_selfThe property manager instance that is to be used.
_handleThe index of the property value to be set.
_valueThe property value to be set.

Definition at line 39 of file PropertyManager.hh.

template<class PropertyManager , class Iterator >
void OpenMesh::Python::propman_set_range ( PropertyManager &  _self,
Iterator  _it,
object  _value 
)

Conveniently set the property value for an entire range of mesh items using a Python iterator.

Template Parameters
PropertyManagerA property manager type.
IteratorA Python iterator type.
Parameters
_selfThe property manager instance that is to be used.
_itAn iterator that iterates over the items in the range.
_valueThe value the range will be set to.

Definition at line 55 of file PropertyManager.hh.

template<class Mesh , class PropHandle , class IndexHandle >
void OpenMesh::Python::set_property ( Mesh _self,
PropHandle  _ph,
IndexHandle  _h,
const object &  _value 
)

Set the value of a property of an item.

Template Parameters
MeshA mesh type.
PropHandleA property handle type.
IndexHandleThe appropriate handle type.
Parameters
_selfThe mesh instance that is to be used.
_phThe property that is to be set.
_hThe handle of the item whose property is to be set.
_valueThe value to be set.

Depending on OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::property may return by value instead of reference. This function ensures that the property value of an item can be changed nonetheless.

Definition at line 64 of file Mesh.hh.

template<class Mesh , class PropHandle >
void OpenMesh::Python::set_property ( Mesh _self,
PropHandle  _ph,
const object &  _value 
)

Set the value of a mesh property.

Template Parameters
MeshA mesh type.
PropHandleA property handle type.
Parameters
_selfThe mesh instance that is to be used.
_phThe property that is to be set.
_valueThe value to be set.

Depending on OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::property may return by value instead of reference. This function ensures that the property value of an item can be changed nonetheless.

Definition at line 83 of file Mesh.hh.

template<class Mesh , class IndexHandle >
void OpenMesh::Python::set_status ( Mesh _self,
IndexHandle  _h,
const OpenMesh::Attributes::StatusInfo _info 
)

Set the status of an item.

Template Parameters
MeshA mesh type.
PropHandleA handle type.
Parameters
_selfThe mesh instance that is to be used.
_hThe handle of the item whose status is to be set.
_infoThe status to be set.

Depending on OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::status may return by value instead of reference. This function ensures that the status of an item can be changed nonetheless.

Definition at line 43 of file Mesh.hh.