Model.morphconstraintcreateelems#
- Model.morphconstraintcreateelems(ncollection, ecollection, type, name, p_vec, dist, ivec, color)#
Creates a mesh type morphconstraint for the selected nodes with the option of having those nodes either move along the specified mesh or be bounded by it.
The extended edges option is available for bounded type morphconstraint (
typevalues 1, 3, and 5) by adding 8 to thetype(9, 11, and 13). This option will extend the edges of the mesh by roughly two element lengths so that the nodes which project close to the edges of the mesh will project on to the extended edges.The depenetration option is available for bounded type morphconstraint (
typevalues 1, 3, and 5) by adding 16 to thetype(17, 19, and 21). This option will treat the center of any element attached to the constrained nodes as a constrained node and push the element away from the mesh if it is within the specified distance.To enable both extended edges and depenetration for a morphconstraint, add 24 to the
type(thus 1, 3, and 5 become 25, 27, and 29).- Parameters:
ncollection (Collection) – The collection containing the node entities that are constrained.
ecollection (Collection) – The collection containing the element entities to which the nodes are constrained.
type (int) –
0 - moves along mesh
1 - bounded by mesh
3 - remains a set distance from mesh
5 - maintains its original distance from mesh
+8 - extend edges of mesh
+16 - depenetration of elements attached to constrained nodes
+24 - extend edges and enable depenetration
+32 - enable mesh stretching around constrained nodes
name (hwString) – The name of the morphconstraint.
p_vec (hwTriple) – The hwTriple object defining the projection vector. User can also supply a Python list of three doubles.
dist (double) – Distance between node and mesh (types 1 and 3).
ivec (int) –
0 - Mesh normal is used for projection. The nodes will be moved normally to the mesh when constraining them or measuring the distance the nodes are away from the mesh
1 - Use
p_vecfor projection. The nodes will be moved alongp_vecwhen constraining them or measuring the distance the nodes are away from the meshcolor (int) – The color of the constraint. Valid values are 1-64.
Examples#
Create a morphconstraint for nodes to move along a mesh and projected normally to the mesh#import hm import hm.entities as ent model = hm.Model() model.morphconstraintcreateelems( ncollection=hm.Collection(model, ent.Node, [1, 2, 3, 4, 5]), ecollection=hm.Collection(model, ent.Element, [11, 12, 13, 14, 1.0]), type=0, name="mcon", p_vec=[1.0, 0.0, 0.0], dist=0.0, ivec=0, color=13, )
Create a morphconstraint for nodes to be bounded by a mesh at a distance of 5.0 and projected along a vector to the mesh with both depenetration and extended edges#import hm import hm.entities as ent model = hm.Model() model.morphconstraintcreateelems( ncollection=hm.Collection(model, ent.Node, [1, 2, 3, 4, 5]), ecollection=hm.Collection(model, ent.Element, [11, 12, 13, 14, 1.0]), type=27, name="mcon", p_vec=[1.0, 0.0, 0.0], dist=5.0, ivec=1, color=13, )