Model.element2Dshiftnodes#

Model.element2Dshiftnodes(element_entity, mode, shift_value, first_node_entity, second_node_entity, direction_vector)#

Reorders the nodes in 2D elements based on various modes.

Parameters:
  • element_entity (Entity) – The object describing the 2D element entity to reorder.

  • mode (int) –

    Determines how the nodes are reordered.

    1 - Shift the first node by the value given by shift_value.

    2 - Shift the first node by the value given by shift_value and reverse the element orientation.

    3 - Make first_node_id the first node.

    4 - Make first_node_id the first node and reverse the element orientation.

    5 - Make first_node_id the first node and second_node_id the second. This may reverse the element orientation.

    6 - Find the element’s oriented side closest to the direction of direction_vector and set the first 2 nodes to be this side.

    7 - Find the element’s oriented side closest to the direction of direction_vector and set the first 2 nodes to be this side with the reverse orientation.

  • shift_value (int) – When mode is 1 or 2, this is an integer defining the shift of the element nodes.

  • first_node_entity (Entity) – The object describing the node entity of the first node in the reordered 2D element. When mode is 3, 4 or 5.

  • second_node_entity (Entity) – The object describing the node entity of the second node in the reordered 2D element. When mode is 5.

  • direction_vector (hwTriple) – The hwTriple object defining the The vector closest to the orientation of the element’s first and second nodes. User can also supply a Python list of three doubles.

Examples#

If the original element with ID 100 is ordered with nodes with IDs 34, 62, 88, 11. Reordering element with ID 100 as 88, 11, 34, 62#
import hm
import hm.entities as ent

model = hm.Model()

model.element2Dshiftnodes(
  element_entity=ent.Element(model, 100),
  mode=1,
  shift_value=2,
  first_node_entity=ent.Node(model, 0),
  second_node_entity=ent.Node(model, 0),
  direction_vector=[0,0,0]
)
If the original element with ID 100 is ordered with nodes with IDs 34, 62, 88, 11. Reordering element with ID 100 as 88, 62, 34, 11 (reverse element normal)#
import hm
import hm.entities as ent

model = hm.Model()

model.element2Dshiftnodes(
  element_entity=ent.Element(model, 100),
  mode=2,
  shift_value=2,
  first_node_entity=ent.Node(model, 0),
  second_node_entity=ent.Node(model, 0),
  direction_vector=[0,0,0]
)
If the original element with ID 100 is ordered with nodes with IDs 34, 62, 88, 11. Reordering element with ID 100 as 62, 88, 11, 34#
import hm
import hm.entities as ent

model = hm.Model()

model.element2Dshiftnodes(
  element_entity=ent.Element(model, 100),
  mode=3,
  shift_value=0,
  first_node_entity=ent.Node(model, 62),
  second_node_entity=ent.Node(model, 0),
  direction_vector=[0,0,0]
)
If the original element with ID 100 is ordered with nodes with IDs 34, 62, 88, 11. Reordering element with ID 100 as 62, 34, 11, 88#
import hm
import hm.entities as ent

model = hm.Model()

model.element2Dshiftnodes(
  element_entity=ent.Element(model, 100),
  mode=4,
  shift_value=0,
  first_node_entity=ent.Node(model, 62),
  second_node_entity=ent.Node(model, 0),
  direction_vector=[0,0,0]
)
If the original element with ID 100 is ordered with nodes with IDs 34, 62, 88, 11. Reordering element with ID 100 as 88, 62, 34, 11 (in this example it reverses the element normal too)#
import hm
import hm.entities as ent

model = hm.Model()

model.element2Dshiftnodes(
  element_entity=ent.Element(model, 100),
  mode=5,
  shift_value=0,
  first_node_entity=ent.Node(model, 88),
  second_node_entity=ent.Node(model, 62),
  direction_vector=[0,0,0]
)
If the original element with ID 100 is ordered with nodes with IDs 34, 62, 88, 11. Reordering element ID with 100 such that the two nodes that form a vector that is closest to the selected vector direction will chosen as n1, n2 while maintaining the element’s normal#
import hm
import hm.entities as ent

model = hm.Model()

model.element2Dshiftnodes(
  element_entity=ent.Element(model, 100),
  mode=6,
  shift_value=0,
  first_node_entity=ent.Node(model, 0),
  second_node_entity=ent.Node(model, 0),
  direction_vector=[0, 1, 0]
)
If the original element with ID 100 is ordered with nodes with IDs 34, 62, 88, 11. Reordering element ID with 100 such that the two nodes that form a vector closest to the selected vector direction will be chosen as n1, n2 (this option may reverse the elements normal)#
import hm
import hm.entities as ent

model = hm.Model()

model.element2Dshiftnodes(
  element_entity=ent.Element(model, 100),
  mode=7,
  shift_value=2,
  first_node_entity=ent.Node(model, 0),
  second_node_entity=ent.Node(model, 0),
  direction_vector=[0, 1, 0]
)