PositionConstraint.from_mesh

classmethod PositionConstraint.from_mesh(link_name, mesh, weight=1.0)

Create a class:PositionConstraint from a compas.datastructures.Mesh.

Parameters
  • link_name (str) – The name of the link this contraint refers to.

  • mesh (compas.datastructures.Mesh) – Mesh defining the bounding volume this constraint refers to.

  • weight (float) – A weighting factor for this constraint. Denotes relative importance to other constraints. Closer to zero means less important. Defaults to 1.

Returns

PositionConstraint

Examples

>>> from compas.datastructures import Mesh
>>> import compas
>>> mesh = Mesh.from_obj(compas.get('faces.obj'))
>>> pc = PositionConstraint.from_mesh('link_0', mesh)