* Support modules in docs Signed-off-by: Nick Cameron <nrc@ncameron.org> * shuffle around directories Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
		
			
				
	
	
		
			71 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| /// Functions for converting numbers to different units.
 | |
| 
 | |
| @no_std
 | |
| @settings(defaultLengthUnit = mm, kclVersion = 1.0)
 | |
| 
 | |
| /// 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)
 | |
| ///   |> startProfile(at = [0, 0])
 | |
| ///   |> angledLine(
 | |
| ///     angle = 50,
 | |
| ///     length = 70 * cos(units::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)
 | |
| ///   |> startProfile(at = [0, 0])
 | |
| ///   |> angledLine(
 | |
| ///     angle = 50,
 | |
| ///     length = 70 * cos(units::toDegrees((PI/4): number(rad))),
 | |
| ///   )
 | |
| ///   |> yLine(endAbsolute = 0)
 | |
| ///   |> close()
 | |
| ///
 | |
| /// example = extrude(exampleSketch, length = 5)
 | |
| /// ```
 | |
| export fn toDegrees(@num: number(deg)): number(deg) {
 | |
|   return num
 | |
| }
 |