Model.trim_elems_by_multi_circular_hole#

Model.trim_elems_by_multi_circular_hole(node_collection, feature_angle, string_array, periphery_node_collection, background_elem_collection, rigid_spider)#

This function is used to trim elements with circular holes. Washer elements can optionally be added to the hole. Multiple holes can be handled at the same time.

Parameters:
  • node_collection (Collection) – The collection containing the node entities to use as the center of the holes.

  • feature_angle (double) – This parameter is used to define mesh feature lines around holes and washer elements. The range should be (0, 180). It is usually set to 30.

  • string_array (hwStringList) –

    The string list that contains the washer element information. The first string should contain the following parameters as keywords followed by the parameters values:

    • layer_number <layers>

    The number of washer element layers > 0.

    • uniform_layers <flag>

    The value is 1 or 0. 1 means that all layer widths are uniform.

    • hole_density <value>

    The washer element density on the hole.

    The other string defines layer width parameter groups. If uniform_layers is set to 1, only one layer width parameter group is needed. Otherwise, the number of groups should be the same as the layer number. Each group contains 2 quoted values:

    • width_flag <flag>

    1 - Means that width_value defines the width of the layer, otherwise, it is defined as the ratio of the layer width over the hole radius.

    • width_value <value>

  • periphery_node_collection (Collection) – The collection containing the periphery node entities generated on the periphery hole. If it is empty and defined inside the function no periphery nodes are placed inside the collection.

  • background_elem_collection (Collection) – The collection containing the background element entities to be deleted in order to update the connectivity of the newly created elements and their neighbors. If it is empty and defined inside the function background elements are deleted and element connectivity is updated. If it is empty but defined outside function then the background elements are kept and placed in the empty collection.

  • rigid_spider (int) – Valid values are 0, 1 and 2. If the value is set to 0, no rigid elements will be created inside the hole. If the value is set to 1, a single spider will be created inside the hole. If the value is set to 2, individual rigid elements will be created for periphery nodes.

Example#

Create a hole around node with ID 60 with a radius of 5.0 , and 2 layers of uniform washer elements use a density of 8 and a width of 5.0#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the collection of nodes
node_col = hm.Collection(model, ent.Node, [60])

parameter_list = [
    "hole_radius = 5.0 layer_number = 2 uniform_layers = 1 hole_density = 8",
    "1 5.0",
]

model.trim_elems_by_multi_circular_hole(
    node_collection=node_col,
    feature_angle=30.0,
    string_array=parameter_list,
    periphery_node_collection=hm.Collection(model, ent.Node, populate=False),
    background_elem_collection=hm.Collection(model, ent.Element, populate=False),
    rigid_spider=1,
)