Model.trim_elements2#

Model.trim_elements2(base_element_collection, trim_element_collection, mode, num_layers, feature_angle, base_component)#

Trims 2D elements using 1D or 2D elements.

Parameters:
  • base_element_collection (Collection) – The collection containing the element entities of the base.

  • trim_element_collection (Collection) – The collection containing the element entities used for trimming.

  • mode (int) –

    Flag to indicate how to connect elements when the trimming elements are 2D elements and the boundaries of the selection consist of multiple loops.

    0 - Keep internal elements.

    1 - Elements inside internal loops are removed. For example, no elements inside washer.

  • num_layers (int) –

    Flag to indicate the number of surrounding element layers will be taken into account for remeshing.

    0 - No remeshing.

    1 - All elements on base_element_mark will be remeshed.

  • feature_angle (double) – Parameter used to define feature edge in remeshing.

  • base_component (int) –

    Flag to indicate if the imprinted elements should be organized to the same component as the base elements.

    0 - Keep original organization for imprinted elements.

    1 - Organize all imprinted elements to the same component as the base elements.

Example#

Trim elements 1 - 100 with elements 500 - 550 , remove elements from within internal loops , with remeshing , a feature angle of 30 and keep the original organization#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the collection of the base elements
filter_base_elements = hm.FilterByEnumeration(ent.Element, list(range(1, 101)))
collection_base = hm.Collection(model, filter_base_elements)

# Creating the collection of the trimming elements
filter_trimming_elements = hm.FilterByEnumeration(ent.Element, list(range(500, 551)))
collection_trimming = hm.Collection(model, filter_trimming_elements)

model.trim_elements2(
    base_element_collection=collection_base,
    trim_element_collection=collection_trimming,
    mode=1,
    num_layers=1,
    feature_angle=30,
    base_component=0,
)