Model.optimized_mesh#

Model.optimized_mesh(collection, filename, elem_size, elem_type, smooth_across, feature_angle, algorithm, do_remesh, comp_mode)#

This function is used to create a mesh on a surface using saved or default parameters on surfaces and specifying various options. Any elements attached to the input surfaces are deleted before the meshing operation.

Parameters:
  • collection (Collection) – The collection containing the surface entities to mesh.

  • filename (hwString) – The full path and filename for the user-defined quality index criteria file. If no file is given, then filename="dummy" should be specified.

  • elem_size (double) – The default element size used to calculate element densities along edges for topology cleanup operations.

  • elem_type (int) –

    The type of elements to create. Valid values are:

    0 - Trias

    1 - Quads

    2 - Mixed

    3 - Right trias

    4 - Quads only

  • smooth_across (int) –

    Flag indicating whether to ignore surface edges for element smoothing and cleanup operations. Valid values are:

    0 - Honor surface edges for element smoothing and cleanup.

    1 - Ignore surface edges for element smoothing and cleanup.

  • feature_angle (double) – The angle, in degrees, specifying the feature lines. This is approximately the minimum angle between the elements adjacent to a feature line.

  • algorithm (int) –

    Determines the algorithm for surface meshing. Valid values are:

    0 - Standard surface meshing

    1 - Meshing with flow “align” control

    3 - Meshing with flow “align” and “size” control

  • do_remesh (int) –

    Flag indicating whether to keep or delete existing elements on the surfaces. Valid values are:

    2 - Break connectivity between neighboring surfaces.

    3 - Keep connectivity between neighboring surfaces.

    4 - Redo connectivity between neighboring surfaces by expanding surface selection by one layer of adjacent surfaces.

  • comp_mode (int) –

    Parameter specifying how entities are organized into components. Valid values are:

    0 - Elements are created in the current component.

    1 - Elements are created in the same components as their parent surfaces.

Example#

Start the optimization process with a criteria file named “ C:/criteria / mycriteria.txt “ for displayed surfaces , with tria elements , element size of 15.0 , feature angle of 35.0 degrees , ignore surface edges for smoothing and new elements created in their surface components#
import hm
import hm.entities as ent

model = hm.Model()

surface_collection = hm.CollectionByDisplayed(model, ent.Surface)

model.optimized_mesh(
collection=surface_collection,
filename="C:/criteria/mycriteria.txt",
elem_size=15.0,
elem_type=0,
smooth_across=1,
feature_angle=35.0,
algorithm=0,
do_remesh=0,
comp_mode=1,
)