Model.fix_2d_mesh#

Model.fix_2d_mesh(collection, fix_type, aspect_ratio, node_movement_tol, fix_method, failed_collection)#

Performs local mesh operations to resolve intersections and slivers on a surface mesh.

Parameters:
  • collection (Collection) – The collection containing the entities to fix. Valid entities are components and elements.

  • fix_type (int) –

    0 - Attempts to detect and remove intersections using local operations.

    1 - Attempts to fix sliver elements present in the mesh input.

    2 - Attempts to fix sliver elements and subsequently run intersection removal.

  • aspect_ratio (double) –

    This specifies the aspect ratio of the triangles that are allowed in the mesh as part of clean up. It is a value between 0 and 1.

    Note

    Intersection removal method attempts not to generate new triangles with less than the specified aspect ratio while resolving intersections.

    Sliver removal method attempts to clean up the triangles with less than the specified aspect ratio.

  • node_movement_tol (double) – This specifies the tolerance used to compute and resolve intersections. Suggested value is to use the average size of the mesh.

  • fix_method (int) –

    Bit value defining which operations are allowed while resolving mesh intersections. fix_method=0 will allow all operations, other values are interpreted as follows (Bit0 + 2*Bit1 + 4*Bit2 + 32*Bit5). Valid Bit values are:

    Bit0

    Edge swap. Valid values are:

    0 - Allow edge swap

    1 - Disable edge swap

    Bit1

    Edge collapse. Valid values are:

    0 - Allow edge collapse

    1 - Disable edge collapse

    Bit2

    Node movement. Valid values are:

    0 - Allow node movement

    1 - Disable node movement

    Bit5

    Underlying mesh topology edges. Valid values are:

    0 - Preserve underlying mesh topology edges

    1 - Do not preserve underlying mesh topology edges

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    Edge swap (Bit0)
    Edge collapse (Bit1)
    Node movement (Bit2)
    Underlying mesh topology edges (Bit5)
    Calculated argument value: 0

  • failed_collection (Collection) – The collection containing the entities. Only useful for fix_type=0/2.

Examples#

Resolve the intersections so that no new triangle with aspect ratio < 0.1 is generated while resolving intersection and restricting the node movement by 0.5. Allowing all mesh editing operations, all unresolved intersections populated in failed_collection.#
import hm
import hm.entities as ent

model = hm.Model()

# Select the collection of the mesh to smooth
input_col = hm.Collection(model, ent.Element)
fail_col = hm.Collection(model, ent.Element, populate=False)

model.fix_2d_mesh(
collection=input_col,
fix_type=0,
aspect_ratio=0.1,
node_movement_tol=0.5,
fix_method=0,
failed_collection=fail_col,
)
Resolve the intersections so that no new triangle with aspect ratio < 0.1 is generated while resolving intersection and restricting the node movement by 0.5. If intersection removal has to be performed only allowing edge swap and all unresolved intersections populated in failed_collection.#
import hm
import hm.entities as ent

model = hm.Model()

# Select the collection of the mesh to smooth
input_col = hm.Collection(model, ent.Element)
fail_col = hm.Collection(model, ent.Element, populate=False)

model.fix_2d_mesh(
collection=input_col,
fix_type=0,
aspect_ratio=0.1,
node_movement_tol=0.5,
fix_method=6,
failed_collection=fail_col,
)
Resolve the intersections so that no new triangle with aspect ratio < 0.1 is generated while resolving intersection and restricting the node movement by 0.5. If intersection removal has to be performed only allowing edge swap and node movements and all unresolved intersections populated in failed_collection.#
import hm
import hm.entities as ent

model = hm.Model()

# Select the collection of the mesh to smooth
input_col = hm.Collection(model, ent.Element)
fail_col = hm.Collection(model, ent.Element, populate=False)

model.fix_2d_mesh(
collection=input_col,
fix_type=0,
aspect_ratio=0.1,
node_movement_tol=0.5,
fix_method=2,
failed_collection=fail_col,
)
Resolve the intersections so that no new triangle with aspect ratio < 0.1 is generated while resolving intersection and restricting the node movement by 0.5. If intersection removal has to be performed only allowing edge swap and node movements and all unresolved intersections populated in failed_collection.#
import hm
import hm.entities as ent

model = hm.Model()

# Select the collection of the mesh to smooth
input_col = hm.Collection(model, ent.Element)
fail_col = hm.Collection(model, ent.Element, populate=False)

model.fix_2d_mesh(
collection=input_col,
fix_type=0,
aspect_ratio=0.1,
node_movement_tol=0.5,
fix_method=5,
failed_collection=fail_col,
)