Model.morphmaptoequationvecoffset#
- Model.morphmaptoequationvecoffset(collection_nodes, collection_handles, equation, origin, origin_id, use_symmetry, use_constraints, project, vector, mode, offset)#
Maps nodes to, or offset from, an equation using the temporary shape created by
Model.morphmaptshp()andModel.morphmaptshpedge()as a guide. Selected handles can optionally follow behind the morphing operation.Nodes can be projected on to the equation along a vector, normal to the surface of the equation, or normal to the shell elements attached to the nodes.
- Parameters:
collection_nodes (Collection) – The collection containing the node entities.
collection_handles (Collection) – The collection containing the following handle entities.
equation (hwString) – String containing an equation f(x,y,z). The equation 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.
origin (int) –
0 - Use global origin and system
1 - Use global system with node ID = origin_id as the origin
2 - Use local system with ID = origin_id as the origin and system
origin_id (unsigned int) – The ID of node or system specified in origin. Ignored if origin is 0.
use_symmetry (int) –
0 - Do not use symmetry links
1 - Use symmetry links
use_constraints (int) –
0 - Do not use constraints
1 - Use constraints
project (int) –
0 or 10 - Project along vector defined by vector_id
1 or 11 - Project normal to surface of equation
2 or 12 - Project normal to attached shell elements
If
offsetis non-zero, the offset will be measured from the closest point on the equation for values of 0, 1 and 2. The offset will be measured along the projection vector or normal for values of 10, 11, and 12.vector (hwTriple) – The hwTriple object defining the vector components for the projection direction. User can also supply a Python list of three doubles.
mode (int) –
0 - If
Model.morphmaprecalc()has been used to calculate new influences1 - To recalculate new influences inside this function
offset (double) –
The distance to offset nodes from the target.
The offset will be measured from the closest point on the equation for values of
projectof 0, 1, and 2.The offset will be measured along the projection vector normal for values of
projectof 10, 11, and 12.
Examples#
Translate node with ID 1, 5.0 units along the y - axis#import hm import hm.entities as ent model = hm.Model() model.morphmaptoequationvecoffset( collection_nodes=hm.Collection(model, ent.Node), collection_handles=hm.CollectionByInteractiveSelection(model, ent.Handle), equation="x*x+y*y+z*z-100.0", origin=0, origin_id=0, use_symmetry=1, use_constraints=1, project=1, vector=[1.0, 0.0, 0.0], mode=1, offset=1.2, )
Map all nodes to a sphere of radius 10.0 positioned at a system along a vector#import hm import hm.entities as ent model = hm.Model() model.morphmaptoequationvecoffset( collection_nodes=hm.Collection(model, ent.Node), collection_handles=hm.CollectionByInteractiveSelection(model, ent.Handle), equation="x*x+y*y+z*z-100.0", origin=2, origin_id=1, use_symmetry=1, use_constraints=1, project=0, vector=[1.0, 0.0, 0.0], mode=1, offset=0.0, )