Model.voxel_lattice_hex_mesh_add_entities_with_buffer#

Model.voxel_lattice_hex_mesh_add_entities_with_buffer(collection, num_buffer_layers)#

Adds entities to the voxel domain with a number of buffer layers. Voxel gridding is donealong the intersection profile of the entities and the buffer layer.This must be preceded by a call to Model.voxel_lattice_hex_mesh_init() and must be followed by a call to Model.voxel_lattice_hex_mesh_create().

Parameters:
  • collection (Collection) – The collection containing the entities to be added. Valid entities are component, element, surface, solid and line entities.

  • num_buffer_layers (int) – The number of buffer layers.

Example#

Create voxels of size 10.0 to include components with IDs 100 - 110 with 3 buffer layers around comp 110 , and exclude components withIDs 200 - 203#
import hm
import hm.entities as ent

model = hm.Model()

# Creating a collection that contains the components to be included
filter_in_components = hm.FilterByEnumeration(ent.Component, list(range(100, 110)))
in_component_collection = hm.Collection(model, filter_in_components)

# Creating a collection that contains the components to be excluded
filter_out_components = hm.FilterByEnumeration(ent.Component, list(range(200, 204)))
out_component_collection = hm.Collection(model, filter_out_components)

# Creating a collection that contains the component to be added with buffer layers
component_added_buffer_collection = hm.Collection(model, ent.Component, [110])

model.voxel_lattice_hex_mesh_init(voxel_size=10.0)
model.voxel_lattice_hex_mesh_fill_voids(mode=0)
model.voxel_lattice_hex_mesh_add_entities(collection=in_component_collection, mode=1)
model.voxel_lattice_hex_mesh_add_entities_with_buffer(
    collection=component_added_buffer_collection, num_buffer_layers=3
)
model.voxel_lattice_hex_mesh_remove_entities(
    collection=out_component_collection, mode=1
)
model.voxel_lattice_hex_mesh_create()
model.voxel_lattice_hex_mesh_end()