Model.remesh_element_intersection#

Model.remesh_element_intersection(collection, params)#

Remeshes 2D elements at intersection locations. Elements are distributed into groups based on their connectivity. The elements belonging to different components may be in the same group. Only different groups are taken as counterparts for the intersection calculation. Moreover, elements sharing a node are not counterparts of the intersection calculation on checking element/element intersection.

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

  • params (hwString) –

    The parameters of re-meshing along the cut, defined as “keyword value” format. Valid keywords and values are:

    • angle

    Values used to define feature edges on mesh. Default if not specified is 30.0.

    • break_shell_along_component_boundaries

    All elements connected to each other are classified as a group. This defines how that grouping occurs:

    0 - Do not break element grouping at component boundaries (default).

    1 - Element grouping stops at component boundaries. This means that elements in an element group belong to a single component.

    • close_small_intersection_gaps

    Specifies whether to close small gaps along intersection lines and free shell mesh boundaries.

    0 - Do not close (default)

    1 - Close

    • do_only_remove_internal_shell

    Indicates that the function only removes internal elements. It requires that all intersecting elements are conformal along the common intersecting element edge lines.

    0 - Do not apply (default)

    1 - Only remove internal shells. If specified, remove_internal_shell must be 1 or undefined and generate_intersect_segments_only must be 0 or not defined.

    • gap_close_method

    Specifies the method for closing small gaps. Gaps are closed by extending free edge elements to the intersecting target mesh.

    1 - Tangent extension

    2 - Free edge normal projection

    • generate_intersect_segments_only

    Indicates that the function only creates intersection segments.

    0 - Do not apply (default)

    1 - Only generate intersection segments. If specified, do_only_remove_internal_shell must be 0 or undefined.

    • intersection_gap_close_limit

    The gap close size limit. Must be specified if "close_small_intersection_gaps=1".

    • keep_intersect_edges

    Specifies whether to store mesh intersections as 1D elements.

    0 - Do not store (default)

    1 - Store

    • num_remesh_layers

    Defines the number of element layers attached to intersecting elements considered for remeshing. Valid values are:

    -1 - Intersecting elements are split and stitched to obtain conformal element connectivity.

    0 - Remesh only intersecting elements.

    > 0 - Remesh specified additional layers in addition to intersecting elements.

    • num_threads

    Specifies the number of threads to use:

    -1 - Multi-teading with no limit (default)

    0 - No multi-threading

    > 0 - The exact number of threads

    • remove_internal_shell

    0 - Do not remove internal elements when selected elements form two or more watertight shells.

    1 - Remove internal elements when selected elements form two or more watertight shells (default).

    • remove_small_penetration

    Specifies whether to remove small penetrations. A penetration consists of a group of connected elements whose boundaries are only intersection lines and free shell mesh boundaries. Valid values are:

    0 - Do not remove (default)

    1 - Remove

    • tria_remesh_growth_ratio

    The element size growth ratio used by the adaptive tria mesher when "use_adaptive_tria_remesh=1". Default if not specified is 1.5.

    • tria_remesh_span_angle

    The maximum element normal angle deviation used by the adaptive tria mesher when "use_adaptive_tria_remesh=1". Default if not specified is 35.0.

    • trim_removal_limit

    The maximum distance between intersection lines and free element edges in small penetrations to be removed. Must be specified if "remove_small_penetration=1".

    • use_adaptive_tria_remesh

    Specifies whether to use the adaptive tria mesher when re-meshing triangular elements.

    0 - Do not use (default)

    1 - Use

Example#

Trim displayed components, removing internal shells and remeshing using 2 additional layers#
import hm
import hm.entities as ent

model = hm.Model()

component_collection = hm.CollectionByDisplayed(model, ent.Component)

model.remesh_element_intersection(
    collection=component_collection,
    params="generate_intersect_segments_only 0 remove_internal_shell 1 do_only_remove_internal_shell 0 num_remesh_layers 2 angle 30.0",
)