Main Content

extrude

Extrude 2-D shape on another shape

Since R2023b

    Description

    extShape= extrude(shape1,shape2) extrudes the shape2 on the shape1 surface by a height of 1 m. The center of the shape2 must lie on the surface of shape1.

    extShape= extrude(___,Name=Value) extrudes the shape2 on the shape1 surface with additional options specified by one or more Name-Value Arguments. The center of the shape2 must lie on the surface of shape1.

    example

    Examples

    collapse all

    Create a box and a rectangle. Align both the shapes.

    box = shape.Box;
    rect = shape.Rectangle(Length=0.2,Width=0.2);
    [~] = translate(rect,[0 0 1]);

    Extrude the rectangle on the box face with a height of 0.5 m and 20 segments.

    extShape = extrude(box,rect,Height=0.5,NumSegments=20);
    show(extShape);

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

    Input Arguments

    collapse all

    Shape to base the extruded shape, specified as either a 2-D or a 3-D shape object.

    Example: shape.Box

    Example: shape.Circle

    Shape to extrude, specified as a 2-D shape object.

    Example: shape.Polygon

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: Height=4

    Extrusion height, specified as a positive scalar.

    Example: 1

    Data Types: double

    Number of divisions along the extrusion height, specified as a positive scalar.

    Example: 20

    Data Types: double

    Option to extrude shape up to nearest metal, specified as 0 or false to disable, or 1 or true to enable. Set this argument to 1 or true to extrude the shape up to the nearest metal surface. When this argument is 0 or false, the shape extrudes up to the height specified in the Height argument.

    Example: 1

    Data Types: double | logical

    Output Arguments

    collapse all

    Extruded shape, returned as a shape.Custom3D object.

    Version History

    Introduced in R2023b