Files
modeling-app/docs/kcl-std/subtract2d.md
Nick Cameron 1841e63021 Misc docs polishing (#6712)
* Fake modules for Rust std lib functions

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

* Include the missing @ in Rust std lib fns

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

* Move revolve and mirror2d to better modules

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

* Use docs from KCL mods for type summaries

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

* Use type docs to describe types from KCL std lib

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 16:09:59 +12:00

192 KiB

title, excerpt, layout
title excerpt layout
std::sketch::subtract2d Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch. manual

Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.

subtract2d(
  @sketch: Sketch,
  tool: [Sketch],
): Sketch

Arguments

Name Type Description Required
sketch Sketch Which sketch should this path be added to? Yes
tool [Sketch] The shape(s) which should be cut out of the sketch. Yes

Returns

Sketch - A sketch is a collection of paths.

Examples

exampleSketch = startSketchOn(XY)
  |> startProfile(at = [0, 0])
  |> line(end = [0, 5])
  |> line(end = [5, 0])
  |> line(end = [0, -5])
  |> close()
  |> subtract2d(tool = circle(center = [1, 1], radius = .25))
  |> subtract2d(tool = circle(center = [1, 4], radius = .25))

example = extrude(exampleSketch, length = 1)

Rendered example of std::sketch::subtract2d 0

fn squareHoleSketch() {
  squareSketch = startSketchOn(-XZ)
    |> startProfile(at = [-1, -1])
    |> line(end = [2, 0])
    |> line(end = [0, 2])
    |> line(end = [-2, 0])
    |> close()
  return squareSketch
}

exampleSketch = startSketchOn(-XZ)
  |> circle(center = [0, 0], radius = 3)
  |> subtract2d(tool = squareHoleSketch())
example = extrude(exampleSketch, length = 1)

Rendered example of std::sketch::subtract2d 1