@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
In #7156, I allowed KCL to set specific snippet completions for each arg of each function. They're optional -- if you don't set one, it'll fall back to the type-driven defaults.
That PR only worked for KCL stdlib functions defined in Rust. This PR enables the same feature, but for functions defined in KCL.
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>
* Document the units of PI
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add links between lang and std references
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Change signature of conversion functions
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Split foreign imports out of modules docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* More docs for Plane
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Update docs/kcl-std/consts/std-math-PI.md
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* Update rust/kcl-lib/std/math.kcl
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* Add documentation to modules, and some constants and types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Improve the language reference
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Fake modules for Rust std lib functions
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Include the missing @ in Rust std lib fns
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move revolve and mirror2d to better modules
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Use docs from KCL mods for type summaries
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Use type docs to describe types from KCL std lib
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Support modules in docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* shuffle around directories
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Preparing for the removal of positional functions from the language. The first big step is to change all our KCL code examples, test code, public samples etc to all use keyword functions.
Apologies for how large this PR is. Most of it is:
- Changing example KCL that defined its own functions, so the functions now use keyword arguments rather than positional arguments. E.g. change `cube([20, 20])` to be `cube(center = [20, 20])`.
- Some parts of the code assumed positional code and didn't handle keyword calls, e.g. the linter would only check for positional calls to startSketchOn. Now they should work with either positional or keyword.
- Update all the artifacts
This does _not_ remove support for positional calls. That will be in a follow-up PR.
* Remove deprecated syntax
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* fix one test
* fix sketch on revolved face test
* fix test: empty-scene default-planes act as expected
* fix up more tests
* another fix
* remove another const
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
* Declare chamfer in KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Ignore more in the simulation tests
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Declare fillet in KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move shell and hollow to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>