Files
modeling-app/docs/kcl-std/functions/std-sketch-extrude.md
2025-06-04 15:41:01 -04:00

343 KiB

title, subtitle, excerpt, layout
title subtitle excerpt layout
extrude Function in std::sketch Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid. manual

Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.

extrude(
  @sketches: [Sketch; 1+],
  length: number(Length),
  symmetric?: bool,
  bidirectionalLength?: number(Length),
  tagStart?: tag,
  tagEnd?: tag,
): [Solid; 1+]

You can provide more than one sketch to extrude, and they will all be extruded in the same direction.

Arguments

Name Type Description Required
sketches [Sketch; 1+] Which sketch or sketches should be extruded. Yes
length number(Length) How far to extrude the given sketches. Yes
symmetric bool If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. No
bidirectionalLength number(Length) If specified, will also extrude in the opposite direction to 'distance' to the specified distance. If 'symmetric' is true, this value is ignored. No
tagStart tag A named tag for the face at the start of the extrusion, i.e. the original sketch. No
tagEnd tag A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch. No

Returns

[Solid; 1+]

Examples

example = startSketchOn(XZ)
  |> startProfile(at = [0, 0])
  |> line(end = [10, 0])
  |> arc(
    angleStart = 120,
    angleEnd = 0,
    radius = 5,
  )
  |> line(end = [5, 0])
  |> line(end = [0, 10])
  |> bezierCurve(
       control1 = [-10, 0],
       control2 = [2, 10],
       end = [-5, 10],
     )
  |> line(end = [-5, -2])
  |> close()
  |> extrude(length = 10)

Rendered example of extrude 0

exampleSketch = startSketchOn(XZ)
  |> startProfile(at = [-10, 0])
  |> arc(
    angleStart = 120,
    angleEnd = -60,
    radius = 5,
  )
  |> line(end = [10, 0])
  |> line(end = [5, 0])
  |> bezierCurve(
       control1 = [-3, 0],
       control2 = [2, 10],
       end = [-5, 10],
     )
  |> line(end = [-4, 10])
  |> line(end = [-5, -2])
  |> close()

example = extrude(exampleSketch, length = 10)

Rendered example of extrude 1

exampleSketch = startSketchOn(XZ)
  |> startProfile(at = [-10, 0])
  |> arc(
    angleStart = 120,
    angleEnd = -60,
    radius = 5,
  )
  |> line(end = [10, 0])
  |> line(end = [5, 0])
  |> bezierCurve(
       control1 = [-3, 0],
       control2 = [2, 10],
       end = [-5, 10],
     )
  |> line(end = [-4, 10])
  |> line(end = [-5, -2])
  |> close()

example = extrude(exampleSketch, length = 20, symmetric = true)

Rendered example of extrude 2

exampleSketch = startSketchOn(XZ)
  |> startProfile(at = [-10, 0])
  |> arc(
    angleStart = 120,
    angleEnd = -60,
    radius = 5,
  )
  |> line(end = [10, 0])
  |> line(end = [5, 0])
  |> bezierCurve(
       control1 = [-3, 0],
       control2 = [2, 10],
       end = [-5, 10],
     )
  |> line(end = [-4, 10])
  |> line(end = [-5, -2])
  |> close()

example = extrude(exampleSketch, length = 10, bidirectionalLength = 50)

Rendered example of extrude 3