PositionConstraint.from_box

classmethod PositionConstraint.from_box(link_name, box, weight=1.0)[source]

Create a PositionConstraint from a compas.geometry.Box.

Parameters:
link_name: :obj:`str`

The name of the link this contraint refers to.

boxcompas.geometry.Box

Box defining the bounding volume this constraint refers to.

weightfloat, optional

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.geometry import Frame
>>> from compas.geometry import Box
>>> box = Box(4, 4, 4, Frame.worldXY())
>>> pc = PositionConstraint.from_box('link_0', box)