Files
modeling-app/docs/kcl/line.md
Nick Cameron c050739f41 Some improvements to the boxed signatures in the docs (#6593)
* Show a more reasonable name in function docs

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Fix buggy docs for union types

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Make types in the docs signatures into links

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-04-30 16:03:22 +00:00

81 KiB

title, excerpt, layout
title excerpt layout
line Extend the current sketch with a new straight line. manual

Extend the current sketch with a new straight line.

line(
  sketch: [Sketch](/docs/kcl/types/Sketch),
  endAbsolute?: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
  end?: [[[number](/docs/kcl/types/number)]](/docs/kcl/types/[number](/docs/kcl/types/number)),
  tag?: [TagDeclarator](/docs/kcl/types#tag-declaration),
): [Sketch](/docs/kcl/types/Sketch)

Arguments

Name Type Description Required
sketch Sketch Which sketch should this path be added to? Yes
endAbsolute [number] Which absolute point should this line go to? Incompatible with end. No
end [number] How far away (along the X and Y axes) should this line go? Incompatible with endAbsolute. No
tag TagDeclarator Create a new tag which refers to this line No

Returns

Sketch

Examples

triangle = startSketchOn(XZ)
  |> startProfile(at = [0, 0])
  // The END argument means it ends at exactly [10, 0].
  // This is an absolute measurement, it is NOT relative to
  // the start of the sketch.
  |> line(endAbsolute = [10, 0])
  |> line(endAbsolute = [0, 10])
  |> line(endAbsolute = [-10, 0], tag = $thirdLineOfTriangle)
  |> close()
  |> extrude(length = 5)

box = startSketchOn(XZ)
  |> startProfile(at = [10, 10])
  // The 'to' argument means move the pen this much.
  // So, [10, 0] is a relative distance away from the current point.
  |> line(end = [10, 0])
  |> line(end = [0, 10])
  |> line(end = [-10, 0], tag = $thirdLineOfBox)
  |> close()
  |> extrude(length = 5)

Rendered example of line 0