Model.morphconstraintcreatelength#
- Model.morphconstraintcreatelength(scollection, type, name, nodes, vec, length, bound, color)#
Creates a model type constraint for the selected nodes with the option of having those nodes measured node to node or along a vector and the option of having the node list forced to be greater than, less than, or equal to the specified length.
If possible, the shapes on the collection will be used to force the model into compliance with the specified constraint.
- Parameters:
scollection (Collection) – The collection containing the shape entities.
type (int) –
0 - Measure length node to node
1 - Measure length using vector
name (hwString) – The name of the morph constraint.
nodes (EntityList) – The list containing the node entities.
vec (hwTriple) – The hwTriple object defining the vector. User can also supply a Python list of three doubles.
length (double) – Constrained length of node list.
bound (int) –
-1 - Greater than specified length
0 - Equal to specified length
1 - Less than specified length
color (int) – The color of the constraint. Valid values are 1-64.
Example#
Create a model type constraint based on the length of a list of nodes#import hm import hm.entities as ent model = hm.Model() model.morphconstraintcreatelength( scollection=hm.CollectionByInteractiveSelection(model, ent.Shape), type=0, name="length", nodes=[ent.Node(model, 1), ent.Node(model, 2)], vec=[1.0, 0.0, 0.0], length=43.5, bound=0, color=32, )