Model.endnotehistorystate#

Model.endnotehistorystate(name)#

Defines the end of a history state. Must be preceded by a call to Model.startnotehistorystate() with the same name value.

This function is used to group a set of functions into a single undo/redo operation. All functions that appear within the start/end block must be supported for undo/redo.

Parameters:

name (hwString) – The name of the history state. If the name contains spaces, it must be enclosed in curly braces or quotes.

Example#

Execute an element remesh operation on two selections of elements , but consider them as a single history operation#
import hm
import hm.entities as ent

model = hm.Model()

model.startnotehistorystate(name="Remesh two element selections")

model.setedgedensitylinkwithaspectratio(aspectratio=0)

hm.setoption(element_order=1)

model.setusefeatures(mode=3)

elems1 = hm.Collection(model, ent.Element, list(range(1,101)))
model.defaultremeshelems(
    collection=elems1,
    elem_size=1.0,
    elem_type=2,
    elem_type_2=2,
    comp_mode=1,
    size_control=1,
    skew_control=1,
    edge_mesh_type=1,
    min_size=0.0,
    max_size=0.0,
    max_deviation=0.0,
    max_angle=0.0,
    previous_settings=2,
    vertex_angle=30.0
)

elems2 = hm.Collection(model, ent.Element, list(range(1,201)))
model.defaultremeshelems(
    collection=elems2,
    elem_size=2.0,
    elem_type=2,
    elem_type_2=2,
    comp_mode=1,
    size_control=1,
    skew_control=1,
    edge_mesh_type=1,
    min_size=0.0,
    max_size=0.0,
    max_deviation=0.0,
    max_angle=0.0,
    previous_settings=2,
    vertex_angle=30.0
)

model.setusefeatures(mode=0)

model.endnotehistorystate(name="Remesh two element selections")