Model.voxel_lattice_hex_mesh_renumber_to_grid_position#

Model.voxel_lattice_hex_mesh_renumber_to_grid_position()#

Renumbers the voxel elements according to grid numbering. Numbering starts from hm_max_element_id + 1 at the time of calling this function.

This must be preceded by a call to Model.voxel_lattice_hex_mesh_init() or Model.voxel_lattice_hex_mesh_create().

Example#

Create voxels of size 10.0 to include components with IDs 100 - 110 and exclude components with IDs 200 - 203 , then renumber#
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, 111)))
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)

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_remove_entities(
    collection=out_component_collection, mode=1
)
model.voxel_lattice_hex_mesh_create()
model.voxel_lattice_hex_mesh_renumber_to_grid_position()
model.voxel_lattice_hex_mesh_end()