Model.remove_solid_holes#
- Model.remove_solid_holes(collection, max_diam, cross_sect_size_max, options, string_array)#
Detects and removes holes in 3D geometry, up to a maximal diameter. The shape of the hole cross-section can optionally be filtered, limiting to circular holes only or/and rounded slots. Optionally fixed points and tags can be placed at the center of the removed holes.
When a hole cannot be removed, the surfaces of such holes can optionally be moved to auto-created components with auto-generated names.
Optionally any number of additional ranges of holes for removal with different shape and post-processing options can be specified using a flexible string input.
- Parameters:
collection (Collection) –
The collection containing the entities to be considered for the process. Valid entities are surfaces and solids.
If collection of surface entities is being used as input, all surfaces constituting each considered 3D body should be selected to generate proper results. If all surfaces of a 3D body are not selected, the function result is unpredictable.
max_diam (double) – The maximum diameter for holes to be removed. For holes of arbitrary shape, the “effective” diameter is found as the cross section perimeter/Pi. If the hole shape is limited by rounded slots, the hole diameter is taken as the hole rounded tip diameter.
cross_sect_size_max (double) – The maximum size of the cross-section (normal to the axes) for rounded slots or elliptical holes. This must exceed
max_diam.options (int) –
Flags that indicate different options for cross-section recognition and additional hole removal post-processing parameters.
Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3 + 16*Bit4). Valid Bit options are:
Bit0
Detection of only round holes. Valid values are:
0 - Holes are not filtered by shape (arbitrarily shaped).
1 - Only round holes should be detected.
Bit1
Detection of only round slots. Valid values are:
0 - Holes are not filtered by shape (arbitrarily shaped).
1 - Only round slots should be detected.
Bit2
Place fixed points. Valid values are:
0 - Do not place fixed points.
1 - Place fixed points at the centers of end cross-sections of removed holes.
Bit3
Place tags. Valid values are:
0 - Do not place tags.
1 - Place tags containing the hole size attached to the center fixed points.
Bit2must be used.Bit4
Failed hole surfaces are organized to auto-created components with auto-generated names. Valid values are:
0 - Failed hole surfaces are not organized.
1 - The surfaces of holes that failed to be removed are organized to auto-created components with auto-generated names. This can be used for manual removal of such holes.
Show Bit value calculator
Radio Button Table Option Name Value Detection of only round holes (Bit0) Detection of only round slots (Bit1) Place fixed points (Bit2) Place tags (Bit3) Failed hole surfaces are organized to auto-created components with auto-generated names (Bit4) Calculated argument value: 0 string_array (hwStringList) –
The object defining the list of strings that contains the additional input parameters.
All input strings (each one in separate quotation marks) have the same format and contain user defined diameter ranges.
Each range string has the following format
"min_range_diam max_range_diam options"The diameters ranges (min_range_diam, max_range_diam) should not overlap but may have gaps between them.
The options string is derived from the
optionsargument and can be customized for each range.
Examples#
Remove all holes with diameters from 0.0 to 8.0 and remove round holes and rounded slots only in the range from 8.0 to 20.0 with maximal rounded slot length 25.0 . No options are used for the lower range , but a value of 15 is used for the upper range ( find only rounded holes and slots , and place fixed points with tags )#import hm import hm.entities as ent model = hm.Model() model.remove_solid_holes( collection=hm.Collection(model, ent.Surface), max_diam=8.0, cross_sect_size_max=25.0, options=0, string_array=["8.0", "20.0", "15.0"], )
Remove only round holes up to a diameter of 12.0 , put fixed points at the centers , and move any failed hole surfaces to the auto - created component#import hm import hm.entities as ent model = hm.Model() model.remove_solid_holes( collection=hm.Collection(model, ent.Solid), max_diam=12.0, cross_sect_size_max=21.0, options=21, string_array=hm.hwStringList(), )