mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 18:24:28 +02:00
added helix_extrude.scad
This commit is contained in:
38
src/helix_extrude.scad
Normal file
38
src/helix_extrude.scad
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* helix_extrude.scad
|
||||||
|
*
|
||||||
|
* Extrudes a 2D shape along a helix path.
|
||||||
|
*
|
||||||
|
* @copyright Justin Lin, 2017
|
||||||
|
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||||
|
*
|
||||||
|
* @see https://openhome.cc/eGossip/OpenSCAD/lib-helix_extrude.html
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
module helix_extrude(shape_pts, radius, levels, level_dist, vt_dir = "SPI_UP", rt_dir = "CT_CLK", twist = 0, scale = 1.0, triangles = "RADIAL") {
|
||||||
|
frags = $fn > 0 ?
|
||||||
|
($fn >= 3 ? $fn : 3) :
|
||||||
|
max(min(360 / $fa, radius * 6.28318 / $fs), 5);
|
||||||
|
|
||||||
|
v_dir = vt_dir == "SPI_UP" ? 1 : -1;
|
||||||
|
r_dir = rt_dir == "CT_CLK" ? 1 : -1;
|
||||||
|
|
||||||
|
angle_step = 360 / frags * r_dir;
|
||||||
|
initial_angle = atan2(level_dist / frags, 6.28318 * radius / frags) * v_dir * r_dir;
|
||||||
|
|
||||||
|
path_points = helix(
|
||||||
|
radius = radius,
|
||||||
|
levels = levels,
|
||||||
|
level_dist = level_dist,
|
||||||
|
vt_dir = vt_dir,
|
||||||
|
rt_dir = rt_dir
|
||||||
|
);
|
||||||
|
|
||||||
|
angles = [for(i = [0:len(path_points) - 1]) [90 + initial_angle, 0, angle_step * i]];
|
||||||
|
|
||||||
|
polysections(
|
||||||
|
cross_sections(shape_pts, path_points, angles, twist, scale),
|
||||||
|
triangles = triangles
|
||||||
|
);
|
||||||
|
}
|
Reference in New Issue
Block a user