Main Content


Linearly extrude 2-D shape along specified direction

Since R2023b



    extrudeLinear(shape,height) linearly extrudes the 2-D shape up to the specified height along the z-axis.

    extrudeLinear(___,Name=Value) linearly extrudes the 2-D shape up to the specified height with additional options specified by one or more Name-Value Arguments.


    collapse all

    Extrude a rectangle linearly for a height of 1 m.

    rect = shape.Rectangle;
    view([60.35 50.92])

    Input Arguments

    collapse all

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

    Example: shape.Rectangle

    Extrusion height, specified as a scalar in meters.

    Example: 2

    Data Types: double

    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: Twist=1

    Twist angle, specified as a scalar in the [0,360] degrees range. Specify this argument to twist the shape by specified angle during the extrusion up to the extrusion height.

    Example: 15

    Data Types: double

    Direction to extrude the shape, specified as a three-element vector of Cartesian coordinates in meters of a point in space. The extrusion direction is determined by the line joining the origin to this specified point in space.

    Example: [0 1 1]

    Data Types: double

    Scaling factor of the shape, specified as either a positive scalar or a two-element vector. For a scalar value, the extrusion shape is scaled by the specified factor up to the extrusion height. For a vector value, the first element is the scaling factor along the x-axis, while the second element is the scaling factor along the y-axis for the extrusion shape.

    Example: 3

    Example: [3 5]

    Data Types: double

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

    Example: 5

    Data Types: double

    Option to put cap enclosure for extruded shape, specified as false or 0 for no caps, and true or 1 for capping the extruded shape.

    Example: true

    Data Types: double | logical

    Version History

    Introduced in R2023b