2025-02-25 16:10:06 +13:00
|
|
|
@no_std
|
2025-05-06 08:44:03 +12:00
|
|
|
@settings(defaultLengthUnit = mm, kclVersion = 1.0)
|
2025-02-25 16:10:06 +13:00
|
|
|
|
|
|
|
// Note that everything in the prelude is treated as exported.
|
|
|
|
|
2025-04-22 11:00:53 +12:00
|
|
|
export import * from "std::types"
|
2025-04-29 08:41:31 +12:00
|
|
|
export import "std::units"
|
2025-04-30 11:07:05 -04:00
|
|
|
export import * from "std::math"
|
2025-03-24 21:55:24 +13:00
|
|
|
export import * from "std::sketch"
|
2025-04-28 14:20:38 +12:00
|
|
|
export import * from "std::solid"
|
2025-03-30 11:10:44 +13:00
|
|
|
export import "std::turns"
|
2025-02-20 19:33:21 +13:00
|
|
|
|
2025-02-27 15:58:58 +13:00
|
|
|
export XY = {
|
|
|
|
origin = { x = 0, y = 0, z = 0 },
|
|
|
|
xAxis = { x = 1, y = 0, z = 0 },
|
|
|
|
yAxis = { x = 0, y = 1, z = 0 },
|
|
|
|
}: Plane
|
|
|
|
|
|
|
|
export XZ = {
|
|
|
|
origin = { x = 0, y = 0, z = 0 },
|
|
|
|
xAxis = { x = 1, y = 0, z = 0 },
|
|
|
|
yAxis = { x = 0, y = 0, z = 1 },
|
|
|
|
}: Plane
|
|
|
|
|
|
|
|
export YZ = {
|
|
|
|
origin = { x = 0, y = 0, z = 0 },
|
|
|
|
xAxis = { x = 0, y = 1, z = 0 },
|
|
|
|
yAxis = { x = 0, y = 0, z = 1 },
|
|
|
|
}: Plane
|
2025-04-03 22:44:52 +13:00
|
|
|
|
|
|
|
export X = {
|
|
|
|
origin = [0, 0, 0],
|
|
|
|
direction = [1, 0, 0],
|
|
|
|
}: Axis3d
|
|
|
|
|
|
|
|
export Y = {
|
|
|
|
origin = [0, 0, 0],
|
|
|
|
direction = [0, 1, 0],
|
|
|
|
}: Axis3d
|
|
|
|
|
|
|
|
export Z = {
|
|
|
|
origin = [0, 0, 0],
|
|
|
|
direction = [0, 0, 1],
|
|
|
|
}: Axis3d
|
|
|
|
|
2025-04-14 20:37:45 +12:00
|
|
|
/// Identifies the starting face of an extrusion. I.e., the face which is extruded.
|
|
|
|
export START = 'start'
|
|
|
|
|
|
|
|
/// Identifies the ending face of an extrusion. I.e., the new face created by an extrusion.
|
|
|
|
export END = 'end'
|
|
|
|
|
2025-04-03 22:44:52 +13:00
|
|
|
/// Create a helix.
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Create a helix around the Z axis.
|
|
|
|
/// helixPath = helix(
|
|
|
|
/// angleStart = 0,
|
|
|
|
/// ccw = true,
|
|
|
|
/// revolutions = 5,
|
|
|
|
/// length = 10,
|
|
|
|
/// radius = 5,
|
|
|
|
/// axis = Z,
|
|
|
|
/// )
|
|
|
|
///
|
|
|
|
/// // Create a spring by sweeping around the helix path.
|
|
|
|
/// springSketch = startSketchOn(YZ)
|
|
|
|
/// |> circle( center = [0, 0], radius = 0.5)
|
|
|
|
/// |> sweep(path = helixPath)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Create a helix around an edge.
|
|
|
|
/// helper001 = startSketchOn(XZ)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [0, 10], tag = $edge001)
|
|
|
|
///
|
|
|
|
/// helixPath = helix(
|
|
|
|
/// angleStart = 0,
|
|
|
|
/// ccw = true,
|
|
|
|
/// revolutions = 5,
|
|
|
|
/// length = 10,
|
|
|
|
/// radius = 5,
|
|
|
|
/// axis = edge001,
|
|
|
|
/// )
|
|
|
|
///
|
|
|
|
/// // Create a spring by sweeping around the helix path.
|
|
|
|
/// springSketch = startSketchOn(XY)
|
|
|
|
/// |> circle( center = [0, 0], radius = 0.5 )
|
|
|
|
/// |> sweep(path = helixPath)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Create a helix around a custom axis.
|
|
|
|
/// helixPath = helix(
|
|
|
|
/// angleStart = 0,
|
|
|
|
/// ccw = true,
|
|
|
|
/// revolutions = 5,
|
|
|
|
/// length = 10,
|
|
|
|
/// radius = 5,
|
|
|
|
/// axis = {
|
|
|
|
/// direction = [0, 0, 1.0],
|
|
|
|
/// origin = [0, 0.25, 0]
|
|
|
|
/// }
|
|
|
|
/// )
|
|
|
|
///
|
|
|
|
/// // Create a spring by sweeping around the helix path.
|
|
|
|
/// springSketch = startSketchOn(XY)
|
|
|
|
/// |> circle( center = [0, 0], radius = 1 )
|
|
|
|
/// |> sweep(path = helixPath)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Create a helix on a cylinder.
|
|
|
|
///
|
|
|
|
/// part001 = startSketchOn(XY)
|
2025-04-30 13:12:40 +12:00
|
|
|
/// |> circle( center = [5, 5], radius= 10 )
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> extrude(length = 10)
|
|
|
|
///
|
|
|
|
/// helix(
|
|
|
|
/// angleStart = 0,
|
|
|
|
/// ccw = true,
|
|
|
|
/// revolutions = 16,
|
|
|
|
/// cylinder = part001,
|
|
|
|
/// )
|
|
|
|
/// ```
|
|
|
|
@(impl = std_rust)
|
|
|
|
export fn helix(
|
|
|
|
/// Number of revolutions.
|
|
|
|
revolutions: number(_),
|
2025-04-23 10:58:35 +12:00
|
|
|
/// Start angle.
|
2025-04-14 05:58:19 -04:00
|
|
|
angleStart: number(Angle),
|
2025-04-03 22:44:52 +13:00
|
|
|
/// Is the helix rotation counter clockwise? The default is `false`.
|
|
|
|
ccw?: bool,
|
|
|
|
/// Radius of the helix.
|
|
|
|
@(include_in_snippet = true)
|
2025-04-14 05:58:19 -04:00
|
|
|
radius?: number(Length),
|
2025-04-03 22:44:52 +13:00
|
|
|
/// Axis to use for the helix.
|
|
|
|
@(include_in_snippet = true)
|
|
|
|
axis?: Axis3d | Edge,
|
|
|
|
/// Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used.
|
|
|
|
@(include_in_snippet = true)
|
2025-04-14 05:58:19 -04:00
|
|
|
length?: number(Length),
|
2025-04-03 22:44:52 +13:00
|
|
|
/// Cylinder to create the helix on.
|
|
|
|
cylinder?: Solid,
|
|
|
|
): Helix {}
|
|
|
|
|
|
|
|
/// Rotate a sketch around some provided axis, creating a solid from its extent.
|
|
|
|
///
|
|
|
|
/// This, like extrude, is able to create a 3-dimensional solid from a
|
|
|
|
/// 2-dimensional sketch. However, unlike extrude, this creates a solid
|
|
|
|
/// by using the extent of the sketch as its revolved around an axis rather
|
|
|
|
/// than using the extent of the sketch linearly translated through a third
|
|
|
|
/// dimension.
|
|
|
|
///
|
|
|
|
/// Revolve occurs around a local sketch axis rather than a global axis.
|
|
|
|
///
|
|
|
|
/// You can provide more than one sketch to revolve, and they will all be
|
|
|
|
/// revolved around the same axis.
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// part001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [4, 12])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [2, 0])
|
|
|
|
/// |> line(end = [0, -6])
|
|
|
|
/// |> line(end = [4, -6])
|
|
|
|
/// |> line(end = [0, -6])
|
|
|
|
/// |> line(end = [-3.75, -4.5])
|
|
|
|
/// |> line(end = [0, -5.5])
|
|
|
|
/// |> line(end = [-2, 0])
|
|
|
|
/// |> close()
|
|
|
|
/// |> revolve(axis = Y) // default angle is 360
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // A donut shape.
|
|
|
|
/// sketch001 = startSketchOn(XY)
|
|
|
|
/// |> circle( center = [15, 0], radius = 5 )
|
|
|
|
/// |> revolve(
|
|
|
|
/// angle = 360,
|
|
|
|
/// axis = Y,
|
|
|
|
/// )
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// part001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [4, 12])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [2, 0])
|
|
|
|
/// |> line(end = [0, -6])
|
|
|
|
/// |> line(end = [4, -6])
|
|
|
|
/// |> line(end = [0, -6])
|
|
|
|
/// |> line(end = [-3.75, -4.5])
|
|
|
|
/// |> line(end = [0, -5.5])
|
|
|
|
/// |> line(end = [-2, 0])
|
|
|
|
/// |> close()
|
|
|
|
/// |> revolve(axis = Y, angle = 180)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// part001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [4, 12])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [2, 0])
|
|
|
|
/// |> line(end = [0, -6])
|
|
|
|
/// |> line(end = [4, -6])
|
|
|
|
/// |> line(end = [0, -6])
|
|
|
|
/// |> line(end = [-3.75, -4.5])
|
|
|
|
/// |> line(end = [0, -5.5])
|
|
|
|
/// |> line(end = [-2, 0])
|
|
|
|
/// |> close()
|
|
|
|
/// |> revolve(axis = Y, angle = 180)
|
|
|
|
///
|
2025-04-14 05:58:19 -04:00
|
|
|
/// part002 = startSketchOn(part001, face = END)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [4.5, -5])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [0, 5])
|
|
|
|
/// |> line(end = [5, 0])
|
|
|
|
/// |> line(end = [0, -5])
|
|
|
|
/// |> close()
|
|
|
|
/// |> extrude(length = 5)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// box = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [0, 20])
|
|
|
|
/// |> line(end = [20, 0])
|
|
|
|
/// |> line(end = [0, -20])
|
|
|
|
/// |> close()
|
|
|
|
/// |> extrude(length = 20)
|
|
|
|
///
|
2025-04-14 05:58:19 -04:00
|
|
|
/// sketch001 = startSketchOn(box, face = END)
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> circle( center = [10,10], radius = 4 )
|
|
|
|
/// |> revolve(
|
|
|
|
/// angle = -90,
|
|
|
|
/// axis = Y
|
|
|
|
/// )
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// box = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [0, 20])
|
|
|
|
/// |> line(end = [20, 0])
|
|
|
|
/// |> line(end = [0, -20], tag = $revolveAxis)
|
|
|
|
/// |> close()
|
|
|
|
/// |> extrude(length = 20)
|
|
|
|
///
|
2025-04-14 05:58:19 -04:00
|
|
|
/// sketch001 = startSketchOn(box, face = END)
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> circle( center = [10,10], radius = 4 )
|
|
|
|
/// |> revolve(
|
|
|
|
/// angle = 90,
|
|
|
|
/// axis = getOppositeEdge(revolveAxis)
|
|
|
|
/// )
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// box = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [0, 20])
|
|
|
|
/// |> line(end = [20, 0])
|
|
|
|
/// |> line(end = [0, -20], tag = $revolveAxis)
|
|
|
|
/// |> close()
|
|
|
|
/// |> extrude(length = 20)
|
|
|
|
///
|
2025-04-14 05:58:19 -04:00
|
|
|
/// sketch001 = startSketchOn(box, face = END)
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> circle( center = [10,10], radius = 4 )
|
|
|
|
/// |> revolve(
|
|
|
|
/// angle = 90,
|
|
|
|
/// axis = getOppositeEdge(revolveAxis),
|
|
|
|
/// tolerance = 0.0001
|
|
|
|
/// )
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// sketch001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [10, 0])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [5, -5])
|
|
|
|
/// |> line(end = [5, 5])
|
|
|
|
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|
|
/// |> close()
|
|
|
|
///
|
|
|
|
/// part001 = revolve(
|
|
|
|
/// sketch001,
|
|
|
|
/// axis = {
|
|
|
|
/// direction = [0.0, 1.0],
|
2025-04-30 13:12:40 +12:00
|
|
|
/// origin = [0.0, 0.0]
|
2025-04-03 22:44:52 +13:00
|
|
|
/// }
|
|
|
|
/// )
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Revolve two sketches around the same axis.
|
|
|
|
///
|
|
|
|
/// sketch001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// profile001 = startProfile(sketch001, at = [4, 8])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> xLine(length = 3)
|
|
|
|
/// |> yLine(length = -3)
|
|
|
|
/// |> xLine(length = -3)
|
|
|
|
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|
|
/// |> close()
|
|
|
|
///
|
2025-04-25 16:01:35 -05:00
|
|
|
/// profile002 = startProfile(sketch001, at = [-5, 8])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> xLine(length = 3)
|
|
|
|
/// |> yLine(length = -3)
|
|
|
|
/// |> xLine(length = -3)
|
|
|
|
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|
|
/// |> close()
|
|
|
|
///
|
|
|
|
/// revolve(
|
|
|
|
/// [profile001, profile002],
|
|
|
|
/// axis = X,
|
|
|
|
/// )
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Revolve around a path that has not been extruded.
|
|
|
|
///
|
|
|
|
/// profile001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [0, 20], tag = $revolveAxis)
|
|
|
|
/// |> line(end = [20, 0])
|
|
|
|
/// |> line(end = [0, -20])
|
|
|
|
/// |> close(%)
|
|
|
|
///
|
|
|
|
/// sketch001 = startSketchOn(XY)
|
|
|
|
/// |> circle(center = [-10, 10], radius = 4)
|
|
|
|
/// |> revolve(angle = 90, axis = revolveAxis)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Revolve around a path that has not been extruded or closed.
|
|
|
|
///
|
|
|
|
/// profile001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-03 22:44:52 +13:00
|
|
|
/// |> line(end = [0, 20], tag = $revolveAxis)
|
|
|
|
/// |> line(end = [20, 0])
|
|
|
|
///
|
|
|
|
/// sketch001 = startSketchOn(XY)
|
|
|
|
/// |> circle(center = [-10, 10], radius = 4)
|
|
|
|
/// |> revolve(angle = 90, axis = revolveAxis)
|
|
|
|
/// ```
|
2025-04-10 15:46:10 +01:00
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Symmetrically revolve around a path.
|
|
|
|
///
|
|
|
|
/// profile001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-10 15:46:10 +01:00
|
|
|
/// |> line(end = [0, 20], tag = $revolveAxis)
|
|
|
|
/// |> line(end = [20, 0])
|
|
|
|
///
|
|
|
|
/// sketch001 = startSketchOn(XY)
|
|
|
|
/// |> circle(center = [-10, 10], radius = 4)
|
|
|
|
/// |> revolve(angle = 90, axis = revolveAxis, symmetric = true)
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Bidirectional revolve around a path.
|
|
|
|
///
|
|
|
|
/// profile001 = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-10 15:46:10 +01:00
|
|
|
/// |> line(end = [0, 20], tag = $revolveAxis)
|
|
|
|
/// |> line(end = [20, 0])
|
|
|
|
///
|
|
|
|
/// sketch001 = startSketchOn(XY)
|
|
|
|
/// |> circle(center = [-10, 10], radius = 4)
|
|
|
|
/// |> revolve(angle = 90, axis = revolveAxis, bidirectionalAngle = 50)
|
|
|
|
/// ```
|
2025-04-03 22:44:52 +13:00
|
|
|
@(impl = std_rust)
|
|
|
|
export fn revolve(
|
|
|
|
/// The sketch or set of sketches that should be revolved
|
|
|
|
@sketches: [Sketch; 1+],
|
|
|
|
/// Axis of revolution.
|
|
|
|
axis: Axis2d | Edge,
|
|
|
|
/// Angle to revolve (in degrees). Default is 360.
|
2025-04-14 05:58:19 -04:00
|
|
|
angle?: number(Angle),
|
2025-04-03 22:44:52 +13:00
|
|
|
/// Tolerance for the revolve operation.
|
2025-04-14 05:58:19 -04:00
|
|
|
tolerance?: number(Length),
|
2025-04-10 15:46:10 +01:00
|
|
|
/// If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch.
|
|
|
|
symmetric?: bool,
|
|
|
|
/// If specified, will also revolve in the opposite direction to 'angle' to the specified angle. If 'symmetric' is true, this value is ignored.
|
2025-04-14 05:58:19 -04:00
|
|
|
bidirectionalAngle?: number(Angle),
|
2025-04-03 22:44:52 +13:00
|
|
|
/// A named tag for the face at the start of the revolve, i.e. the original sketch.
|
|
|
|
tagStart?: tag,
|
|
|
|
/// A named tag for the face at the end of the revolve.
|
|
|
|
tagEnd?: tag,
|
|
|
|
): Solid {}
|
2025-04-23 10:58:35 +12:00
|
|
|
|
2025-04-24 22:01:27 +12:00
|
|
|
/// Offset a plane by a distance along its normal.
|
|
|
|
///
|
|
|
|
/// For example, if you offset the `XZ` plane by 10, the new plane will be parallel to the `XZ`
|
|
|
|
/// plane and 10 units away from it.
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Loft a square and a circle on the `XY` plane using offset.
|
|
|
|
/// squareSketch = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [-100, 200])
|
2025-04-24 22:01:27 +12:00
|
|
|
/// |> line(end = [200, 0])
|
|
|
|
/// |> line(end = [0, -200])
|
|
|
|
/// |> line(end = [-200, 0])
|
|
|
|
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|
|
/// |> close()
|
|
|
|
///
|
|
|
|
/// circleSketch = startSketchOn(offsetPlane(XY, offset = 150))
|
|
|
|
/// |> circle( center = [0, 100], radius = 50 )
|
|
|
|
///
|
|
|
|
/// loft([squareSketch, circleSketch])
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Loft a square and a circle on the `XZ` plane using offset.
|
|
|
|
/// squareSketch = startSketchOn(XZ)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [-100, 200])
|
2025-04-24 22:01:27 +12:00
|
|
|
/// |> line(end = [200, 0])
|
|
|
|
/// |> line(end = [0, -200])
|
|
|
|
/// |> line(end = [-200, 0])
|
|
|
|
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|
|
/// |> close()
|
|
|
|
///
|
|
|
|
/// circleSketch = startSketchOn(offsetPlane(XZ, offset = 150))
|
|
|
|
/// |> circle( center = [0, 100], radius = 50 )
|
|
|
|
///
|
|
|
|
/// loft([squareSketch, circleSketch])
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Loft a square and a circle on the `YZ` plane using offset.
|
|
|
|
/// squareSketch = startSketchOn(YZ)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [-100, 200])
|
2025-04-24 22:01:27 +12:00
|
|
|
/// |> line(end = [200, 0])
|
|
|
|
/// |> line(end = [0, -200])
|
|
|
|
/// |> line(end = [-200, 0])
|
|
|
|
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|
|
/// |> close()
|
|
|
|
///
|
|
|
|
/// circleSketch = startSketchOn(offsetPlane(YZ, offset = 150))
|
|
|
|
/// |> circle( center = [0, 100], radius = 50 )
|
|
|
|
///
|
|
|
|
/// loft([squareSketch, circleSketch])
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // Loft a square and a circle on the `-XZ` plane using offset.
|
|
|
|
/// squareSketch = startSketchOn(-XZ)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [-100, 200])
|
2025-04-24 22:01:27 +12:00
|
|
|
/// |> line(end = [200, 0])
|
|
|
|
/// |> line(end = [0, -200])
|
|
|
|
/// |> line(end = [-200, 0])
|
|
|
|
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|
|
/// |> close()
|
|
|
|
///
|
|
|
|
/// circleSketch = startSketchOn(offsetPlane(-XZ, offset = 150))
|
|
|
|
/// |> circle(center = [0, 100], radius = 50)
|
|
|
|
///
|
|
|
|
/// loft([squareSketch, circleSketch])
|
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// // A circle on the XY plane
|
|
|
|
/// startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-24 22:01:27 +12:00
|
|
|
/// |> circle( radius = 10, center = [0, 0] )
|
|
|
|
///
|
|
|
|
/// // Triangle on the plane 4 units above
|
|
|
|
/// startSketchOn(offsetPlane(XY, offset = 4))
|
2025-04-25 16:01:35 -05:00
|
|
|
/// |> startProfile(at = [0, 0])
|
2025-04-24 22:01:27 +12:00
|
|
|
/// |> line(end = [10, 0])
|
|
|
|
/// |> line(end = [0, 10])
|
|
|
|
/// |> close()
|
|
|
|
/// ```
|
|
|
|
@(impl = std_rust)
|
|
|
|
export fn offsetPlane(
|
|
|
|
/// The plane (e.g. `XY`) which this new plane is created from.
|
|
|
|
@plane: Plane,
|
|
|
|
/// Distance from the standard plane this new plane will be created at.
|
|
|
|
offset: number(Length),
|
|
|
|
): Plane {}
|