Model.morphconstraintcreateavm#

Model.morphconstraintcreateavm(scollection, ecollection, type, name, target, bound, color)#

Creates a model type constraint for the elements in the collection with the option of having the area, volume, or mass forced to be greater than, less than, or equal to the specified value.

The shapes on the collection will be used to force the model into compliance with the specified constraint if possible.

Parameters:
  • scollection (Collection) – The collection containing the input shape entities.

  • ecollection (Collection) – The collection containing the input element entities.

  • type (int) –

    0 - Area

    1 - Volume

    2 - Mass

  • name (hwString) – The name of the morph constraint.

  • target (double) – The constrained value for area, volume, or mass.

  • bound (int) –

    -1 - Greater than specified target

    0 - Equal to specified target

    1 - Less than specified target

  • color (int) – The color of the constraint. Valid values are 1-64.

Example#

Create a constraint named “ area “ where the area is specified to be exactly 3600.0#
import hm
import hm.entities as ent

model = hm.Model()

shapes = hm.CollectionByInteractiveSelection(model, ent.Shape
elems = hm.CollectionByInteractiveSelection(model, ent.Element)

model.morphconstraintcreateavm(
    scollection=shapes),
    ecollection=elems,
    type=0,
    name="area",
    target=3600.0,
    bound=0,
    color=32,
)