Skip to content

Turn on units of measure (BREAKING CHANGE) #6343

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions docs/kcl/fromCm.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ excerpt: "Converts a number from centimeters to the current default unit."
layout: manual
---

**WARNING:** This function is deprecated.

Converts a number from centimeters to the current default unit.

*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42cm`) or the `to...` conversion functions.

No matter what units the current file uses, this function will always return a number equivalent to the input in centimeters.

For example, if the current file uses inches, `fromCm(1)` will return `0.393701`. If the current file uses millimeters, `fromCm(1)` will return `10`. If the current file uses centimeters, `fromCm(1)` will return `1`.
Expand Down
4 changes: 4 additions & 0 deletions docs/kcl/fromFt.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ excerpt: "Converts a number from feet to the current default unit."
layout: manual
---

**WARNING:** This function is deprecated.

Converts a number from feet to the current default unit.

*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42ft`) or the `to...` conversion functions.

No matter what units the current file uses, this function will always return a number equivalent to the input in feet.

For example, if the current file uses inches, `fromFt(1)` will return `12`. If the current file uses millimeters, `fromFt(1)` will return `304.8`. If the current file uses feet, `fromFt(1)` will return `1`.
Expand Down
4 changes: 4 additions & 0 deletions docs/kcl/fromInches.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ excerpt: "Converts a number from inches to the current default unit."
layout: manual
---

**WARNING:** This function is deprecated.

Converts a number from inches to the current default unit.

*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42inch`) or the `to...` conversion functions.

No matter what units the current file uses, this function will always return a number equivalent to the input in inches.

For example, if the current file uses inches, `fromInches(1)` will return `1`. If the current file uses millimeters, `fromInches(1)` will return `25.4`.
Expand Down
4 changes: 4 additions & 0 deletions docs/kcl/fromM.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ excerpt: "Converts a number from meters to the current default unit."
layout: manual
---

**WARNING:** This function is deprecated.

Converts a number from meters to the current default unit.

*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42m`) or the `to...` conversion functions.

No matter what units the current file uses, this function will always return a number equivalent to the input in meters.

For example, if the current file uses inches, `fromM(1)` will return `39.3701`. If the current file uses millimeters, `fromM(1)` will return `1000`. If the current file uses meters, `fromM(1)` will return `1`.
Expand Down
4 changes: 4 additions & 0 deletions docs/kcl/fromMm.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ excerpt: "Converts a number from mm to the current default unit."
layout: manual
---

**WARNING:** This function is deprecated.

Converts a number from mm to the current default unit.

*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42mm`) or the `to...` conversion functions.

No matter what units the current file uses, this function will always return a number equivalent to the input in millimeters.

For example, if the current file uses inches, `fromMm(1)` will return `1/25.4`. If the current file uses millimeters, `fromMm(1)` will return `1`.
Expand Down
4 changes: 4 additions & 0 deletions docs/kcl/fromYd.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ excerpt: "Converts a number from yards to the current default unit."
layout: manual
---

**WARNING:** This function is deprecated.

Converts a number from yards to the current default unit.

*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42yd`) or the `to...` conversion functions.

No matter what units the current file uses, this function will always return a number equivalent to the input in yards.

For example, if the current file uses inches, `fromYd(1)` will return `36`. If the current file uses millimeters, `fromYd(1)` will return `914.4`. If the current file uses yards, `fromYd(1)` will return `1`.
Expand Down
16 changes: 8 additions & 8 deletions docs/kcl/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ layout: manual
* [`extrude`](kcl/extrude)
* [`fillet`](kcl/fillet)
* [`floor`](kcl/floor)
* [`fromCm`](kcl/fromCm)
* [`fromFt`](kcl/fromFt)
* [`fromInches`](kcl/fromInches)
* [`fromM`](kcl/fromM)
* [`fromMm`](kcl/fromMm)
* [`fromYd`](kcl/fromYd)
* [`getCommonEdge`](kcl/getCommonEdge)
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
* [`getOppositeEdge`](kcl/getOppositeEdge)
Expand Down Expand Up @@ -120,8 +114,14 @@ layout: manual
* [`sweep`](kcl/sweep)
* [`tangentToEnd`](kcl/tangentToEnd)
* [`tangentialArc`](kcl/tangentialArc)
* [`toDegrees`](kcl/toDegrees)
* [`toRadians`](kcl/toRadians)
* [`toCentimeters`](kcl/std-toCentimeters)
* [`toDegrees`](kcl/std-toDegrees)
* [`toFeet`](kcl/std-toFeet)
* [`toInches`](kcl/std-toInches)
* [`toMeters`](kcl/std-toMeters)
* [`toMillimeters`](kcl/std-toMillimeters)
* [`toRadians`](kcl/std-toRadians)
* [`toYards`](kcl/std-toYards)
* [`translate`](kcl/translate)
* [`union`](kcl/union)
* [`xLine`](kcl/xLine)
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/patternTransform.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ t = 0.005 // taper factor [0-1)
// Defines how to modify each layer of the vase.
// Each replica is shifted up the Z axis, and has a smoothly-varying radius
fn transform(replicaId) {
scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))
scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8: number(rad)))
return {
translate = [0, 0, replicaId * 10],
scale = [scale, scale, 0]
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/std-helix.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ helix(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `revolutions` | `number(_)` | Number of revolutions. | Yes |
| `angleStart` | `number(Angle)` | Start angle (in degrees). | Yes |
| `angleStart` | `number(Angle)` | Start angle. | Yes |
| `ccw` | [`bool`](/docs/kcl/types/bool) | Is the helix rotation counter clockwise? The default is `false`. | No |
| `radius` | `number(Length)` | Radius of the helix. | No |
| `axis` | `Axis3d | Edge` | Axis to use for the helix. | No |
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/std-math-cos.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine(
angle = 30,
length = 3 / cos(toRadians(30)),
length = 3 / cos(30deg),
)
|> yLine(endAbsolute = 0)
|> close()
Expand Down
4 changes: 2 additions & 2 deletions docs/kcl/std-math-polar.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cartesian (x/y/z grid) coordinates.

```js
polar(
angle: number(Angle),
angle: number(rad),
length: number(Length),
): Point2d
```
Expand All @@ -21,7 +21,7 @@ polar(

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `angle` | `number(Angle)` | | Yes |
| `angle` | `number(rad)` | | Yes |
| `length` | `number(Length)` | | Yes |

### Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/std-math-sin.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine(
angle = 50,
length = 15 / sin(toRadians(135)),
length = 15 / sin(135deg),
)
|> yLine(endAbsolute = 0)
|> close()
Expand Down
2 changes: 1 addition & 1 deletion docs/kcl/std-math-tan.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> angledLine(
angle = 50,
length = 50 * tan(1/2),
length = 50 * tan((1/2): number(rad)),
)
|> yLine(endAbsolute = 0)
|> close()
Expand Down
27 changes: 27 additions & 0 deletions docs/kcl/std-toCentimeters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "std::toCentimeters"
excerpt: "Convert a number to centimeters from its current units."
layout: manual
---

Convert a number to centimeters from its current units.



```js
toCentimeters(@num: number(cm)): number(cm)
```


### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `num` | `number(cm)` | | Yes |

### Returns

`number(cm)`



44 changes: 44 additions & 0 deletions docs/kcl/std-toDegrees.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions docs/kcl/std-toFeet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "std::toFeet"
excerpt: "Convert a number to feet from its current units."
layout: manual
---

Convert a number to feet from its current units.



```js
toFeet(@num: number(ft)): number(ft)
```


### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `num` | `number(ft)` | | Yes |

### Returns

`number(ft)`



27 changes: 27 additions & 0 deletions docs/kcl/std-toInches.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "std::toInches"
excerpt: "Convert a number to inches from its current units."
layout: manual
---

Convert a number to inches from its current units.



```js
toInches(@num: number(in)): number(in)
```


### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `num` | `number(in)` | | Yes |

### Returns

`number(in)`



27 changes: 27 additions & 0 deletions docs/kcl/std-toMeters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "std::toMeters"
excerpt: "Convert a number to meters from its current units."
layout: manual
---

Convert a number to meters from its current units.



```js
toMeters(@num: number(m)): number(m)
```


### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `num` | `number(m)` | | Yes |

### Returns

`number(m)`



27 changes: 27 additions & 0 deletions docs/kcl/std-toMillimeters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "std::toMillimeters"
excerpt: "Convert a number to millimeters from its current units."
layout: manual
---

Convert a number to millimeters from its current units.



```js
toMillimeters(@num: number(mm)): number(mm)
```


### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `num` | `number(mm)` | | Yes |

### Returns

`number(mm)`



44 changes: 44 additions & 0 deletions docs/kcl/std-toRadians.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions docs/kcl/std-toYards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "std::toYards"
excerpt: "Converts a number to yards from its current units."
layout: manual
---

Converts a number to yards from its current units.



```js
toYards(@num: number(yd)): number(yd)
```


### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `num` | `number(yd)` | | Yes |

### Returns

`number(yd)`



Loading
Loading