Model.morphconstraintupdateeq#
- Model.morphconstraintupdateeq(ncollection, type, mcon, vec, function, distance, ivec, meth, oid, color)#
Updates a constraint for the nodes on the collection which positions the nodes on or a specified distance away from the surface of the function. The function can contain x, y, and z variables but should not contain an equals sign. The surface of the function is located where the value of the function equals zero. The function will be positioned at the global origin if
meth=0. Ifmeth=0,oidwill specify the origin node and the global system will be used for the x, y, and z directions. Ifmeth=0,oidwill specify the local system to be used for the origin and x, y, and z.typedetermines if the nodes move along the surface of the function, are bounded by the surface of the function, remain a set distance from the surface of the function, or maintain their original distance from the surface of the function.To enable mesh stretching, add 32 to the type (thus 1, 3, and 5 become 33, 35, and 37).
- Parameters:
ncollection (Collection) – The collection containing the node entities taht are constrained.
type (int) –
0 - Moves along the surface of the function
1 - Bounded by the surface of the function
3 - Remains a set distance from the surface of the function
5 - Maintains its original distance from the surface of the function
+32 - Enables mesh stretching around constrained nodes
mcon (Entity) – The ID of the morph constraint to update.
vec (hwTriple) – The hwTriple object defining the vector components. User can also supply a Python list of three doubles.
function (hwString) – String containing a surface definition function f(x,y,z)
distance (double) – Distance nodes must remain away from the surface of the function (type 1 and 3 only).
ivec (int) –
0 - Project normal to function
1 - Project along vector vector
meth (int) –
0 - Use global origin and system
1 - Use global system with node ID oid as the origin
2 - Use local system with ID oid as the origin and system
oid (unsigned int) – ID of node or system specified in meth.
color (int) – The color of the constraint. Valid values are 1-64.
Examples#
Update a constraint where all nodes move along the surface of a sphere and are projected normal to the sphere#import hm import hm.entities as ent model = hm.Model() model.morphconstraintupdateeq( ncollection=hm.Collection(model, ent.Node), type=0, mcon=ent.Morphconstraint(model, 12), vec=[1.0, 0.0, 0.0], function="x*x+y*y+z*z-100.0", distance=0.0, ivec=0, meth=0, oid=0, color=11, )
Update a constraint where all nodes are bounded by the sphere by a distance of 2.0 , projected along a vector , and use a local system to orient the sphere#import hm import hm.entities as ent model = hm.Model() model.morphconstraintupdateeq( ncollection=hm.Collection(model, ent.Node), type=1, mcon=ent.Morphconstraint(model, 12), vec=[1.0, 0.0, 0.0], function="x*x+y*y+z*z-100.0", distance=2.0, ivec=1, meth=2, oid=1, color=11, )