Skip to content
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

circle moved to kw args #5560

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 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
6 changes: 3 additions & 3 deletions docs/kcl/appearance.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ example = extrude(exampleSketch, length = 5)
```js
// Add color to a revolved solid.
sketch001 = startSketchOn('XY')
|> circle({ center = [15, 0], radius = 5 }, %)
|> circle(center = [15, 0], radius = 5)
|> revolve({ angle = 360, axis = 'y' }, %)
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
```
Expand Down Expand Up @@ -195,10 +195,10 @@ sweepPath = startSketchOn('XZ')
|> line(end = [0, 7])

pipeHole = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 1.5 }, %)
|> circle(center = [0, 0], radius = 1.5)

sweepSketch = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 2 }, %)
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)
|> appearance(color = "#ff0000", metalness = 50, roughness = 50)
Expand Down
16 changes: 9 additions & 7 deletions docs/kcl/circle.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ the provided (x, y) origin point.

```js
circle(
data: CircleData,
sketchSurfaceOrGroup: SketchOrSurface,
sketchOrSurface: SketchOrSurface,
center: [number],
radius: number,
tag?: TagDeclarator,
) -> Sketch
```
Expand All @@ -21,9 +22,10 @@ circle(

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| `sketchOrSurface` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| `center` | `[number]` | The center of the circle. | Yes |
| `radius` | `number` | The radius of the circle. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this circle | No |

### Returns

Expand All @@ -34,7 +36,7 @@ circle(

```js
exampleSketch = startSketchOn("-XZ")
|> circle({ center = [0, 0], radius = 10 }, %)
|> circle(center = [0, 0], radius = 10)

example = extrude(exampleSketch, length = 5)
```
Expand All @@ -48,7 +50,7 @@ exampleSketch = startSketchOn("XZ")
|> line(end = [0, 30])
|> line(end = [-30, 0])
|> close()
|> hole(circle({ center = [0, 15], radius = 5 }, %), %)
|> hole(circle(center = [0, 15], radius = 5), %)

example = extrude(exampleSketch, length = 5)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/const_std-math-PI.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ std::math::PI: number = 3.14159265358979323846264338327950288_
circumference = 70

exampleSketch = startSketchOn("XZ")
|> circle({ center = [0, 0], radius = circumference/ (2 * PI) }, %)
|> circle(center = [0, 0], radius = circumference/ (2 * PI))

example = extrude(exampleSketch, length = 5)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/kcl/helix.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ helixPath = helix(

// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('YZ')
|> circle({ center = [0, 0], radius = 0.5 }, %)
|> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath)
```

Expand All @@ -74,7 +74,7 @@ helixPath = helix(

// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 0.5 }, %)
|> circle(center = [0, 0], radius = 0.5)
|> sweep(path = helixPath)
```

Expand All @@ -98,7 +98,7 @@ helixPath = helix(

// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 1 }, %)
|> circle(center = [0, 0], radius = 1)
|> sweep(path = helixPath)
```

Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/helixRevolutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ helixRevolutions(

```js
part001 = startSketchOn('XY')
|> circle({ center = [5, 5], radius = 10 }, %)
|> circle(center = [5, 5], radius = 10)
|> extrude(length = 10)
|> helixRevolutions({
angleStart = 0,
Expand Down
6 changes: 3 additions & 3 deletions docs/kcl/hole.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ exampleSketch = startSketchOn(XY)
|> line(end = [5, 0])
|> line(end = [0, -5])
|> close()
|> hole(circle({ center = [1, 1], radius = .25 }, %), %)
|> hole(circle({ center = [1, 4], radius = .25 }, %), %)
|> hole(circle(center = [1, 1], radius = .25), %)
|> hole(circle(center = [1, 4], radius = .25), %)

example = extrude(exampleSketch, length = 1)
```
Expand All @@ -57,7 +57,7 @@ fn squareHoleSketch() {
}

exampleSketch = startSketchOn(-XZ)
|> circle({ center = [0, 0], radius = 3 }, %)
|> circle(center = [0, 0], radius = 3)
|> hole(squareHoleSketch(), %)
example = extrude(exampleSketch, length = 1)
```
Expand Down
10 changes: 2 additions & 8 deletions docs/kcl/hollow.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,11 @@ case = startSketchOn('-XZ')
|> extrude(length = 65)

thing1 = startSketchOn(case, 'end')
|> circle({
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> circle(center = [-size / 2, -size / 2], radius = 25)
|> extrude(length = 50)

thing2 = startSketchOn(case, 'end')
|> circle({
center = [size / 2, -size / 2],
radius = 25
}, %)
|> circle(center = [size / 2, -size / 2], radius = 25)
|> extrude(length = 50)

hollow(0.5, case)
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/int.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ n = int(ceil(5 / 2))
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
// Draw n cylinders.
startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(
instances = n,
Expand Down
8 changes: 4 additions & 4 deletions docs/kcl/loft.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ squareSketch = startSketchOn('XY')
|> close()

circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|> circle({ center = [0, 100], radius = 50 }, %)
|> circle(center = [0, 100], radius = 50)

circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|> circle({ center = [0, 100], radius = 20 }, %)
|> circle(center = [0, 100], radius = 20)

loft([
squareSketch,
Expand All @@ -94,10 +94,10 @@ squareSketch = startSketchOn('XY')
|> close()

circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|> circle({ center = [0, 100], radius = 50 }, %)
|> circle(center = [0, 100], radius = 50)

circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|> circle({ center = [0, 100], radius = 20 }, %)
|> circle(center = [0, 100], radius = 20)

loft(
[
Expand Down
4 changes: 2 additions & 2 deletions docs/kcl/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ map(
r = 10 // radius
fn drawCircle(id) {
return startSketchOn("XY")
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
|> circle(center = [id * 2 * r, 0], radius = r)
}

// Call `drawCircle`, passing in each element of the array.
Expand All @@ -50,7 +50,7 @@ r = 10 // radius
// Call `map`, using an anonymous function instead of a named one.
circles = map([1..3], fn(id) {
return startSketchOn("XY")
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
|> circle(center = [id * 2 * r, 0], radius = r)
})
```

Expand Down
10 changes: 5 additions & 5 deletions docs/kcl/offsetPlane.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ squareSketch = startSketchOn('XY')
|> close()

circleSketch = startSketchOn(offsetPlane('XY', offset = 150))
|> circle({ center = [0, 100], radius = 50 }, %)
|> circle(center = [0, 100], radius = 50)

loft([squareSketch, circleSketch])
```
Expand All @@ -59,7 +59,7 @@ squareSketch = startSketchOn('XZ')
|> close()

circleSketch = startSketchOn(offsetPlane('XZ', offset = 150))
|> circle({ center = [0, 100], radius = 50 }, %)
|> circle(center = [0, 100], radius = 50)

loft([squareSketch, circleSketch])
```
Expand All @@ -77,7 +77,7 @@ squareSketch = startSketchOn('YZ')
|> close()

circleSketch = startSketchOn(offsetPlane('YZ', offset = 150))
|> circle({ center = [0, 100], radius = 50 }, %)
|> circle(center = [0, 100], radius = 50)

loft([squareSketch, circleSketch])
```
Expand All @@ -95,7 +95,7 @@ squareSketch = startSketchOn('-XZ')
|> close()

circleSketch = startSketchOn(offsetPlane('-XZ', offset = -150))
|> circle({ center = [0, 100], radius = 50 }, %)
|> circle(center = [0, 100], radius = 50)

loft([squareSketch, circleSketch])
```
Expand All @@ -106,7 +106,7 @@ loft([squareSketch, circleSketch])
// A circle on the XY plane
startSketchOn("XY")
|> startProfileAt([0, 0], %)
|> circle({ radius = 10, center = [0, 0] }, %)
|> circle(radius = 10, center = [0, 0])

// Triangle on the plane 4 units above
startSketchOn(offsetPlane("XY", offset = 4))
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/patternCircular3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ patternCircular3d(

```js
exampleSketch = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 1 }, %)
|> circle(center = [0, 0], radius = 1)

example = extrude(exampleSketch, length = -5)
|> patternCircular3d(
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/patternLinear2d.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ patternLinear2d(

```js
exampleSketch = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 1 }, %)
|> circle(center = [0, 0], radius = 1)
|> patternLinear2d(axis = [1, 0], instances = 7, distance = 4)

example = extrude(exampleSketch, length = 1)
Expand Down
15 changes: 3 additions & 12 deletions docs/kcl/patternLinear3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,11 @@ case = startSketchOn('XY')
|> extrude(length = 65)

thing1 = startSketchOn(case, 'end')
|> circle({
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> circle(center = [-size / 2, -size / 2], radius = 25)
|> extrude(length = 50)

thing2 = startSketchOn(case, 'end')
|> circle({
center = [size / 2, -size / 2],
radius = 25
}, %)
|> circle(center = [size / 2, -size / 2], radius = 25)
|> extrude(length = 50)

// We pass in the "case" here since we want to pattern the whole sketch.
Expand All @@ -101,10 +95,7 @@ case = startSketchOn('XY')
|> extrude(length = 65)

thing1 = startSketchOn(case, 'end')
|> circle({
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> circle(center = [-size / 2, -size / 2], radius = 25)
|> extrude(length = 50)

// We pass in `thing1` here with `useOriginal` since we want to pattern just this object on the face.
Expand Down
6 changes: 3 additions & 3 deletions docs/kcl/patternTransform.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn transform(id) {

// Sketch 4 cylinders.
sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform)
```
Expand All @@ -84,7 +84,7 @@ fn transform(id) {
}

sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %)
|> circle(center = [0, 0], radius = 2)
|> extrude(length = 5)
|> patternTransform(instances = 4, transform = transform)
```
Expand Down Expand Up @@ -184,7 +184,7 @@ fn transform(replicaId) {
fn layer() {
return startSketchOn("XY")
// or some other plane idk
|> circle({ center = [0, 0], radius = 1 }, %, $tag1)
|> circle(center = [0, 0], radius = 1, tag = $tag1)
|> extrude(length = h)
}
// The vase is 100 layers tall.
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/patternTransform2d.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn transform(id) {

// Sketch 4 circles.
sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 2 }, %)
|> circle(center = [0, 0], radius = 2)
|> patternTransform2d(instances = 4, transform = transform)
```

Expand Down
5 changes: 1 addition & 4 deletions docs/kcl/pi.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ pi() -> number
circumference = 70

exampleSketch = startSketchOn("XZ")
|> circle({
center = [0, 0],
radius = circumference / (2 * pi())
}, %)
|> circle(center = [0, 0], radius = circumference / (2 * pi()))

example = extrude(exampleSketch, length = 5)
```
Expand Down
8 changes: 4 additions & 4 deletions docs/kcl/revolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ part001 = startSketchOn('XY')
```js
// A donut shape.
sketch001 = startSketchOn('XY')
|> circle({ center = [15, 0], radius = 5 }, %)
|> circle(center = [15, 0], radius = 5)
|> revolve({ angle = 360, axis = 'y' }, %)
```

Expand Down Expand Up @@ -106,7 +106,7 @@ box = startSketchOn('XY')
|> extrude(length = 20)

sketch001 = startSketchOn(box, "END")
|> circle({ center = [10, 10], radius = 4 }, %)
|> circle(center = [10, 10], radius = 4)
|> revolve({ angle = -90, axis = 'y' }, %)
```

Expand All @@ -122,7 +122,7 @@ box = startSketchOn('XY')
|> extrude(length = 20)

sketch001 = startSketchOn(box, "END")
|> circle({ center = [10, 10], radius = 4 }, %)
|> circle(center = [10, 10], radius = 4)
|> revolve({
angle = 90,
axis = getOppositeEdge(revolveAxis)
Expand All @@ -141,7 +141,7 @@ box = startSketchOn('XY')
|> extrude(length = 20)

sketch001 = startSketchOn(box, "END")
|> circle({ center = [10, 10], radius = 4 }, %)
|> circle(center = [10, 10], radius = 4)
|> revolve({
angle = 90,
axis = getOppositeEdge(revolveAxis),
Expand Down
Loading
Loading