1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-20 06:11:41 +02:00

poly_cylinder() now has a twist parameter.

This commit is contained in:
Chris Palmer
2020-12-18 09:22:39 +00:00
parent fa658d9eaa
commit 73d814d2fe
4 changed files with 96 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 136 KiB

View File

@@ -21,30 +21,60 @@ include <../utils/core/core.scad>
use <../vitamins/rod.scad>
include <../vitamins/sheets.scad>
module polyholes() {
module positions()
for(i = [1 : 10]) {
translate([(i * i + i) / 2 + 3 * i , 8])
let($r = i / 2)
module positions()
for(i = [1 : 10]) {
translate([(i * i + i) / 2 + 3 * i , 8])
let($r = i / 2)
children();
let(d = i + 0.5)
translate([(d * d + d) / 2 + 3 * d, 19])
let($r = d / 2)
children();
}
let(d = i + 0.5)
translate([(d * d + d) / 2 + 3 * d, 19])
let($r = d / 2)
children();
}
module polyhole_stl() {
stl("polyhole");
stl_colour(pp1_colour) linear_extrude(3, center = true)
linear_extrude(3, center = true)
difference() {
square([100, 27]);
positions()
poly_circle(r = $r);
}
}
positions()
module alt_polyhole_stl() {
holes = [2.5, 2, 1.5];
n = len(holes);
size = [n * 10, 10, 10];
difference() {
translate([-size.x / n / 2, $preview ? 0 : -size.y / 2])
cube($preview ? [size.x, size.y / 2, size.z] : size);
for(i = [0 : n - 1])
translate([i * 10, 0])
if(i % 2)
translate_z(size.z)
poly_cylinder(r = holes[i] / 2, h = 2 * size.z, center = true, twist = i + 1);
else
poly_cylinder(r = holes[i] / 2, h = size.z, center = false, twist = i + 1);
}
}
module polyholes() {
stl_colour(pp1_colour)
polyhole_stl();
positions()
rod(d = 2 * $r, l = 8 * $r + 5);
//
// Alternating polyholes
//
translate([30, -40])
alt_polyhole_stl();
//
// Poly rings
//
ir = 3 / 2;
@@ -74,4 +104,11 @@ module polyholes() {
}
}
polyholes();
if($preview)
polyholes();
else {
polyhole_stl();
translate([50, -20])
alt_polyhole_stl();
}