Model.morphconstraintcreateeq#
- Model.morphconstraintcreateeq(ncollection, type, name, vec, function, distance, ivec, meth, oid, color)#
This function will create a constraint for the nodes in the collection which positions the nodes on or a specified distance away from the surface of the function. The
functioncan 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.If
meth=1,oidwill specify the origin node and the global system will be used for the x, y, and z directions.If
meth=2,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 to be 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
name (hwString) – The name of the morph constraint to create.
vec (hwTriple) – The hwTriple object defining the vector. User can also supply a Python list of three doubles.
function (hwString) – The string containing a surface definition function f(x,y,z)
distance (double) – The distance the nodes must remain away from the surface of the function (
type1 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) – The ID of a node (for
methset to 1) or a system (formethset to 2).color (int) – The color of the constraint. Valid values are 1-64.
Examples#
Create 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.morphconstraintcreateeq( ncollection=hm.Collection(model, ent.Node), type=0, name="sph", 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, )
Create 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.morphconstraintcreateeq( ncollection=hm.Collection(model, ent.Node), type=1, name="sph", 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, )