* Replace tag type with tagIdent and tagDecl Signed-off-by: Nick Cameron <nrc@ncameron.org> * Replace tagIdent with TaggedEdge and TaggedFace Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
229 lines
574 KiB
Markdown
229 lines
574 KiB
Markdown
---
|
|
title: "startSketchOn"
|
|
subtitle: "Function in std::sketch"
|
|
excerpt: "Start a new 2-dimensional sketch on a specific plane or face."
|
|
layout: manual
|
|
---
|
|
|
|
Start a new 2-dimensional sketch on a specific plane or face.
|
|
|
|
```kcl
|
|
startSketchOn(
|
|
@planeOrSolid: Solid | Plane,
|
|
face?: TaggedFace,
|
|
): Plane | 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.
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `planeOrSolid` | [`Solid`](/docs/kcl-std/types/std-types-Solid) or [`Plane`](/docs/kcl-std/types/std-types-Plane) | Profile whose start is being used. | Yes |
|
|
| `face` | [`TaggedFace`](/docs/kcl-std/types/std-types-TaggedFace) | Identify a face of a solid if a solid is specified as the input argument (`planeOrSolid`). | No |
|
|
|
|
### Returns
|
|
|
|
[`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face)
|
|
|
|
|
|
### Examples
|
|
|
|
```kcl
|
|
exampleSketch = startSketchOn(XY)
|
|
|> startProfile(at = [0, 0])
|
|
|> line(end = [10, 0])
|
|
|> line(end = [0, 10])
|
|
|> line(end = [-10, 0])
|
|
|> close()
|
|
|
|
example = extrude(exampleSketch, length = 5)
|
|
|
|
exampleSketch002 = startSketchOn(example, face = END)
|
|
|> startProfile(at = [1, 1])
|
|
|> line(end = [8, 0])
|
|
|> line(end = [0, 8])
|
|
|> line(end = [-8, 0])
|
|
|> close()
|
|
|
|
example002 = extrude(exampleSketch002, length = 5)
|
|
|
|
exampleSketch003 = startSketchOn(example002, face = END)
|
|
|> startProfile(at = [2, 2])
|
|
|> line(end = [6, 0])
|
|
|> line(end = [0, 6])
|
|
|> line(end = [-6, 0])
|
|
|> close()
|
|
|
|
example003 = extrude(exampleSketch003, length = 5)
|
|
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
// Sketch on the end of an extruded face by tagging the end face.
|
|
|
|
|
|
exampleSketch = startSketchOn(XY)
|
|
|> startProfile(at = [0, 0])
|
|
|> line(end = [10, 0])
|
|
|> line(end = [0, 10])
|
|
|> line(end = [-10, 0])
|
|
|> close()
|
|
|
|
example = extrude(exampleSketch, length = 5, tagEnd = $end01)
|
|
|
|
exampleSketch002 = startSketchOn(example, face = end01)
|
|
|> startProfile(at = [1, 1])
|
|
|> line(end = [8, 0])
|
|
|> line(end = [0, 8])
|
|
|> line(end = [-8, 0])
|
|
|> close()
|
|
|
|
example002 = extrude(exampleSketch002, length = 5, tagEnd = $end02)
|
|
|
|
exampleSketch003 = startSketchOn(example002, face = end02)
|
|
|> startProfile(at = [2, 2])
|
|
|> line(end = [6, 0])
|
|
|> line(end = [0, 6])
|
|
|> line(end = [-6, 0])
|
|
|> close()
|
|
|
|
example003 = extrude(exampleSketch003, length = 5)
|
|
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
exampleSketch = startSketchOn(XY)
|
|
|> startProfile(at = [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, face = sketchingFace)
|
|
|> startProfile(at = [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, face = sketchingFace002)
|
|
|> startProfile(at = [-8, 12])
|
|
|> line(end = [0, 6])
|
|
|> line(end = [6, 0])
|
|
|> line(end = [0, -6])
|
|
|> close()
|
|
|
|
example003 = extrude(exampleSketch003, length = 5)
|
|
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
exampleSketch = startSketchOn(XY)
|
|
|> startProfile(at = [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(exampleSketch, axis = Y, angle = 180deg)
|
|
|
|
exampleSketch002 = startSketchOn(example, face = END)
|
|
|> startProfile(at = [4.5, -5])
|
|
|> line(end = [0, 5])
|
|
|> line(end = [5, 0])
|
|
|> line(end = [0, -5])
|
|
|> close()
|
|
|
|
example002 = extrude(exampleSketch002, length = 5)
|
|
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
// Sketch on the end of a revolved face by tagging the end face.
|
|
|
|
|
|
exampleSketch = startSketchOn(XY)
|
|
|> startProfile(at = [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(
|
|
exampleSketch,
|
|
axis = Y,
|
|
angle = 180deg,
|
|
tagEnd = $end01,
|
|
)
|
|
|
|
exampleSketch002 = startSketchOn(example, face = end01)
|
|
|> startProfile(at = [4.5, -5])
|
|
|> line(end = [0, 5])
|
|
|> line(end = [5, 0])
|
|
|> line(end = [0, -5])
|
|
|> close()
|
|
|
|
example002 = extrude(exampleSketch002, length = 5)
|
|
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
a1 = startSketchOn({
|
|
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 }
|
|
})
|
|
|> startProfile(at = [0, 0])
|
|
|> line(end = [100.0, 0])
|
|
|> yLine(length = -100.0)
|
|
|> xLine(length = -100.0)
|
|
|> yLine(length = 100.0)
|
|
|> close()
|
|
|> extrude(length = 3.14)
|
|
|
|
```
|
|
|
|

|
|
|
|
|