kcl

line

Extend the current sketch with a new straight line.

line(sketch: Sketch, end_absolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch

Arguments

NameTypeDescriptionRequired
sketchSketchWhich sketch should this path be added to?Yes
end_absolute[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
tagTagDeclaratorCreate a new tag which refers to this lineNo

Returns

Sketch - A sketch is a collection of paths.

Examples

triangle = startSketchOn("XZ")
  |> startProfileAt([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")
  |> startProfileAt([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