Closes https://github.com/KittyCAD/engine/issues/3494. Thanks to @nadr0 for helping on the JS side.
If users set their units, the grid will stop auto scaling, and instead will be set to 10 of whatever unit they used.
If users set their units, and those units are metric, then it'll include a scale bar (see screenshot). Imperial units won't have that bar.
This behaviour is configurable via settings.
## Limitations
- The scale bar below the grid cannot be disabled in metric units, and cannot be enabled in imperial units
<img width="1690" alt="Screenshot 2025-06-05 at 7 51 41 PM" src="https://github.com/user-attachments/assets/c597087c-f96d-4c30-95f4-b3d8ba2b5567" />
@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>
* the settings docs have a stutter with 2 h1s this fixes it
Signed-off-by: Jessie Frazelle <github@jessfraz.com>
* regenerate
Signed-off-by: Jessie Frazelle <github@jessfraz.com>
---------
Signed-off-by: Jessie Frazelle <github@jessfraz.com>
* 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>