Model.mesh_fusing#

Model.mesh_fusing(destination_collection, source_collection, string_options)#

Connect/merge the proximity regions of 2D elements within a given tolerance. Elements are distributed into groups based on their connectivity and component membership. The elements belonging to different components can be in a single group by parameter input.

Parameters:
  • destination_collection (Collection) – The collection containing the destination entities. Valid entities are elements and components. If all entities as contained in the destination collection, the actual destination elements will be filtered out automatically by source_collection.

  • source_collection (Collection) – The collection containing the source entities.

  • string_options (hwString) –

    Defines the advanced parameters. Each name-value pair is space separated, and can be specified in any order. The valid options are:

    • adjust_elem_orientation

    0 - Auto normal adjustment is not performed.

    1 - For input without intersecting elements in contact regions, auto normal adjustment is performed (default).

    • break_shell_along_component_boundaries

    0 - All elements connected each other are classified as a group.

    1 - Element group building stops at component boundaries. This mean that elements in an element group belong to a single component. (default)

    • collapse_source_fusing_lines

    0 - Both source and target fusing lines remain (default).

    1 - Stitch both source and target fusing lines.

    • excl_tangent_angle

    Used to filter out some elements inside the proximity fusing regions (0, 90).

    • feature_angle

    This value is used to define feature edges on mesh. Default value is 30.0.

    • fusing_direction

    0 - Fusing direction are defined automatically (default).

    1 - The normal directions of the source elements are used as fusing directions.

    • fusing_elems_to_new_comp

    0 - Fusing element are stored to the component of source elements (default).

    1 - Fusing elements are stored to the new component “fusing_elems”

    2 - Fusing elements are stored to the current component.

    • keep_fusing_shell

    0 - The elements inside source or destination fusing regions are deleted (default).

    1 - The elements inside source fusing regions are kept, while the elements inside destination fusing regions are deleted.

    2 - The elements inside destination fusing regions are kept, while the elements inside source fusing regions are deleted.

    3 - All elements inside fusing regions are kept.

    • kept_intersect_segment_angle

    Used to decide whether some element intersection segments are kept as part of fusing region boundaries (0, 90].

    • mark_init_prox_elems_only

    0 - Do not do proximity calculations (default).

    1 - Only perform the proximity calculations between all source and destination elements, and mark the elements within the input tolerance.

    • num_remesh_layers

    -1 - Intersecting elements are split and stitched to obtain conformal element connectivity. No remeshing is performed.

    0 - Remesh only the intersecting elements.

    > 0 - Remesh the specified number of layers of elements in addition to the intersecting elements.

    • proximity_tolerance

    Used to decide the fusing regions. Only the source elements with this distance to the elements in the destination are considered as candidates in the source fusing region. The corresponding elements in the destination within this distance are the candidates corresponding to mated fusing regions.

    • snapping_tolerance

    Used to decide whether region boundaries are allowed to snap to the free mesh edges when the distance of the boundaries of the fusing regions to free mesh boundaries are less than this value, and operation is possible.

    • tria_remesh_growth_ratio

    Used to specify the triangular element size growth ratio when use_adaptive_tria_remesh is 1.

    • use_adaptive_tria_remesh

    0 - Use the default tria remesher.

    1 - Use the adaptive tria remesher.

Example#

Fuse all components, use component “green” as the source#
import hm
import hm.entities as ent

model = hm.Model()

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

source_comps = hm.Collection(model, ent.Component, "name=green")

model.mesh_fusing(
    destination_collection=dest_comps,
    source_collection=source_comps,
    string_options="feature_angle 30.0  break_shell_along_component_boundaries 0  mark_init_prox_elems_only 0  fusing_direction 0  proximity_tolerance 2.0  excl_tangent_angle 65.0  kept_intersect_segment_angle 45.0  keep_fusing_shell 0",
)