Model.morphsmoothmorphbased#

Model.morphsmoothmorphbased(d_collection, f_collection, iter, quality_level, fix_type, fix_angle)#

Smooths any shell or solid element mesh, trying to improve the quality of the mesh while preserving the shape of the mesh. The smoothing of the mesh will be stored as a morph and thus can be undone, redone, or saved as part of a shape.

Two ways are provided to allow the user to fix nodes during the smoothing. The first is manual selection: any nodes on the node mark will be held fixed. The second is automatic selection via the fix_type option where you can select all nodes that lie on edges, faces, or feature lines and fix them all at once. All nodes selected using both methods will be fixed.

Parameters:
  • d_collection (Collection) – The collection containing the domain or element entities to be smoothed.

  • f_collection (Collection) – The collection containing the node entities to be held fixed.

  • iter (int) – The number of smoothing iterations that will be performed on the mesh. A normal value is 50.

  • quality_level (int) –

    The desired quality level you wish to attain. The higher the level, the more time required to smooth the mesh.

    1 - Low quality, faster solving

    2 - Balance between quality and solution speed

    3 - High quality, slower solving

  • fix_type (int) –

    Specifies which parts of the mesh should be automatically fixed in addition to any fixed nodes. Nodes associated with morph constraints will automatically be fixed. For best results, at least one node should be fixed using either this parameter or the mark of fixed nodes.

    0 - Nodes at handles (only when domains have been selected)

    1 - Fix edge domains or any nodes around the edge of selected elements

    2 - Fix nodes on feature edges

    3 - Fix nodes on the faces of the domains or elements

  • fix_angle (double) –

    If fix_type=3, the feature angle for determining the feature lines must be provided. For all other fix types this value is ignored.

    If the angle between two shell elements or the faces of two solid elements exceeds this value, a feature line will be placed between the two elements which will fix the nodes along that line. Valid values are between 0.0 and 180.0 with 0.0 meaning that the elements are perfectly flat. A normal value is 30.0.

Examples#

Smooth the domain with ID 9 at a balanced quality level with only the edge domains around it fixed which is selected interactively#
import hm
import hm.entities as ent

model = hm.Model()

model.morphsmoothmorphbased(
    d_collection=hm.Collection(model, ent.Domain, [9]),
    f_collection=hm.CollectionByInteractiveSelection(model, ent.Node),
    iter=50,
    quality_level=2,
    fix_type=1,
    fix_angle=30.0,
)
Smooth a solid mesh at the best quality level while fix the edges, feature lines, and a few user specified nodes, but not the face nodes#
import hm
import hm.entities as ent

model = hm.Model()

model.morphsmoothmorphbased(
    d_collection=hm.Collection(model, ent.Domain),
    f_collection=hm.Collection(model, ent.Node, [6079, 6080, 6108, 6112, 6113, 6114]),
    iter=50,
    quality_level=3,
    fix_type=2,
    fix_angle=30.0,
)