Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Typedefs | Functions | Variables
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)
template<class Handle >
void | expose_module_handle (const char *_name)
template<class Module >
list | infolist (Module &_self)
template<class Mesh >
void | expose_decimater (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 >
void | defInitMod (class_< OpenMesh::VectorT< Scalar, 2 > > &classVector)
template<class Scalar >
void | defInitMod (class_< OpenMesh::VectorT< Scalar, 3 > > &classVector)
template<class Scalar >
void | defInitMod (class_< OpenMesh::VectorT< Scalar, 4 > > &classVector)
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

  Mesh | A Mesh type.

Parameters

  _self | The mesh instance that is to be used.
  _vhandles | The 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

  Mesh | A mesh type.
  OtherMesh | A mesh type.

Parameters

  _self | The mesh instance that is to be used.
  _other | The 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

  Circulator | A circulator type.

Parameters

  _name | The 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 26 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 16 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

  Iterator | An iterator type.
  n_items | A member function pointer that points to the mesh function that returns the number of items to iterate over (e.g. n_vertices).

Parameters

  _name | The 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

  Mesh | A mesh type.

Parameters

  _name | The 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

  PropHandle | A property handle type (e.g. VPropHandle<object>).
  IndexHandle | The appropriate handle type (e.g. VertexHandle for VPropHandle<object>).
  Iterator | A Python iterator type. This type is used to instantiate the propman_set_range function.

Parameters

  _name | The 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 60 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

  Class | A boost::python::class type.

Parameters

  _class | The 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

  Scalar | A scalar type.
  N | The dimension of the vector.

Parameters

  _name | The name of the vector type to be exposed.

Note
  N must be either 2, 3 or 4.

Definition at line 113 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

  Mesh | A Mesh type.

Parameters

  _self | The mesh instance that is to be used.
  _vh_to_update | The list of vertex handles to be updated.
  _hh_to_update | The list of halfedge handles to be updated.
  _fh_to_update | The list of face handles to be updated.
  _v | Remove deleted vertices?
  _e | Remove deleted edges?
  _f | Remove 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

  Mesh | A Mesh type.
  Circulator | A circulator type.
  CenterEntityHandle | The appropriate handle type.

Parameters

  _self | The mesh instance that is to be used.
  _handle | The 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

  PropertyManager | A property manager type.
  Mesh | A mesh type.

Parameters

  _mesh | The mesh that is used to check if the property exists.
  _propname | The 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

  PropertyManager | A property manager type.
  IndexHandle | The appropriate handle type.

Parameters

  _self | The property manager instance that is to be used.
  _handle | The 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

  PropertyManager | A property manager type.
  IndexHandle | The appropriate handle type.

Parameters

  _self | The property manager instance that is to be used.
  _handle | The index of the property value to be set.
  _value | The 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

  PropertyManager | A property manager type.
  Iterator | A Python iterator type.

Parameters

  _self | The property manager instance that is to be used.
  _it | An iterator that iterates over the items in the range.
  _value | The 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

  Mesh | A mesh type.
  PropHandle | A property handle type.
  IndexHandle | The appropriate handle type.

Parameters

  _self | The mesh instance that is to be used.
  _ph | The property that is to be set.
  _h | The handle of the item whose property is to be set.
  _value | The 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

  Mesh | A mesh type.
  PropHandle | A property handle type.

Parameters

  _self | The mesh instance that is to be used.
  _ph | The property that is to be set.
  _value | The 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

  Mesh | A mesh type.
  PropHandle | A handle type.

Parameters

  _self | The mesh instance that is to be used.
  _h | The handle of the item whose status is to be set.
  _info | The 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.