Main Content

createHole

Create a 2-D hole on custom shape

Since R2023b

    Description

    resultantShape = createHole(shape1,shape2) creates a hole of 2-D shape shape2 on a custom shape shape1.

    example

    Examples

    collapse all

    This example shows how to cut a 2-D hole in a shape.

    Create and view a box.

    box = shape.Box;
    show(box)

    Figure contains an axes object. The axes object with xlabel x (m), ylabel y (m) contains 2 objects of type patch.

    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];

    Figure contains an axes object. The axes object with xlabel x (m), ylabel y (m) contains an object of type patch.

    Input Arguments

    collapse all

    Shape to cut hole, specified as a shape object from Custom 2-D and 3-D Antenna category.

    Example: shape.Box

    Example: shape.Circle

    Shape of 2-D hole, specified as a 2-D shape object from Custom 2-D and 3-D Antenna category.

    Example: shape.Circle

    Output Arguments

    collapse all

    Resultant shape after cutting the 2-D hole, returned as a shape object.

    Version History

    Introduced in R2023b

    See Also

    Objects

    Functions