Skip to content

Commit

Permalink
Warn when calling deprecated functions (#5447)
Browse files Browse the repository at this point in the history
* Warn when calling deprecated std functions

Signed-off-by: Nick Cameron <[email protected]>

* Refactor function values

Signed-off-by: Nick Cameron <[email protected]>

---------

Signed-off-by: Nick Cameron <[email protected]>
  • Loading branch information
nrc authored Feb 22, 2025
1 parent 57f7d02 commit 3ddce11
Show file tree
Hide file tree
Showing 86 changed files with 274 additions and 10,811 deletions.
4 changes: 2 additions & 2 deletions docs/kcl/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Apply a function to every element of a list.
Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]`

```js
map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
map(array: [KclValue], map_fn: FunctionSource) -> [KclValue]
```


Expand All @@ -18,7 +18,7 @@ map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `map_fn` | `FunctionParam` | | Yes |
| `map_fn` | `FunctionSource` | | Yes |

### Returns

Expand Down
4 changes: 2 additions & 2 deletions docs/kcl/patternTransform.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The transform function returns a transform object. All properties of the object
- `rotation.origin` (either "local" i.e. rotate around its own center, "global" i.e. rotate around the scene's center, or a 3D point, defaults to "local")

```js
patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionParam, use_original?: bool) -> [Solid]
patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionSource, use_original?: bool) -> [Solid]
```


Expand All @@ -45,7 +45,7 @@ patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionPar
|----------|------|-------------|----------|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `transform` | `FunctionParam` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |

### Returns
Expand Down
4 changes: 2 additions & 2 deletions docs/kcl/patternTransform2d.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Just like patternTransform, but works on 2D sketches not 3D solids.


```js
patternTransform2d(sketch_set: SketchSet, instances: integer, transform: FunctionParam, use_original?: bool) -> [Sketch]
patternTransform2d(sketch_set: SketchSet, instances: integer, transform: FunctionSource, use_original?: bool) -> [Sketch]
```


Expand All @@ -19,7 +19,7 @@ patternTransform2d(sketch_set: SketchSet, instances: integer, transform: Functio
|----------|------|-------------|----------|
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `transform` | `FunctionParam` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |

### Returns
Expand Down
4 changes: 2 additions & 2 deletions docs/kcl/reduce.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Take a starting value. Then, for each element of an array, calculate the next va
using the previous value and the element.

```js
reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionParam) -> KclValue
reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionSource) -> KclValue
```


Expand All @@ -19,7 +19,7 @@ reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionParam) -> KclValue
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `start` | [`KclValue`](/docs/kcl/types/KclValue) | Any KCL value. | Yes |
| `reduce_fn` | `FunctionParam` | | Yes |
| `reduce_fn` | `FunctionSource` | | Yes |

### Returns

Expand Down
Loading

0 comments on commit 3ddce11

Please sign in to comment.