add_spring
Add a helical compression spring to a mechanical design by specifying wire diameter, outer diameter, free length, and coils. Returns spring rate and dimensions.
Instructions
Add a helical compression spring: a round wire swept along a cylindrical helix.
All lengths in mm; angles n/a. wire_diameter: wire (stock) diameter d, mm. outer_diameter: spring outer diameter OD, mm (must be > wire_diameter). free_length: uncompressed overall length along the axis, mm. coils: number of turns (active coils), may be fractional. kind: 'compression' (only supported mode in v1; end coils are not squared yet). placement: optional [x, y, z] mm translation of the spring's base.
Geometry: mean coil diameter D = outer_diameter - wire_diameter; coil pitch = free_length / coils. Spring rate is computed for STEEL (shear modulus G = 79.3 GPa) as k = Gd^4 / (8D^3*coils), reported in N/mm.
Returns {handle, name, volume (mm^3), mean_diameter (mm), free_length (mm), coils, kind, solid_height (mm, = coils*wire_diameter, the fully-compressed block height), spring_rate_n_per_mm (N/mm)}. Use free_length, solid_height and spring_rate_n_per_mm to spec the spring into a mechanism (available travel = free_length - solid_height; force = spring_rate_n_per_mm * deflection).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | compression | |
| name | No | Spring | |
| coils | Yes | ||
| placement | No | ||
| free_length | Yes | ||
| wire_diameter | Yes | ||
| outer_diameter | Yes |