Model.geom_simplify#
- Model.geom_simplify(collection, primitive_type='box', cover='per_body', simplify=0, delete_original=0, dest_comp='current', comp_name='')#
Simplifies the general shape of the input selection by fitting a box, a cylinder, or a convex-hull.
- Parameters:
collection (Collection) – The collection containing the entities to fic the general shape.
primitive_type (hwString) – The type of shape used for fitting. Valid values are box (default), cylinder, and convex_hull.
cover (hwString) –
Applicable only for input entity type surfaces. Valid values are:
per_body - Input surfaces are grouped into connected set of surfaces and individual fittings are done per group. (default)
all - Fitting is performed for all input surfaces at once.
simplify (int) – Valid only for
primitive_type="convex_hull". If set to 1, the shape is further simplified by combining faces together, or removing small size faces. The new shape will not cover the input as tightly as the non-simplified convex hull. Valid values are 0 (default) or 1.delete_original (int) – Applicable only if the input entities are surface. Valid values are 0 (default) and 1. If set to 1, the input surfaces are deleted after successful fitting.
dest_comp (hwString) –
Valid values are:
current - New entities are created in the current component. (default)
original - New entities are created in the component of the input solid.
named_comp - New entities are created in the named component specified in
comp_name. If a component with the given name does not exist, a new component is created.comp_name (hwString) – The name of the component in which user wants the result entities to be created. (default = “”)
Example#
Fitting cylinders to a set of surfaces with IDs 20-50, in a component named “CYLINDER FITTING”, with a cylinder for each connected set of input surfaces#import hm import hm.entities as ent model = hm.Model() # Creating a collection that contains the surfaces filter_surfaces = hm.FilterByEnumeration(ent.Surface, list(range(20, 51))) surface_collection = hm.Collection(model, filter_surfaces) model.geom_simplify( collection=surface_collection, cover="per_body", dest_comp="named_comp", comp_name="CYLINDER FITTING", )