2025-03-24 21:55:24 +13:00
|
|
|
@no_std
|
|
|
|
|
|
|
|
/// Construct a 2-dimensional circle, of the specified radius, centered at
|
|
|
|
/// the provided (x, y) origin point.
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// exampleSketch = startSketchOn(-XZ)
|
|
|
|
/// |> circle(center = [0, 0], radius = 10)
|
|
|
|
///
|
|
|
|
/// example = extrude(exampleSketch, length = 5)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// exampleSketch = startSketchOn(XZ)
|
|
|
|
/// |> startProfileAt([-15, 0], %)
|
|
|
|
/// |> line(end = [30, 0])
|
|
|
|
/// |> line(end = [0, 30])
|
|
|
|
/// |> line(end = [-30, 0])
|
|
|
|
/// |> close()
|
|
|
|
/// |> hole(circle(center = [0, 15], radius = 5), %)
|
|
|
|
///
|
|
|
|
/// example = extrude(exampleSketch, length = 5)
|
|
|
|
/// ```
|
|
|
|
@(impl = std_rust)
|
|
|
|
export fn circle(
|
|
|
|
/// Sketch to extend, or plane or surface to sketch on.
|
|
|
|
@sketch_or_surface: Sketch | Plane | Face,
|
|
|
|
/// The center of the circle.
|
|
|
|
center: Point2d,
|
|
|
|
/// The radius of the circle.
|
|
|
|
radius: number,
|
|
|
|
/// Create a new tag which refers to this circle.
|
|
|
|
tag?: tag,
|
|
|
|
): Sketch {}
|
2025-04-03 22:44:52 +13:00
|
|
|
|
|
|
|
/// 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)
|
|
|
|
/// |> startProfileAt([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)
|
|
|
|
/// |> startProfileAt([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)
|
|
|
|
/// |> startProfileAt([0, 0], %)
|
|
|
|
/// |> line(end = [0, 10], tag = $edge001)
|
|
|
|
///
|
|
|
|
/// sketch001 = startSketchOn(XZ)
|
|
|
|
/// |> startProfileAt([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)
|
|
|
|
/// |> startProfileAt([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)
|
|
|
|
/// ```
|
|
|
|
@(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 {}
|