Model.cut_hole#
- Model.cut_hole(base_collection, type, count=1, planenormal, centerpoints=hwDoubleList(), num_centerpoints=hwIntList(), centerlines=Entity(), radius=hwDoubleList(), radius1=hwDoubleList(), radius2=hwDoubleList(), cappedends=0, num_vertices=hwIntList(), vertexpoints=hwDoubleList(), origin=hwDoubleList(), x_axis=hwDoubleList(), y_axis=hwDoubleList(), length=hwDoubleList(), width=hwDoubleList(), dorebuild=0, scaleparams=0)#
Cuts holes of type circle, rectangle, polyline, or slot on selected mesh or surfaces. Optionally, it rebuilds the mesh around the hole.
- Parameters:
base_collection (Collection) – The collection containing the entities on which hole is cut.
type (hwString) – The type of the hole to be cut. Valid values are circle, polyline, rectangle, or slot.
count (int) – The number of holes. If not specified, a single hole is assumed.
planenormal (hwDoubleList) – The coordinates of the normal direction of the plane on which hole shapes are sketched. You can provide a single set of vector coordinate values (three floating point values) or as many sets as the number of holes. This is mandatory.
centerpoints (hwDoubleList) – The coordinates of the center points of the circles or slots according to the number of holes. Applicable for
type‘circle’ and ‘slot’. Iftype=circle, the expected number of center points is equal to the value ofcount. Iftype=slot, each hole needs to have a center line, which can be defined by thecenterlines, or as a straight line whose end points can be provided by thecenterpoints. The expected number of center point coordinates is twice as many as thecountvalue. In case of curved slots where the center line is not straight, you can supply a varying number of center points per slot. In that case, thenum_centerpointsargument needs to reflect the number of center points per hole. This is mandatory iftype=circle.num_centerpoints (hwIntList) – The number of center points per hole. Applicable for
type='slot'. If a curved center line of the slot is required, you can supply more than two center points per slot hole. In that case a smooth line would be fitted among the given points and used as the center line.centerlines (Entity) – The ID of the center line for the slot hole. Applicable for
type='slot'. Each slot hole requires a center line which can be defined either by thecenterlines, or as a straight line whose end points are provided by the centerpoints argument. The expected number of center lines is equal to thecount. Either centerpoints orcenterlinesis mandatory if type=slot.radius (hwDoubleList) – The radius of the circle or slot holes with uniform radius. Applicable only for
type‘circle’ and ‘slot’. If a single value is given, it is used for all holes. If the holes have different radii, the number of the radius values should match thecount.radius1 (hwDoubleList) – The radius of the slot hole at the start of the center line (or at the first center point). Applicable only for
type='slot'. If a single value is given, it is used for all the holes. If the holes have different radii, the number of the radius values should match thecount.radius2 (hwDoubleList) – The radius of the slot hole at the end of the center line (or at the second center point). Applicable only for
type='slot'. If a single value is given, it is used for all the holes. If the holes have different radii, the number of radius values should match thecount.cappedends (int) –
Determines the shape of the ends of the hole. Applicable only for
type='slot'.0 - Straight ends
1 - Rounded (capped) ends
num_vertices (hwIntList) – The number of vertices for each polygonal hole. Applicable only for
type='polyline'. The number of values should be equal to thecount.vertexpoints (hwDoubleList) – The coordinates of the vertices for the polygonal hole. Applicable only for
type='polyline'. The expected number of coordinate sets should be equal to thenum_verticesvalue.origin (hwDoubleList) – The coordinates of the origin of the rectangle. Applicable only for
type='rectangle'and mandatory for this type. The number of coordinate sets should be equal to thecount.x_axis (hwDoubleList) – The coordinates of the local x axis of the rectangle. Applicable only for
type='rectangle'and mandatory for this type. The number of coordinate sets should be equal to thecount.y_axis (hwDoubleList) – The coordinates of the local y axis of the rectangle. Applicable only for
type='rectangle'and mandatory for this type. The number of coordinate sets should be equal to thecount.length (hwDoubleList) – The length of the rectangle along the x axis. Applicable only for
type='rectangle'and mandatory for this type. The number of values should be equal to thecount.width (hwDoubleList) – The length of the rectangle along the y axis. Applicable only for
type'rectangle'and mandatory for this type. The number of values should be equal to thecount.dorebuild (int) –
This activates the rebuild algorithm when remeshing the area around the hole. Applicable only if the input selection is elements.
0 - Standard Remesh
1 - Rebuild
scaleparams (int) –
This activates scaling of the size values in the criteria or parameter file according to the local mesh size. Applicable only if dorebuild is set to 1.
0 - Off
1 - On
Examples#
Cut a single circular hole on the xy plane on elements with the rebuild active#import hm import hm.entities as ent model = hm.Model() elems = hm.Collection(model, ent.Element, populate=True) model.cut_hole( base_collection=elems, type='circle', count=1, planenormal=[0.0, 0.0, 1.0], centerpoints=[-0.173848, 5.205146, 0.000000], radius=[11.180340], dorebuild=1, scaleparams=1, )
Cut a single straight slot hole with rounded ends on the xy plane on elements#import hm import hm.entities as ent model = hm.Model() elems = hm.Collection(model, ent.Element, populate=True) model.cut_hole( base_collection=elems, type='slot', count=1, planenormal=[0.0, 0.0, 1.0], centerpoints=[-35.173848, 0.205146, 0.000000, -0.173848, 15.205146, 0.000000], radius1=[5.0], radius2=[5.0], cappedends=1, )
Cut a single curved slot hole with rounded ends on the xy plane on elements#import hm import hm.entities as ent model = hm.Model() elems = hm.Collection(model, ent.Element, populate=True) model.cut_hole( base_collection=elems, type='slot', count=1, planenormal=[0.0, 0.0, 1.0], centerpoints=[-35.173848, 0.205146, 0.000000, -0.173848, 15.205146, 0.000000], num_centerpoints=[3], radius1=[5.0], radius2=[5.0], cappedends=1, )
Cut a single polygonal hole with rounded ends on the xy plane on surfaces#import hm import hm.entities as ent surfs = hm.Collection(model, ent.Surface, populate=True) model.cut_hole( base_collection=surfs, type='polyline', count=1, planenormal=[0.0, 0.0, 1.0], num_vertices=[3], vertexpoints=[9.598048, -4.267573, 0.000000, 25.146962, 20.321110, 0.000000, 39.839792, -9.780474, 0.000000], )
Cut three straight slot holes on surfaces#import hm import hm.entities as ent surfs = hm.Collection(model, ent.Surface, populate=True) model.cut_hole( base_collection=surfs, type='slot', count=3, planenormal=[0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0], centerpoints=[-30.531465, 12.062099, 0.000000, -14.816232, 18.348192, 0.000000, 19.729055, 9.224565, 0.000000, 34.923248, 6.185727, 0.000000, -15.173848, -4.794854, 0.000000, 4.826152, -4.794854, 0.000000], radius1=[5.0, 5.0, 5.0], radius2=[5.0, 5.0, 5.0], length=[26.925824, 25.495098, 30.000000], )
Cut a rectangular hole on surfaces#import hm import hm.entities as ent surfs = hm.Collection(model, ent.Surface, populate=True) model.cut_hole( base_collection=surfs, type='rectangle', count=1, planenormal=[-0.0, -0.0, -1.0], origin=[-15.173848, 15.205146, 0.000000], x_axis=[1.0, 0.0, 0.0], y_axis=[0.0, -1.0, -0.0], length=[30.0], width=[20.0], )