@franknoirot @jtran and I decided that the `extrudeTwist()` function (which I added in https://github.com/KittyCAD/modeling-app/pull/7480) would be better as an optional case of the normal `extrude` function. Doing it this way means less work for the frontend team.
* 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>
* Improve docs around PI
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Refactor and polish type error messages
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add suggestion to fix unknown numbers error
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Don't warn so often about unknown units
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add degrees annotations to examples
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Fix a units bug with the modulo operation
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move some sketch functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move asserts to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* sweep, loft -> KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move pattern transforms to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Closes https://github.com/KittyCAD/modeling-app/issues/6805. Enables users to programatically construct colors, which will be helpful for
- Applying color to visualize program execution and help debugging
- Doing weird cool shit
Previously KCL bezier curves could only use relative control points. Now you can use absolute control points too.
Here's an example of the new arguments:
```kcl
startSketchOn(XY)
|> startProfile(at = [300, 300])
|> bezierCurve(control1Absolute = [600, 300], control2Absolute = [-300, -100], endAbsolute = [600, 300])
|> close()
|> extrude(length = 10)
```
Closes https://github.com/KittyCAD/modeling-app/issues/7083
Before, the LSP snippet for `startProfile` was
```
startProfile(%, at = [3.14, 3.14])
```
Now it's
```
startProfile(%, at = [0, 0])
```
This is configured by adding a `snippet_value=` field to the stdlib macro. For example:
```diff
#[stdlib {
name = "startProfile",
keywords = true,
unlabeled_first = true,
args = {
sketch_surface = { docs = "What to start the profile on" },
- at = { docs = "Where to start the profile. An absolute point." },
+ at = { docs = "Where to start the profile. An absolute point.", snippet_value = "[0, 0]" }, tag = { docs = "Tag this first starting point" },
},
tags = ["sketch"]
}]
```
## Work for follow-up PRs
- Make this work for KCL functions defined in KCL, e.g. [`fn circle`](36c8ad439d/rust/kcl-lib/std/sketch.kcl (L31-L32)) -- something like `@(snippet_value = "[0, 0]")` perhaps
- Go through the stdlib and change defaults where appropriate
Paul's been requesting this for a long time. Now that we're fully using keyword args, this is easy to do.
We should probably add a similar `diameter` arg to `arc`, `tangentialArc`, `polygon` etc. And _maybe_ to `fillet`, but that might not be as helpful.
* Declare pattern transform using KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Boolean function param defaults
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Parse empty record types in fn types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Shuffle around function call code
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Refactor function calls to share more code
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Hack to leave the result of revolve as a singleton rather than array
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Change Fn to fn for function types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Support args and return types in function types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Use fancy function types in the docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move the leg functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move array functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move clone to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add a function type
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add sim test for any type
* Fix doc comments to match code
* Add array ascription tests
* Commit new test output
* Fix to not panic when type is undefined
* Fix to not panic on use of the any type
* Update test and generated output
* Fix error message after rebase
* Fix subtype of any
* Fix KCL to use new keyword args
* Fix to not nest MixedArray in HomArray
* Update output
* Remove all creation of MixedArray and use HomArray instead
* Rename MixedArray to Tuple
* Fix to coerce arrays the way tuples are done
* Restructure to appease the type signature extraction
* Fix TS unit test
* Update output after switch to HomArray
* Update docs
* Fix to remove edge case when creating points
* Update docs with broken point signature
* Fix display of tuples to not collide with arrays
* Change push to an array with type mismatch to be an error
* Add sim test for push type error
* Fix acription to more general array element type
* Fix to coerce point types
* Change array push to not error when item type differs
* Fix coercion tests
* Change to only flatten as a last resort and remove flattening tuples
* Contort code to appease doc generation
* Update docs
* Fix coerce axes
* Fix flattening test to test arrays instead of tuples
* Remove special subtype case for singleton coercion