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>
This commit is contained in:
@ -128,7 +128,7 @@ export END = 'end'
|
||||
export fn helix(
|
||||
/// Number of revolutions.
|
||||
revolutions: number(_),
|
||||
/// Start angle (in degrees).
|
||||
/// Start angle.
|
||||
angleStart: number(Angle),
|
||||
/// Is the helix rotation counter clockwise? The default is `false`.
|
||||
ccw?: bool,
|
||||
@ -383,3 +383,69 @@ export fn revolve(
|
||||
/// A named tag for the face at the end of the revolve.
|
||||
tagEnd?: tag,
|
||||
): Solid {}
|
||||
|
||||
/// Convert a number to millimeters from its current units.
|
||||
export fn toMillimeters(@num: number(mm)): number(mm) {
|
||||
return num
|
||||
}
|
||||
|
||||
/// Convert a number to centimeters from its current units.
|
||||
export fn toCentimeters(@num: number(cm)): number(cm) {
|
||||
return num
|
||||
}
|
||||
|
||||
/// Convert a number to meters from its current units.
|
||||
export fn toMeters(@num: number(m)): number(m) {
|
||||
return num
|
||||
}
|
||||
|
||||
/// Convert a number to inches from its current units.
|
||||
export fn toInches(@num: number(in)): number(in) {
|
||||
return num
|
||||
}
|
||||
|
||||
/// Convert a number to feet from its current units.
|
||||
export fn toFeet(@num: number(ft)): number(ft) {
|
||||
return num
|
||||
}
|
||||
|
||||
/// Converts a number to yards from its current units.
|
||||
export fn toYards(@num: number(yd)): number(yd) {
|
||||
return num
|
||||
}
|
||||
|
||||
/// Converts a number to radians from its current units.
|
||||
///
|
||||
/// ```
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> angledLine(
|
||||
/// angle = 50,
|
||||
/// length = 70 * cos(toRadians(45)),
|
||||
/// )
|
||||
/// |> yLine(endAbsolute = 0)
|
||||
/// |> close()
|
||||
///
|
||||
/// example = extrude(exampleSketch, length = 5)
|
||||
/// ```
|
||||
export fn toRadians(@num: number(rad)): number(rad) {
|
||||
return num
|
||||
}
|
||||
|
||||
/// Converts a number to degrees from its current units.
|
||||
///
|
||||
/// ```
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> angledLine(
|
||||
/// angle = 50,
|
||||
/// length = 70 * cos(toDegrees((PI/4): number(rad))),
|
||||
/// )
|
||||
/// |> yLine(endAbsolute = 0)
|
||||
/// |> close()
|
||||
///
|
||||
/// example = extrude(exampleSketch, length = 5)
|
||||
/// ```
|
||||
export fn toDegrees(@num: number(deg)): number(deg) {
|
||||
return num
|
||||
}
|
||||
|
Reference in New Issue
Block a user