Model.element_smooth_nodes#

Model.element_smooth_nodes(elementsCollection, nodeCollection, anchorFreeEdgeNodes=0, iterations=0, smoothmethod='', timelimit=0)#

Smooths a selection of elements with optional anchor nodes.

Parameters:
  • elementsCollection (Collection) – The collection containing the element entities to smooth.

  • nodeCollection (Collection) – The collection containing the anchor node entities.

  • anchorFreeEdgeNodes (int) – Option to compute and add free anchor nodes from element selection to the smoothening code (default = 1).

  • iterations (int) – The maximum number of smoothing iterations to perform (default 1).

  • smoothmethod (hwString) –

    The smoothing method. Valid values are:

    Angle - Angle correction-based smoothing

    AutoDecideWithoutQI

    AutoDecideWithQI - Size correction-based smoothing, and QI smoothing of failed elements with possible constrained movement of nodes off geometry edges. Control of the nodes movement off the geometry edges, the thresholds of the movement, and the element feature angle, are controlled by the current parameter file.

    AutoDecideWithQI_Params_locked - Size correction-based smoothing, and QI smoothing of failed elements. Node movement off geometry edges is not allowed. The parameter file has no effect, and the element feature angle is taken from the global preferences.

    QI - QI correction-based smoothing

    Shape - Shape correction-based smoothing

    Size - Size correction-based smoothing

  • timelimit (int) – The time limit in minutes for QI and AutoDecideWithQI (default is 0).

Example#

Smooth elements with IDs 100 - 200 with anchor nodes with IDs 150 and 151 use AutoDecideWithQI_locked method#
import hm
import hm.entities as ent

model = hm.Model()

elements = hm.Collection(model, ent.Element, list(range(100, 201)))
nodes = hm.Collection(model, ent.Node, [150, 151])
model.element_smooth_nodes(
    elementsCollection=elements,
    nodeCollection=nodes,
    anchorFreeEdgeNodes=1,
    iterations=5,
    smoothmethod="AutoDecideWithQI",
)
model.elementqualityshutdown(dontsaveflag=0)