Files
modeling-app/docs/kcl/std-helix.md
Adam Chalmers f5e3b4bbe7 Update helix snapshots (#6340)
Engine fixed a bug where helices were starting at the wrong position. Requires updating the snapshots.
2025-04-15 17:15:37 -05:00

928 KiB

title, excerpt, layout
title excerpt layout
std::helix Create a helix. manual

Create a helix.

helix(
  revolutions: number(_),
  angleStart: number(Angle),
  ccw?: bool,
  radius?: number(Length),
  axis?: Axis3d | Edge,
  length?: number(Length),
  cylinder?: Solid,
): Helix

Arguments

Name Type Description Required
revolutions number(_) Number of revolutions. Yes
angleStart number(Angle) Start angle (in degrees). Yes
ccw bool Is the helix rotation counter clockwise? The default is false. No
radius number(Length) Radius of the helix. No
axis `Axis3d Edge` Axis to use for the helix.
length number(Length) 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. No
cylinder Solid Cylinder to create the helix on. No

Returns

Helix

Examples

// 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)

Rendered example of std::helix 0

// Create a helix around an edge.
helper001 = startSketchOn(XZ)
 |> startProfileAt([0, 0], %)
 |> 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)

Rendered example of std::helix 1

// 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)

Rendered example of std::helix 2

// Create a helix on a cylinder.

part001 = startSketchOn(XY)
  |> circle( center= [5, 5], radius= 10 )
  |> extrude(length = 10)

helix(
    angleStart = 0,
    ccw = true,
    revolutions = 16,
    cylinder = part001,
 )

Rendered example of std::helix 3