Files
modeling-app/docs/kcl/startSketchOn.md
Adam Chalmers aea82e004a KCL: Convert x/y lines to use keyword arguments (#5615)
Previously, `xLine`, `xLineTo`, `yLine` and `yLineTo` used positional arguments. Now:

- `xLineTo` and `yLineTo` have been removed
- `xLine` and `yLine` both use keyword arguments:
  - `length`, optional (i.e. a relative distance along the X or Y axis)
  - `endAbsolute` optional (i.e. an absolute point along the X or Y axis)
  - `tag` optional
- Exactly one of `length` or `endAbsolute` must be given. Not both, not neither.

For example:

```
// Old way
|> xLine(6.04, %)
|> yLineTo(20, %, $base)

// New way
|> xLine(length = 6.04)
|> yLine(endAbsolute = 20, tag = $base)
```

This also improves some of the general-purpose keyword arguments code in modeling app's TS codebase.
2025-03-07 22:07:16 -06:00

377 KiB

title, excerpt, layout
title excerpt layout
startSketchOn Start a new 2-dimensional sketch on a specific plane or face. manual

Start a new 2-dimensional sketch on a specific plane or face.

Sketch on Face Behavior

There are some important behaviors to understand when sketching on a face:

The resulting sketch will include the face and thus Solid that was sketched on. So say you were to export the resulting Sketch / Solid from a sketch on a face, you would get both the artifact of the sketch on the face and the parent face / Solid itself.

This is important to understand because if you were to then sketch on the resulting Solid, it would again include the face and parent Solid that was sketched on. This could go on indefinitely.

The point is if you want to export the result of a sketch on a face, you only need to export the final Solid that was created from the sketch on the face, since it will include all the parent faces and Solids.

startSketchOn(
  data: SketchData,
  tag?: FaceTag,
): SketchSurface

Arguments

Name Type Description Required
data SketchData Data for start sketch on. You can start a sketch on a plane or an solid. Yes
tag FaceTag A tag for a face. No

Returns

SketchSurface - A sketch type.

Examples

exampleSketch = startSketchOn(XY)
  |> startProfileAt([0, 0], %)
  |> line(end = [10, 0])
  |> line(end = [0, 10])
  |> line(end = [-10, 0])
  |> close()

example = extrude(exampleSketch, length = 5)

exampleSketch002 = startSketchOn(example, 'end')
  |> startProfileAt([1, 1], %)
  |> line(end = [8, 0])
  |> line(end = [0, 8])
  |> line(end = [-8, 0])
  |> close()

example002 = extrude(exampleSketch002, length = 5)

exampleSketch003 = startSketchOn(example002, 'end')
  |> startProfileAt([2, 2], %)
  |> line(end = [6, 0])
  |> line(end = [0, 6])
  |> line(end = [-6, 0])
  |> close()

example003 = extrude(exampleSketch003, length = 5)

Rendered example of startSketchOn 0

exampleSketch = startSketchOn(XY)
  |> startProfileAt([0, 0], %)
  |> line(end = [10, 0])
  |> line(end = [0, 10], tag = $sketchingFace)
  |> line(end = [-10, 0])
  |> close()

example = extrude(exampleSketch, length = 10)

exampleSketch002 = startSketchOn(example, sketchingFace)
  |> startProfileAt([1, 1], %)
  |> line(end = [8, 0])
  |> line(end = [0, 8])
  |> line(end = [-8, 0])
  |> close(tag = $sketchingFace002)

example002 = extrude(exampleSketch002, length = 10)

exampleSketch003 = startSketchOn(example002, sketchingFace002)
  |> startProfileAt([-8, 12], %)
  |> line(end = [0, 6])
  |> line(end = [6, 0])
  |> line(end = [0, -6])
  |> close()

example003 = extrude(exampleSketch003, length = 5)

Rendered example of startSketchOn 1

exampleSketch = startSketchOn(XY)
  |> startProfileAt([4, 12], %)
  |> line(end = [2, 0])
  |> line(end = [0, -6])
  |> line(end = [4, -6])
  |> line(end = [0, -6])
  |> line(end = [-3.75, -4.5])
  |> line(end = [0, -5.5])
  |> line(end = [-2, 0])
  |> close()

example = revolve({ axis = 'y', angle = 180 }, exampleSketch)

exampleSketch002 = startSketchOn(example, 'end')
  |> startProfileAt([4.5, -5], %)
  |> line(end = [0, 5])
  |> line(end = [5, 0])
  |> line(end = [0, -5])
  |> close()

example002 = extrude(exampleSketch002, length = 5)

Rendered example of startSketchOn 2

a1 = startSketchOn({
       plane = {
         origin = { x = 0, y = 0, z = 0 },
         xAxis = { x = 1, y = 0, z = 0 },
         yAxis = { x = 0, y = 1, z = 0 },
         zAxis = { x = 0, y = 0, z = 1 }
       }
     })
  |> startProfileAt([0, 0], %)
  |> line(end = [100.0, 0])
  |> yLine(length = -100.0)
  |> xLine(length = -100.0)
  |> yLine(length = 100.0)
  |> close()
  |> extrude(length = 3.14)

Rendered example of startSketchOn 3