Model.alignnode2#

Model.alignnode2(end_node1, end_node2, node, ratio)#

Aligns a node along the imaginary line between two other nodes, using a ratio coefficient.

Parameters:
  • end_node1 (Entity) – The object describing the first end node.

  • end_node2 (Entity) – The object describing the second end node.

  • node (Entity) – The object describing the node to align.

  • ratio (double) –

    The ratio that determines the alignment of node between end_node1 and end_node2.

    Note

    0.5 - Aligns node in the middle and behaves exactly as Model.alignnode().

    0 - Aligns node at the same location as end_node1.

    1 - Aligns node at the same location as end_node2.

    Other values are linearly interpolated in between.

Example#

Align node with ID 100 between nodes with IDs 200 and 300 using a ratio of 0.25#
import hm
import hm.entities as ent

model = hm.Model()
model.alignnode (
    end_node1=ent.Node(model,200),
    end_node2=ent.Node(model,300),
    node=ent.Node(model,100),
    ratio=0.25
)