Skip to content

Commit 65d0521

Browse files
update learn docs
1 parent 76aa7c4 commit 65d0521

File tree

2 files changed

+62
-12
lines changed

2 files changed

+62
-12
lines changed

docs/learn/code/common/occt/shapes/wire/wire-helix-spirals.md

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,38 @@ import BitByBitRenderCanvas from '@site/src/components/BitByBitRenderCanvas';
1818

1919
# Creating Helix Wires
2020

21+
This tutorial demonstrates how to create three types of helical and spiral wire shapes using OpenCASCADE (OCCT). These curves are fundamental building blocks for modeling springs, threads, coils, and other spiral-based geometries.
22+
23+
## Types of Helix and Spiral Wires
24+
25+
### 1. Regular Helix Wire
26+
A **helix** is a 3D curve that winds around an axis while rising at a constant rate. Think of a spring or a corkscrew. Key parameters include:
27+
- **Radius**: The distance from the central axis to the helix curve
28+
- **Pitch**: The vertical distance covered in one complete revolution (360°)
29+
- **Height**: The total vertical extent of the helix
30+
- **Direction**: The axis around which the helix winds (typically Y-up: `[0, 1, 0]`)
31+
- **Clockwise**: Determines the winding direction when viewed from above
32+
33+
### 2. Flat Spiral Wire (Archimedean Spiral)
34+
A **flat spiral** lies entirely in a plane and expands outward from a center point. This is useful for creating decorative patterns, clock springs, or spiral ramps. Key parameters include:
35+
- **Start Radius**: The inner radius where the spiral begins
36+
- **End Radius**: The outer radius where the spiral ends
37+
- **Number of Turns**: How many complete rotations the spiral makes
38+
- **Direction**: The normal vector of the plane containing the spiral
39+
40+
### 3. Tapered Helix Wire (Conical Helix)
41+
A **tapered helix** combines the rising motion of a regular helix with a changing radius, creating a cone-shaped spiral. This is commonly used for conical springs or decorative elements. Key parameters include:
42+
- **Start Radius**: The radius at the base of the cone
43+
- **End Radius**: The radius at the top of the cone
44+
- **Pitch** and **Height**: Same as a regular helix
45+
46+
## Example Overview
47+
48+
The interactive examples below create all three wire types positioned side by side:
49+
- **Left (x = -8)**: A regular helix with radius 1, pitch 1, and height 5
50+
- **Center (x = 0)**: A flat spiral expanding from radius 0.5 to 5 with 5 turns
51+
- **Right (x = 8)**: A tapered helix narrowing from radius 2 to 0.5
52+
2153
<Tabs groupId="regular-helix-tapered-helix-and-flat-spiral-examples">
2254
<TabItem value="rete" label="Rete">
2355
<BitByBitRenderCanvas
@@ -29,15 +61,33 @@ import BitByBitRenderCanvas from '@site/src/components/BitByBitRenderCanvas';
2961
<TabItem value="blockly" label="Blockly">
3062
<BitByBitRenderCanvas
3163
requireManualStart={true}
32-
script={}
33-
title="Bezier curves with different weight distributions"
64+
script={{"script":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"bitbybit.draw.drawAnyAsyncNoReturn\" id=\"draw1\" x=\"10\" y=\"10\"><value name=\"Entity\"><block type=\"bitbybit.occt.shapes.wire.createHelixWire\" id=\"helix1\"><value name=\"Radius\"><block type=\"math_number\" id=\"r1\"><field name=\"NUM\">1</field></block></value><value name=\"Pitch\"><block type=\"math_number\" id=\"p1\"><field name=\"NUM\">1</field></block></value><value name=\"Height\"><block type=\"math_number\" id=\"h1\"><field name=\"NUM\">5</field></block></value><value name=\"Center\"><block type=\"bitbybit.vector.vectorXYZ\" id=\"c1\"><value name=\"X\"><block type=\"math_number\" id=\"cx1\"><field name=\"NUM\">-8</field></block></value><value name=\"Y\"><block type=\"math_number\" id=\"cy1\"><field name=\"NUM\">0</field></block></value><value name=\"Z\"><block type=\"math_number\" id=\"cz1\"><field name=\"NUM\">0</field></block></value></block></value><value name=\"Direction\"><block type=\"bitbybit.vector.vectorXYZ\" id=\"d1\"><value name=\"X\"><block type=\"math_number\" id=\"dx1\"><field name=\"NUM\">0</field></block></value><value name=\"Y\"><block type=\"math_number\" id=\"dy1\"><field name=\"NUM\">1</field></block></value><value name=\"Z\"><block type=\"math_number\" id=\"dz1\"><field name=\"NUM\">0</field></block></value></block></value><value name=\"Clockwise\"><block type=\"logic_boolean\" id=\"cw1\"><field name=\"BOOL\">FALSE</field></block></value><value name=\"Tolerance\"><block type=\"math_number\" id=\"t1\"><field name=\"NUM\">0.0001</field></block></value></block></value><value name=\"Options\"><block type=\"bitbybit.draw.optionsOcctShapeSimple\" id=\"opt1\"><value name=\"Precision\"><block type=\"math_number\" id=\"prec1\"><field name=\"NUM\">0.01</field></block></value><value name=\"DrawFaces\"><block type=\"logic_boolean\" id=\"df1\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"FaceColour\"><block type=\"colour_picker\" id=\"fc1\"><field name=\"COLOUR\">#ff0000</field></block></value><value name=\"DrawEdges\"><block type=\"logic_boolean\" id=\"de1\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"EdgeColour\"><block type=\"colour_picker\" id=\"ec1\"><field name=\"COLOUR\">#ffffff</field></block></value><value name=\"EdgeWidth\"><block type=\"math_number\" id=\"ew1\"><field name=\"NUM\">2</field></block></value></block></value><next><block type=\"bitbybit.draw.drawAnyAsyncNoReturn\" id=\"draw2\"><value name=\"Entity\"><block type=\"bitbybit.occt.shapes.wire.createFlatSpiralWire\" id=\"spiral1\"><value name=\"StartRadius\"><block type=\"math_number\" id=\"sr1\"><field name=\"NUM\">0.5</field></block></value><value name=\"EndRadius\"><block type=\"math_number\" id=\"er1\"><field name=\"NUM\">5</field></block></value><value name=\"NumTurns\"><block type=\"math_number\" id=\"nt1\"><field name=\"NUM\">5</field></block></value><value name=\"Center\"><block type=\"bitbybit.vector.vectorXYZ\" id=\"c2\"><value name=\"X\"><block type=\"math_number\" id=\"cx2\"><field name=\"NUM\">0</field></block></value><value name=\"Y\"><block type=\"math_number\" id=\"cy2\"><field name=\"NUM\">0</field></block></value><value name=\"Z\"><block type=\"math_number\" id=\"cz2\"><field name=\"NUM\">0</field></block></value></block></value><value name=\"Direction\"><block type=\"bitbybit.vector.vectorXYZ\" id=\"d2\"><value name=\"X\"><block type=\"math_number\" id=\"dx2\"><field name=\"NUM\">0</field></block></value><value name=\"Y\"><block type=\"math_number\" id=\"dy2\"><field name=\"NUM\">1</field></block></value><value name=\"Z\"><block type=\"math_number\" id=\"dz2\"><field name=\"NUM\">0</field></block></value></block></value><value name=\"Clockwise\"><block type=\"logic_boolean\" id=\"cw2\"><field name=\"BOOL\">FALSE</field></block></value><value name=\"Tolerance\"><block type=\"math_number\" id=\"t2\"><field name=\"NUM\">0.0001</field></block></value></block></value><value name=\"Options\"><block type=\"bitbybit.draw.optionsOcctShapeSimple\" id=\"opt2\"><value name=\"Precision\"><block type=\"math_number\" id=\"prec2\"><field name=\"NUM\">0.01</field></block></value><value name=\"DrawFaces\"><block type=\"logic_boolean\" id=\"df2\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"FaceColour\"><block type=\"colour_picker\" id=\"fc2\"><field name=\"COLOUR\">#00ff00</field></block></value><value name=\"DrawEdges\"><block type=\"logic_boolean\" id=\"de2\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"EdgeColour\"><block type=\"colour_picker\" id=\"ec2\"><field name=\"COLOUR\">#ffffff</field></block></value><value name=\"EdgeWidth\"><block type=\"math_number\" id=\"ew2\"><field name=\"NUM\">2</field></block></value></block></value><next><block type=\"bitbybit.draw.drawAnyAsyncNoReturn\" id=\"draw3\"><value name=\"Entity\"><block type=\"bitbybit.occt.shapes.wire.createTaperedHelixWire\" id=\"tapered1\"><value name=\"StartRadius\"><block type=\"math_number\" id=\"tsr1\"><field name=\"NUM\">2</field></block></value><value name=\"EndRadius\"><block type=\"math_number\" id=\"ter1\"><field name=\"NUM\">0.5</field></block></value><value name=\"Pitch\"><block type=\"math_number\" id=\"tp1\"><field name=\"NUM\">1</field></block></value><value name=\"Height\"><block type=\"math_number\" id=\"th1\"><field name=\"NUM\">5</field></block></value><value name=\"Center\"><block type=\"bitbybit.vector.vectorXYZ\" id=\"c3\"><value name=\"X\"><block type=\"math_number\" id=\"cx3\"><field name=\"NUM\">8</field></block></value><value name=\"Y\"><block type=\"math_number\" id=\"cy3\"><field name=\"NUM\">0</field></block></value><value name=\"Z\"><block type=\"math_number\" id=\"cz3\"><field name=\"NUM\">0</field></block></value></block></value><value name=\"Direction\"><block type=\"bitbybit.vector.vectorXYZ\" id=\"d3\"><value name=\"X\"><block type=\"math_number\" id=\"dx3\"><field name=\"NUM\">0</field></block></value><value name=\"Y\"><block type=\"math_number\" id=\"dy3\"><field name=\"NUM\">1</field></block></value><value name=\"Z\"><block type=\"math_number\" id=\"dz3\"><field name=\"NUM\">0</field></block></value></block></value><value name=\"Clockwise\"><block type=\"logic_boolean\" id=\"cw3\"><field name=\"BOOL\">FALSE</field></block></value><value name=\"Tolerance\"><block type=\"math_number\" id=\"t3\"><field name=\"NUM\">0.0001</field></block></value></block></value><value name=\"Options\"><block type=\"bitbybit.draw.optionsOcctShapeSimple\" id=\"opt3\"><value name=\"Precision\"><block type=\"math_number\" id=\"prec3\"><field name=\"NUM\">0.01</field></block></value><value name=\"DrawFaces\"><block type=\"logic_boolean\" id=\"df3\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"FaceColour\"><block type=\"colour_picker\" id=\"fc3\"><field name=\"COLOUR\">#0000ff</field></block></value><value name=\"DrawEdges\"><block type=\"logic_boolean\" id=\"de3\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"EdgeColour\"><block type=\"colour_picker\" id=\"ec3\"><field name=\"COLOUR\">#ffffff</field></block></value><value name=\"EdgeWidth\"><block type=\"math_number\" id=\"ew3\"><field name=\"NUM\">2</field></block></value></block></value></block></next></block></next></block></xml>","type":"blockly"}}
65+
title="Regular helix, tapered helix and flat spiral examples"
3466
/>
3567
</TabItem>
3668
<TabItem value="typescript" label="TypeScript">
3769
<BitByBitRenderCanvas
3870
requireManualStart={true}
39-
script={}
40-
title="Bezier curves with different weight distributions"
71+
script={{"script":"\n// Import DTOs for configuring helix and spiral wire operations\nconst { HelixWireDto, TaperedHelixWireDto, FlatSpiralWireDto } = Bit.Inputs.OCCT;\n// Import DTO for specifying drawing options\nconst { DrawOcctShapeSimpleOptions } = Bit.Inputs.Draw;\n\n// Destructure the bitbybit API to access OCCT wire creation module\nconst { wire } = bitbybit.occt.shapes;\n\n// Define an asynchronous function to execute the main logic\nconst start = async () => {\n\n // --- 1. Create Regular Helix Wire ---\n // A helix is a 3D spiral that rises along an axis\n const helixOptions = new HelixWireDto();\n helixOptions.radius = 1; // Radius of the helix\n helixOptions.pitch = 1; // Height per complete turn\n helixOptions.height = 5; // Total height of the helix\n helixOptions.center = [-8, 0, 0]; // Position it to the left\n helixOptions.direction = [0, 1, 0]; // Helix axis points up (Y direction)\n helixOptions.clockwise = false; // Counter-clockwise winding\n helixOptions.tolerance = 0.0001; // Approximation tolerance\n \n // Create the helix wire asynchronously\n const helixWire = await wire.createHelixWire(helixOptions);\n\n // --- 2. Create Flat Spiral Wire ---\n // A flat spiral lies in a plane and expands outward\n const flatSpiralOptions = new FlatSpiralWireDto();\n flatSpiralOptions.startRadius = 0.5; // Inner starting radius\n flatSpiralOptions.endRadius = 5; // Outer ending radius\n flatSpiralOptions.numTurns = 5; // Number of complete rotations\n flatSpiralOptions.center = [0, 0, 0]; // Centered at origin\n flatSpiralOptions.direction = [0, 1, 0]; // Normal to the spiral plane\n flatSpiralOptions.clockwise = false;\n flatSpiralOptions.tolerance = 0.0001;\n \n // Create the flat spiral wire\n const flatSpiralWire = await wire.createFlatSpiralWire(flatSpiralOptions);\n\n // --- 3. Create Tapered Helix Wire ---\n // A tapered helix has a varying radius (conical helix)\n const taperedHelixOptions = new TaperedHelixWireDto();\n taperedHelixOptions.startRadius = 2; // Larger radius at the bottom\n taperedHelixOptions.endRadius = 0.5; // Smaller radius at the top\n taperedHelixOptions.pitch = 1; // Height per complete turn\n taperedHelixOptions.height = 5; // Total height\n taperedHelixOptions.center = [8, 0, 0]; // Position it to the right\n taperedHelixOptions.direction = [0, 1, 0];\n taperedHelixOptions.clockwise = false;\n taperedHelixOptions.tolerance = 0.0001;\n \n // Create the tapered helix wire\n const taperedHelixWire = await wire.createTaperedHelixWire(taperedHelixOptions);\n\n // --- 4. Draw all three wires with different colors ---\n \n // Draw the regular helix in red\n const helixDrawOptions = new DrawOcctShapeSimpleOptions();\n helixDrawOptions.edgeColour = \"#ff0000\";\n helixDrawOptions.edgeWidth = 2;\n bitbybit.draw.drawAnyAsync({ entity: helixWire, options: helixDrawOptions });\n\n // Draw the flat spiral in green\n const spiralDrawOptions = new DrawOcctShapeSimpleOptions();\n spiralDrawOptions.edgeColour = \"#00ff00\";\n spiralDrawOptions.edgeWidth = 2;\n bitbybit.draw.drawAnyAsync({ entity: flatSpiralWire, options: spiralDrawOptions });\n\n // Draw the tapered helix in blue\n const taperedDrawOptions = new DrawOcctShapeSimpleOptions();\n taperedDrawOptions.edgeColour = \"#0000ff\";\n taperedDrawOptions.edgeWidth = 2;\n bitbybit.draw.drawAnyAsync({ entity: taperedHelixWire, options: taperedDrawOptions });\n\n}\n\n// Execute the main function\nstart();","type":"typescript"}}
72+
title="Regular helix, tapered helix and flat spiral examples"
4173
/>
4274
</TabItem>
4375
</Tabs>
76+
77+
## Practical Applications
78+
79+
These helix and spiral wires serve as the foundation for many real-world modeling scenarios:
80+
81+
- **Springs and Coils**: Use regular or tapered helixes as sweep paths to create compression springs, extension springs, or coil shapes
82+
- **Threads and Screws**: Helixes can define the path for thread profiles when creating bolts, screws, or nuts
83+
- **Spiral Staircases**: Flat spirals or helixes can guide the placement of steps in architectural designs
84+
- **Decorative Elements**: Spirals add visual interest to jewelry, furniture, and artistic designs
85+
- **Pipes and Tubing**: Sweep a circular profile along a helix to create coiled pipes or tubes
86+
87+
## Tips for Working with Helix Wires
88+
89+
1. **Tolerance Parameter**: Lower tolerance values create smoother curves but require more computation. The default `0.0001` provides a good balance for most use cases.
90+
91+
2. **Direction Vector**: The direction defines the axis of rotation. Use `[0, 1, 0]` for vertical helixes, `[1, 0, 0]` for horizontal ones along X, or any normalized vector for custom orientations.
92+
93+
3. **Combining with Other Operations**: These wires can be used with operations like `pipe`, `sweep`, or `loft` to create solid 3D shapes from the wire paths.

docs/static/llms.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,29 +206,29 @@ VS Code MCP Setup:
206206
}
207207
```
208208

209-
### AI Context Files (v1.0.0-rc.0)
209+
### AI Context Files (v1.0.0-rc.1)
210210

211211
Attach these files to your AI coding assistant for Bitbybit API knowledge.
212212

213213
#### Beginner Context (Monaco Editor)
214214

215215
For online TypeScript editor at bitbybit.dev:
216-
- Full Context (116k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.0/bitbybit-babylon-monaco-ai-context-v1.0.0-rc.0.md
216+
- Full Context (116k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.1/bitbybit-babylon-monaco-ai-context-v1.0.0-rc.1.md
217217

218218
#### BabylonJS Context
219219

220-
- Full (116k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.0/bitbybit-babylon-ai-context-v1.0.0-rc.0.md
221-
- Lite (114k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.0/bitbybit-babylon-no-comment-min-ai-v1.0.0-rc.0.md
220+
- Full (116k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.1/bitbybit-babylon-ai-context-v1.0.0-rc.1.md
221+
- Lite (114k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.1/bitbybit-babylon-no-comment-min-ai-v1.0.0-rc.1.md
222222

223223
#### Three.js Context
224224

225-
- Full (95k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.0/bitbybit-three-ai-context-v1.0.0-rc.0.md
226-
- Lite (82k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.0/bitbybit-three-no-comment-min-ai-v1.0.0-rc.0.md
225+
- Full (95k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.1/bitbybit-three-ai-context-v1.0.0-rc.1.md
226+
- Lite (82k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.1/bitbybit-three-no-comment-min-ai-v1.0.0-rc.1.md
227227

228228
#### PlayCanvas Context
229229

230-
- Full (94k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.0/bitbybit-playcanvas-ai-context-v1.0.0-rc.0.md
231-
- Lite (82k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.0/bitbybit-playcanvas-no-comment-min-ai-v1.0.0-rc.0.md
230+
- Full (94k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.1/bitbybit-playcanvas-ai-context-v1.0.0-rc.1.md
231+
- Lite (82k tokens): https://app.bitbybit.dev/assets/ai-prompt-context/v1.0.0-rc.1/bitbybit-playcanvas-no-comment-min-ai-v1.0.0-rc.1.md
232232

233233
### Full API on Github
234234
- API with short explanations: https://github.com/bitbybit-dev/bitbybit/blob/master/docs/API.md

0 commit comments

Comments
 (0)