Files
modeling-app/docs/kcl/fromCm.md
Nick Cameron b7385d5f25 Turn on units of measure (BREAKING CHANGE) (#6343)
* Turn on uom checks

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Convert all lengths to mm for engine calls

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-04-22 22:58:35 +00:00

27 KiB

title, excerpt, layout
title excerpt layout
fromCm Converts a number from centimeters to the current default unit. 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.

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 fromCm(10) is more readable that your intent is "I want 10 centimeters" than 10 * 10, if the file settings are in millimeters.

fromCm(input: number): number

Tags

  • units

Arguments

Name Type Description Required
input number Yes

Returns

number

Examples

totalWidth = fromCm(10)

Rendered example of fromCm 0