* Fake modules for Rust std lib functions Signed-off-by: Nick Cameron <nrc@ncameron.org> * Include the missing @ in Rust std lib fns Signed-off-by: Nick Cameron <nrc@ncameron.org> * Move revolve and mirror2d to better modules Signed-off-by: Nick Cameron <nrc@ncameron.org> * Use docs from KCL mods for type summaries Signed-off-by: Nick Cameron <nrc@ncameron.org> * Use type docs to describe types from KCL std lib Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
		
			
				
	
	
		
			94 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
@no_std
 | 
						|
@settings(defaultLengthUnit = mm, kclVersion = 1.0)
 | 
						|
 | 
						|
 | 
						|
/// Mirror a sketch.
 | 
						|
///
 | 
						|
/// Only works on unclosed sketches for now.
 | 
						|
///
 | 
						|
/// Mirror occurs around a local sketch axis rather than a global axis.
 | 
						|
///
 | 
						|
/// ```
 | 
						|
/// // Mirror an un-closed sketch across the Y axis.
 | 
						|
/// sketch001 = startSketchOn(XZ)
 | 
						|
///     |> startProfile(at = [0, 10])
 | 
						|
///     |> line(end = [15, 0])
 | 
						|
///     |> line(end = [-7, -3])
 | 
						|
///     |> line(end = [9, -1])
 | 
						|
///     |> line(end = [-8, -5])
 | 
						|
///     |> line(end = [9, -3])
 | 
						|
///     |> line(end = [-8, -3])
 | 
						|
///     |> line(end = [9, -1])
 | 
						|
///     |> line(end = [-19, -0])
 | 
						|
///     |> mirror2d(axis = Y)
 | 
						|
///
 | 
						|
/// example = extrude(sketch001, length = 10)
 | 
						|
/// ```
 | 
						|
///
 | 
						|
/// ```
 | 
						|
/// // Mirror a un-closed sketch across the Y axis.
 | 
						|
/// sketch001 = startSketchOn(XZ)
 | 
						|
///     |> startProfile(at = [0, 8.5])
 | 
						|
///     |> line(end = [20, -8.5])
 | 
						|
///     |> line(end = [-20, -8.5])
 | 
						|
///     |> mirror2d(axis = Y)
 | 
						|
///
 | 
						|
/// example = extrude(sketch001, length = 10)
 | 
						|
/// ```
 | 
						|
///
 | 
						|
/// ```
 | 
						|
/// // Mirror a un-closed sketch across an edge.
 | 
						|
/// helper001 = startSketchOn(XZ)
 | 
						|
///  |> startProfile(at = [0, 0])
 | 
						|
///  |> line(end = [0, 10], tag = $edge001)
 | 
						|
///
 | 
						|
/// sketch001 = startSketchOn(XZ)
 | 
						|
///     |> startProfile(at = [0, 8.5])
 | 
						|
///     |> line(end = [20, -8.5])
 | 
						|
///     |> line(end = [-20, -8.5])
 | 
						|
///     |> mirror2d(axis = edge001)
 | 
						|
///
 | 
						|
/// // example = extrude(sketch001, length = 10)
 | 
						|
/// ```
 | 
						|
///
 | 
						|
/// ```
 | 
						|
/// // Mirror an un-closed sketch across a custom axis.
 | 
						|
/// sketch001 = startSketchOn(XZ)
 | 
						|
///     |> startProfile(at = [0, 8.5])
 | 
						|
///     |> line(end = [20, -8.5])
 | 
						|
///     |> line(end = [-20, -8.5])
 | 
						|
///     |> mirror2d(
 | 
						|
///       axis = {
 | 
						|
///         direction = [0.0, 1.0],
 | 
						|
///         origin = [0.0, 0.0]
 | 
						|
///       })
 | 
						|
///
 | 
						|
/// example = extrude(sketch001, length = 10)
 | 
						|
/// ```
 | 
						|
///
 | 
						|
/// ```
 | 
						|
/// // Sketch on the face of a mirrored sketch, that has been extruded.
 | 
						|
/// sketch0011 = startSketchOn(XY)
 | 
						|
///      |> startProfile(at = [6.77, 0])
 | 
						|
///      |> yLine(length = 1.27)
 | 
						|
///      |> tangentialArc(endAbsolute = [5.96, 2.37])
 | 
						|
///      |> tangentialArc(endAbsolute = [-6.2, 2.44])
 | 
						|
///      |> tangentialArc(endAbsolute = [-6.6, 1.82])
 | 
						|
///      |> yLine(length = -1.82)
 | 
						|
///      |> mirror2d( axis = X )
 | 
						|
///      |> extrude(length = 10)
 | 
						|
///
 | 
						|
/// sketch002 = startSketchOn(sketch0011, face = END)
 | 
						|
///     |> circle( center = [-0.01, 1.58], radius = 1.2 )
 | 
						|
///     |> extrude(length = 1.2)
 | 
						|
///
 | 
						|
/// shell([sketch002], faces = ['end'], thickness = .1 )
 | 
						|
/// ```
 | 
						|
@(impl = std_rust)
 | 
						|
export fn mirror2d(
 | 
						|
  /// The sketch or sketches to be reflected.
 | 
						|
  @sketches: [Sketch; 1+],
 | 
						|
  /// The axis to reflect around.
 | 
						|
  axis: Axis2d | Edge,
 | 
						|
): Sketch {}
 |