Skip to content

docs: Change KCL docs examples to use startProfile() with explicit argument #7885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/kcl-std/functions/std-sketch-angledLine.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ angledLine(

```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> yLine(endAbsolute = 15)
|> angledLine(angle = 30deg, length = 15)
|> line(end = [8, -10])
|> yLine(endAbsolute = 0)
|> close()

example = extrude(exampleSketch, length = 10)
example = extrude(exampleProfile, length = 10)

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ angledLineThatIntersects(

```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> line(endAbsolute = [5, 10])
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|> line(endAbsolute = [0, 20])
|> angledLineThatIntersects(angle = 80deg, intersectTag = lineToIntersect, offset = 10)
|> close()

example = extrude(exampleSketch, length = 10)
example = extrude(exampleProfile, length = 10)

```

Expand Down
8 changes: 4 additions & 4 deletions docs/kcl-std/functions/std-sketch-arc.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/kcl-std/functions/std-sketch-circle.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/kcl-std/functions/std-sketch-close.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ startSketchOn(XZ)

```kcl
exampleSketch = startSketchOn(-XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> line(end = [10, 0])
|> line(end = [0, 10])
|> close()

example = extrude(exampleSketch, length = 10)
example = extrude(exampleProfile, length = 10)

```

Expand Down
7 changes: 6 additions & 1 deletion docs/kcl-std/functions/std-sketch-ellipse.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ ellipse(

```kcl
exampleSketch = startSketchOn(XY)
|> ellipse(center = [0, 0], majorRadius = 50, minorRadius = 20)
exampleProfile = ellipse(
exampleSketch,
center = [0, 0],
majorRadius = 50,
minorRadius = 20,
)

```

Expand Down
16 changes: 8 additions & 8 deletions docs/kcl-std/functions/std-sketch-extrude.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/kcl-std/functions/std-sketch-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ line(
### Examples

```kcl
triangle = startSketchOn(XZ)
|> startProfile(at = [0, 0])
triangleSketch = startSketchOn(XZ)
triangle = startProfile(triangleSketch, 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.
Expand All @@ -46,8 +46,8 @@ triangle = startSketchOn(XZ)
|> close()
|> extrude(length = 5)

box = startSketchOn(XZ)
|> startProfile(at = [10, 10])
boxSketch = startSketchOn(XZ)
box = startProfile(boxSketch, 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])
Expand Down
9 changes: 7 additions & 2 deletions docs/kcl-std/functions/std-sketch-planeOf.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ planeOf(
### Examples

```kcl
triangle = startSketchOn(XY)
|> polygon(radius = 3, numSides = 3, center = [0, 0])
triangleSketch = startSketchOn(XY)
triangle = polygon(
triangleSketch,
radius = 3,
numSides = 3,
center = [0, 0],
)
|> extrude(length = 2)

// Find the plane of the triangle's top face.
Expand Down
20 changes: 16 additions & 4 deletions docs/kcl-std/functions/std-sketch-rectangle.md

Large diffs are not rendered by default.

50 changes: 23 additions & 27 deletions docs/kcl-std/functions/std-sketch-revolve.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/kcl-std/functions/std-sketch-startProfile.md

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions docs/kcl-std/functions/std-sketch-startSketchOn.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/kcl-std/functions/std-sketch-xLine.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ xLine(

```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> xLine(length = 15)
|> angledLine(angle = 80deg, length = 15)
|> line(end = [8, -10])
Expand All @@ -45,7 +45,7 @@ exampleSketch = startSketchOn(XZ)
|> xLine(length = -15)
|> close()

example = extrude(exampleSketch, length = 10)
example = extrude(exampleProfile, length = 10)

```

Expand Down
4 changes: 2 additions & 2 deletions docs/kcl-std/functions/std-sketch-yLine.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ yLine(

```kcl
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> yLine(length = 15)
|> angledLine(angle = 30deg, length = 15)
|> line(end = [8, -10])
|> yLine(length = -5)
|> close()

example = extrude(exampleSketch, length = 10)
example = extrude(exampleProfile, length = 10)

```

Expand Down
18 changes: 9 additions & 9 deletions docs/kcl-std/functions/std-solid-appearance.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ This will work on any solid, including extruded solids, revolved solids, and she
```kcl
// Add color to an extruded solid.
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> line(endAbsolute = [10, 0])
|> line(endAbsolute = [0, 10])
|> line(endAbsolute = [-10, 0])
|> close()

example = extrude(exampleSketch, length = 5)
example = extrude(exampleProfile, length = 5)
// There are other options besides 'color', but they're optional.
|> appearance(color = '#ff0000')

Expand All @@ -54,7 +54,7 @@ example = extrude(exampleSketch, length = 5)
```kcl
// Add color to a revolved solid.
sketch001 = startSketchOn(XY)
|> circle(center = [15, 0], radius = 5)
profile001 = circle(sketch001, center = [15, 0], radius = 5)
|> revolve(angle = 360deg, axis = Y)
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)

Expand All @@ -65,8 +65,8 @@ sketch001 = startSketchOn(XY)
```kcl
// Add color to different solids.
fn cube(center) {
return startSketchOn(XY)
|> startProfile(at = [center[0] - 10, center[1] - 10])
cubeSketch = startSketchOn(XY)
return startProfile(cubeSketch, at = [center[0] - 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
Expand Down Expand Up @@ -99,14 +99,14 @@ appearance(
// You can set the appearance before or after you shell it will yield the same result.
// This example shows setting the appearance _after_ the shell.
firstSketch = startSketchOn(XY)
|> startProfile(at = [-12, 12])
firstSolid = startProfile(firstSketch, at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
|> close()
|> extrude(length = 6)

shell(firstSketch, faces = [END], thickness = 0.25)
shell(firstSolid, faces = [END], thickness = 0.25)
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)

```
Expand Down Expand Up @@ -135,13 +135,13 @@ shell(firstSketch, faces = [END], thickness = 0.25)
// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
// This example shows _before_ the pattern.
exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> line(end = [0, 2])
|> line(end = [3, 1])
|> line(end = [0, -4])
|> close()

example = extrude(exampleSketch, length = 1)
example = extrude(exampleProfile, length = 1)
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)

Expand Down
12 changes: 6 additions & 6 deletions docs/kcl-std/functions/std-solid-chamfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ thickness = 1
chamferLength = 2

mountingPlateSketch = startSketchOn(XY)
|> startProfile(at = [-width / 2, -length / 2])
mountingPlateProfile = startProfile(mountingPlateSketch, at = [-width / 2, -length / 2])
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|> close(tag = $edge4)

mountingPlate = extrude(mountingPlateSketch, length = thickness)
mountingPlate = extrude(mountingPlateProfile, length = thickness)
|> chamfer(
length = chamferLength,
tags = [
Expand All @@ -68,13 +68,13 @@ mountingPlate = extrude(mountingPlateSketch, length = thickness)
```kcl
// Sketch on the face of a chamfer.
fn cube(pos, scale) {
sg = startSketchOn(XY)
|> startProfile(at = pos)
cubeSketch = startSketchOn(XY)
cubeProfile = startProfile(cubeSketch, at = pos)
|> line(end = [0, scale])
|> line(end = [scale, 0])
|> line(end = [0, -scale])

return sg
return cubeProfile
}

part001 = cube(pos = [0, 0], scale = 20)
Expand All @@ -84,7 +84,7 @@ part001 = cube(pos = [0, 0], scale = 20)
|> chamfer(length = 10, tags = [getOppositeEdge(line1)], tag = $chamfer1)

sketch001 = startSketchOn(part001, face = chamfer1)
|> startProfile(at = [10, 10])
profile001 = startProfile(sketch001, at = [10, 10])
|> line(end = [2, 0])
|> line(end = [0, 2])
|> line(end = [-2, 0])
Expand Down
8 changes: 4 additions & 4 deletions docs/kcl-std/functions/std-solid-fillet.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ thickness = 1
filletRadius = 2

mountingPlateSketch = startSketchOn(XY)
|> startProfile(at = [-width / 2, -length / 2])
mountingPlateProfile = startProfile(mountingPlateSketch, at = [-width / 2, -length / 2])
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|> close(tag = $edge4)

mountingPlate = extrude(mountingPlateSketch, length = thickness)
mountingPlate = extrude(mountingPlateProfile, length = thickness)
|> fillet(
radius = filletRadius,
tags = [
Expand All @@ -73,13 +73,13 @@ thickness = 1
filletRadius = 1

mountingPlateSketch = startSketchOn(XY)
|> startProfile(at = [-width / 2, -length / 2])
mountingPlateProfile = startProfile(mountingPlateSketch, at = [-width / 2, -length / 2])
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|> close(tag = $edge4)

mountingPlate = extrude(mountingPlateSketch, length = thickness)
mountingPlate = extrude(mountingPlateProfile, length = thickness)
|> fillet(
radius = filletRadius,
tolerance = 0.000001,
Expand Down
8 changes: 4 additions & 4 deletions docs/kcl-std/functions/std-solid-intersect.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ verifying fit, and analyzing overlapping geometries in assemblies.


fn cube(center, size) {
return startSketchOn(XY)
|> startProfile(at = [center[0] - size, center[1] - size])
cubeSketch = startSketchOn(XY)
return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] + size])
|> line(endAbsolute = [center[0] - size, center[1] + size])
Expand All @@ -64,8 +64,8 @@ intersectedPart = intersect([part001, part002])


fn cube(center, size) {
return startSketchOn(XY)
|> startProfile(at = [center[0] - size, center[1] - size])
cubeSketch = startSketchOn(XY)
return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] + size])
|> line(endAbsolute = [center[0] - size, center[1] + size])
Expand Down
16 changes: 8 additions & 8 deletions docs/kcl-std/functions/std-solid-patternLinear3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ patternLinear3d(


exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> line(end = [0, 2])
|> line(end = [3, 1])
|> line(end = [0, -4])
|> close()

example = extrude(exampleSketch, length = 1)
example = extrude(exampleProfile, length = 1)
|> patternLinear3d(axis = X, instances = 7, distance = 6)

```
Expand All @@ -59,13 +59,13 @@ example = extrude(exampleSketch, length = 1)


exampleSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
exampleProfile = startProfile(exampleSketch, at = [0, 0])
|> line(end = [0, 2])
|> line(end = [3, 1])
|> line(end = [0, -4])
|> close()

example = extrude(exampleSketch, length = 1)
example = extrude(exampleProfile, length = 1)
|> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)

```
Expand All @@ -75,8 +75,8 @@ example = extrude(exampleSketch, length = 1)
```kcl
// Pattern a whole sketch on face.
size = 100
case = startSketchOn(XY)
|> startProfile(at = [-size, -size])
caseSketch = startSketchOn(XY)
case = startProfile(caseSketch, at = [-size, -size])
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])
|> tangentialArc(endAbsolute = [-size, size])
Expand Down Expand Up @@ -107,8 +107,8 @@ patternLinear3d(
```kcl
// Pattern an object on a face.
size = 100
case = startSketchOn(XY)
|> startProfile(at = [-size, -size])
caseSketch = startSketchOn(XY)
case = startProfile(caseSketch, at = [-size, -size])
|> line(end = [2 * size, 0])
|> line(end = [0, 2 * size])
|> tangentialArc(endAbsolute = [-size, size])
Expand Down
4 changes: 2 additions & 2 deletions docs/kcl-std/functions/std-solid-patternTransform.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn transform(@id) {

// Sketch 4 cylinders.
sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 2)
extrude001 = circle(sketch001, center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform)

Expand All @@ -95,7 +95,7 @@ fn transform(@id) {
}

sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 2)
extrude001 = circle(sketch001, center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform)

Expand Down
8 changes: 4 additions & 4 deletions docs/kcl-std/functions/std-solid-subtract.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ and complex multi-body part modeling.


fn cube(center, size) {
return startSketchOn(XY)
|> startProfile(at = [center[0] - size, center[1] - size])
cubeSketch = startSketchOn(XY)
return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] + size])
|> line(endAbsolute = [center[0] - size, center[1] + size])
Expand All @@ -67,8 +67,8 @@ subtractedPart = subtract([part001], tools = [part002])


fn cube(center, size) {
return startSketchOn(XY)
|> startProfile(at = [center[0] - size, center[1] - size])
cubeSketch = startSketchOn(XY)
return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] - size])
|> line(endAbsolute = [center[0] + size, center[1] + size])
|> line(endAbsolute = [center[0] - size, center[1] + size])
Expand Down
Loading
Loading