Create a 2-D hole on custom shape
Cut Rectangular Hole from Box
This example shows how to cut a 2-D hole in a shape.
Create and view a box.
box = shape.Box; show(box)
Create a rectangle to cut as a hole from the box.
rect = shape.Rectangle(Length=0.4,Width=0.2); [~] = translate(rect,[0 0 1]);
Create the hole on the box and view the resultant shape.
out_shape = createHole(box,rect); show(out_shape) view([52.89 26.87]) annotation("textarrow", [0.7964 0.5268], [0.8881 0.6881], "String", "Hole") % Property editing positionPropObjs = findobj(gcf, "-property", "Position"); positionPropObjs(1).Position = [1.0000 1.0000 560.0000, 420.0000];
shape1 — Shape to cut hole
Shape to cut hole, specified as a shape object from Custom 2-D and 3-D Antenna category.
resultantShape — Resultant shape after cutting 2-D hole
Resultant shape after cutting the 2-D hole, returned as a shape object.
Introduced in R2023b