Model.trim_shell_elems_by_shell_elems#

Model.trim_shell_elems_by_shell_elems(collection, trimmer_collection, param_string)#

Trim 2D elements with 2D elements along their intersection lines, and remove small penetrating parts of elements between the intersection lines and free element edges. If some elements get trimmed, the elements along the cutting lines are re-generated.

Parameters:
  • collection (Collection) – The collection containing the entities (elements or components) to take part on the mesh trimming.

  • trimmer_collection (Collection) – The collection containing the entities (element or components) to be used as the trimmer. If the collection is not empty, these elements are only used in the intersection calculation and are not trimmed themselves. Entities belonging to collection, but not in trimmer_collection, may be trimmed, if required. If the collection is empty, all entities collection are mutually trimmed as required.

  • param_string (hwString) –

    The string containing keyword/value pairs. Valid keywords are:

    • <angle>

    Defines the mesh feature angle to use. If not specified, a default of 30.0 is used.

    • <break_shell_along_component_boundaries>

    Input elements are distributed into groups based on their connectivity. Only are different groups taken as counterparts of the intersection calculation.

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

    1 - Break element groups at component boundaries.

    • <min_elem_size_rate>

    Defines the minimum element size locally. The valid value range is between 0.0 and 1.0. The minimum element size is calculated locally on the mesh area being re-meshed. The element size is computed for the mesh area and the minimum element size is then the product of this value and the element size of the area. If min_elem_size_value is also defined, min_elem_size_value is ignored. If neither min_elem_size_rate nor min_elem_size_value are defined, min_elem_size_rate 0.4 is used.

    • <min_elem_size_value>

    Defines the minimum element size globally. If min_elem_size_rate is also defined, min_elem_size_value is ignored. If neither min_elem_size_rate nor min_elem_size_value are defined, min_elem_size_rate 0.4 is used.

    • <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)

    • <trim_removal_limit>

    Defines the maximum distance between the intersection lines and free element edges in the isolated parts to be removed. A penetration part consists of a group of connected elements with only intersecting or free edges as boundaries.

Example#

Trim all displayed components with each other , use a maximum trim value of 50.0 , along with other basic options#
import hm
import hm.entities as ent

model = hm.Model()


# Creating a collection that contains all the displayes components
collection_components = hm.CollectionByDisplayed(model, ent.Component)

model.trim_shell_elems_by_shell_elems(
    collection=collection_components,
    trimmer_collection=hm.Collection(model, ent.Component, populate=False),
    param_string="angle=30.0, break_shell_along_component_boundaries=0, min_elem_size_rate=0.4, remove_internal_shell=1, trim_removal_limit=50.0",
)