PositionConstraint.from_mesh

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

Create a PositionConstraint from a compas.datastructures.Mesh.

Parameters:
link_namestr

The name of the link this contraint refers to.

meshcompas.datastructures.Mesh

Mesh defining the bounding volume this constraint refers to.

weightfloat

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)