46 lines
27 KiB
Markdown
46 lines
27 KiB
Markdown
---
|
|
title: "fromMm"
|
|
excerpt: "Converts a number from mm to the current default unit."
|
|
layout: manual
|
|
---
|
|
|
|
Converts a number from mm to the current default unit.
|
|
|
|
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`.
|
|
|
|
**Caution**: This function is only intended to be used when you absolutely MUST have different units in your code than the file settings. Otherwise, it is a bad pattern to use this function.
|
|
|
|
We merely provide these functions for convenience and readability, as `fromMm(10)` is more readable that your intent is "I want 10 millimeters" than `10 * (1/25.4)`, if the file settings are in inches.
|
|
|
|
```js
|
|
fromMm(input: number): number
|
|
```
|
|
|
|
### Tags
|
|
|
|
* `units`
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `input` | [`number`](/docs/kcl/types/number) | | Yes |
|
|
|
|
### Returns
|
|
|
|
[`number`](/docs/kcl/types/number)
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
totalWidth = fromMm(10)
|
|
```
|
|
|
|

|
|
|
|
|