Model.voxel_lattice_hex_mesh_add_planar_constraint#

Model.voxel_lattice_hex_mesh_add_planar_constraint(base_x, base_y, base_z, normal_x, normal_y, normal_z, normal_side)#

Adds a planar constraint to the voxel session. This restricts voxel creation to one side of the plane. Any number of planar constraints may be added. Voxel elements are created only in the regions that satisfy all of the constraints. 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:
  • base_x (double) – The plane base x-coordinate.

  • base_y (double) – The plane base y-coordinate.

  • base_z (double) – The plane base z-coordinate.

  • normal_x (double) – The plane normal x-coordinate.

  • normal_y (double) – The plane normal y-coordinate.

  • normal_z (double) – The plane normal z-coordinate.

  • normal_side (int) –

    0 - Constrain to plane normal opposite side.

    1 - Constrain to plane normal side.

Example#

Create voxels of size 10.0 to include components with IDs 100 - 110 and exclude components with IDs 200 - 203 , with a planar constraint at 500.0 , 0.0 , 0.0 along the positive x - direction#
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_add_planar_constraint(
    base_x=500.0,
    base_y=0.0,
    base_z=0.0,
    normal_x=501.0,
    normal_y=0.0,
    normal_z=0.0,
    normal_side=1,
)
model.voxel_lattice_hex_mesh_create()
model.voxel_lattice_hex_mesh_end()