Model.hm_getmeshvolumesinfo#
- Model.hm_getmeshvolumesinfo(collection, mode=0)#
Returns the number of volumes and multiple lists containing the elements and volume indices for each input element.
- Parameters:
collection (Collection) – The collection containing the element entities to find volumes for.
mode (int) –
Mode for internal voids. Valid options are:
0 - internal voids considered as “voids” and do not make a new volume
1 - internal voids considered as new volumes
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:volumes_count (unsigned int) - The number of identified volumes.
volumes_per_elem (
HmQueryResultList) - Result list object containingHmQueryResultobjects with the following output data; element, volume_i, volume_j. Thekeysrepresents the shell element and a pair of volumes of corresponding element sides. The first volume (volume_i) corresponds to the volume on the shell element side with normal pointing out. A volume of 0 represents free space (no volume).element (Entity) - Entity Type:
Elementvolume_i (unsigned int)
volume_j (unsigned int)
Example#
Orient all shell elements so that the normal points toward the inside of the volume with the smallest ID ( or inside if there is only one volume )#import hm import hm.entities as ent model = hm.Model() # Creating a list for elements to be reversed their normal \ # toward the inside if there is only one volume. elem_collection = hm.CollectionByDisplayed(model, ent.Element) _, result = model.hm_getmeshvolumesinfo(collection=elem_collection) num_volumes = result.volumes_count volumes_list = result.volumes_per_elem reverse_list = list() for resObj in volumes_list: elem = resObj.element vol1 = resObj.volume_i vol2 = resObj.volume_j if vol1 > vol2: reverse_list.append(elem) if len(reverse_list) != 0: reverse_elem_collection = hm.Collection(reverse_list) model.normalsreverse(collection=reverse_elem_collection, size=1 ** (-10))