Model.solids_create_from_surfaces#
- Model.solids_create_from_surfaces(surfs_collection, depth_mode, depth_level, comp_mode)#
Creating solids from surfaces.
- Parameters:
surfs_collection (Collection) – The collection containing the surface entities from which to create the solids.
depth_mode (int) –
Defines an algorithm of creating solids in closed volumes defined by selected surfaces set:
0 - Create solids at levels up to
depth_level, with “level” defined as follows: All volumes that have their boundary with outer space are at level.1 - All volumes that share their boundary with volumes of the level n, but were not themselves marked as level n or n-1, become volumes of the level n+1.
4 - First, all of the selected surfaces that have closed volumes (not already containing solid) on exactly one side are found and solids are created for those surfaces.
If after that some of the remaining surfaces from the selected set still do not have a solid on their side, but have closed volumes on both sides, then solids are created on both sides of those surfaces.
depth_level (int) – The number of levels (as defined by
depth_mode=0) used to create solids. If the value is -1, then solids are created in all closed volumes defined by the input set of surfaces.comp_mode (int) –
0 - Solids are created in the current component and boundary surfaces are moved to the same component.
1 - Solids are created in the current component, but surfaces remain in their original component.
2 - Solids are created in the surfaces component (the result is not predictable if the surfaces were originally in different components).
Examples#
Suppose you have two spheres: a surface with ID 1 being a larger outer sphere and a surface with ID 2 being the smaller sphere inside. To create single solid that has the larger sphere as its outer boundary and the smaller sphere as the boundary of the cavity inside, and place the results in the surfaces component#import hm import hm.entities as ent model = hm.Model() model.solids_create_from_surfaces( surfs_collection=hm.Collection(model, ent.Surface, [1, 2]), depth_mode=4, depth_level=0, comp_mode=2, )
Suppose you have two spheres: a surface with ID 1 being a larger outer sphere and a surface with ID 2 being the smaller sphere inside. To create single solid that has the larger sphere as its outer boundary and the smaller sphere as the boundary of the cavity inside, and place the results in the surfaces component (Alternatively)#import hm import hm.entities as ent model = hm.Model() model.solids_create_from_surfaces( surfs_collection=hm.Collection(model, ent.Surface, [1, 2]), depth_mode=0, depth_level=1, comp_mode=2, )
Create 2 solid spheres; one of them as in previous example, another inside the cavity#import hm import hm.entities as ent model = hm.Model() model.solids_create_from_surfaces( surfs_collection=hm.Collection(model, ent.Surface, [1, 2]), depth_mode=0, depth_level=2, comp_mode=2, )