Model.failed_elements_cleanup#

Model.failed_elements_cleanup(collection, elem_type, min_elemsize, max_feature_angle, max_reverse_angle)#

Cleans up the mesh by eliminating reversed and small sized elements. May create new elements instead of reversed.

Parameters:
  • collection (Collection) – The collection containing the element entities of the original mesh.

  • elem_type (int) –

    Determines the type of new elements:

    0 - trias

    1 - mixed type (quads and trias)

  • min_elemsize (double) – Determines minimum element size of elements in the mesh after cleanup.

  • max_feature_angle (double) – Determines mesh feature angle for keeping features when possible after cleanup.

  • max_reverse_angle (double) – Determines maximum angle between adjacent element normals for reversed elements detection.

Example#

Eliminate elements in the displayed tria mesh with size less than 1.5, remove reversed elements with adjacent normals greater than 150 degrees, trying to keep features greater than 60 degrees#
import hm
import hm.entities as ent

model = hm.Model()

element_collection = hm.CollectionByDisplayed(model, ent.Element)

model.failed_elements_cleanup(
    collection=element_collection,
    elem_type=0,
    min_elemsize=1.5,
    max_feature_angle=60.0,
    max_reverse_angle=150.0,
)