Model.morphnodesequaoffset#
- Model.morphnodesequaoffset(m_collection, e_collection, f_collection, equation, ori, oid, nproj, c_vec, integ, mbias, fbias, envelope, undisplayed, offset)#
Moves the selected nodes to the surface of the function either normal to the surface of the function, along a vector, or normal to the elements attached to the nodes. The fixed nodes are held in place and the affected elements (or all unfixed nodes in the model if
integis 3, 6 or 7) are stretched according to the value ofinteg.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
ori=0. Ifori=1, oid will specify the origin node and the global system will be used for the x, y, and z directions. Ifori=2,oidwill specify the local system to be used for the origin and x, y, and z.Temporary handles are created for all moving and fixed nodes to determine the stretching of the affected elements. If
integ=0, a general domain is temporarily created for the affected elements. Ifinteg=1, the domains currently in the model are used. Ifinteg=2, 1D, 2D, 3D, and edge domains are temporarily created for the affected elements but the 2D domains are not partitioned. Ifinteg=3, then handle influences are applied using a spatial relationship rather than through a domain. Ifinteg=4, only the selected moving nodes are moved and all others are held fixed. Ifinteg=5, 1D, 2D, 3D, and edge domains are temporarily created for the affected elements and the 2D domains are partitioned. Any handles created due to partitioning are moved based on their distance from the moving and fixed nodes. Ifinteg=6, then handle influences are applied using the Kriging algorithm. Ifinteg=7, then handle influences extend only up to a given distance (ifenvelope>0) or a given multiple of the applied perturbations (ifenvelope<0) away from the moving nodes.The bias factors function as they would for handles except that all moving nodes will have the
mbiasvalue and all fixed nodes will have thefbiasvalue.If no elements are selected and
nprojis 2, 5 or 6, all elements in the model are used to determine projection vectors.If
integis set to 3, 6, or 7, nodes on undisplayed elements and components can be morphed, fixed, or excluded depending on the value ofundisplayed.If
offsetis non-zero, the moving nodes will be offset from the surface of the equation by the specified amount.- Parameters:
m_collection (Collection) – The collection containing the moving node entities.
e_collection (Collection) – The collection containing the affected element entities.
f_collection (Collection) – The collection containing the fixed node entities.
equation (hwString) – String containing an equation f(x,y,z).
ori (int) –
0 - Use global origin and system
1 - Use global system with node ID =
oidas the origin2 - Use local system with ID =
oidas the origin and systemoid (unsigned int) – ID of node or system specified in
ori.nproj (int) –
0 - Project along vector given by
c_vec1 - Project normal to surface of function.
2 - Project normal to attached shell elements
5 - Project normal to attached elements using smoothed normals
6 - Project normal to elements using CFD corners
c_vec (hwTriple) – The hwTriple object defining the vector components (
nproj=0). User can also supply a Python list of three doubles.integ (int) –
0 - Free edges (a single general domain)
1 - Use existing domains
2 - Inferred edges (1D, 2D, 3D, and edge domains - no partitioning)
3 - Morph all nodes using a proximity algorithm
4 - Morph all moving nodes and fix the unselected nodes
5 - Partitioned edges (1D, 2D, 3D, and edge domains with partitioning)
6 - Morph all nodes using the Kriging algorithm
7 - Morph all nodes within an envelope around the moving nodes
mbias (double) – Bias factor for moving nodes on affected elements.
fbias (double) – Bias factor for fixed nodes on affected elements.
envelope (double) –
If positive, all nodes beyond the given distance away from the moving nodes will be fixed.
If negative, all nodes beyond a distance calculated by multiplying the total perturbation of each moving node by the absolute value of the envelope and extended away from each moving node will be fixed.
If
integis set to 7, the calculated distance defines an envelope around the moving nodes within which the morphing of those nodes will linearly taper from fully matching the nearest moving node to zero at the edge of the envelope. If any fixed nodes are within the envelope they will also reduce the morphing of nearby nodes.undisplayed (int) –
If
integis set to 3, 6, or 7, nodes which are not displayed can be affected by the morphing. This defines how undisplayed nodes are handled:0 - Morph nodes on undisplayed elements
1 - Fix nodes on undisplayed elements, they will function just like nodes on the fixed mark
2 - Exclude nodes on undisplayed elements, they will not be morphed nor affect the morphing
offset (double) – The distance to offset nodes from the target.
Example#
Morph nodes to be offset 1.2 from the surface of a sphere of radius 10.0 normal to the surface of the sphere use partitioned edges#import hm import hm.entities as ent model = hm.Model() model.morphnodesequaoffset( m_collection=hm.Collection(model, ent.Node), e_collection=hm.Collection(model, ent.Element), f_collection=hm.Collection(model, ent.Node), equation="x*x+y*y+z*z-100.0", ori=0, oid=0, nproj=1, c_vec=[1.0, 0.0, 0.0], integ=4, mbias=1.0, fbias=1.0, envelope=0.0, undisplayed=0, offset=1.2, )