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

Can now specify a rotation angle for a geared_stepper's shaft.

This commit is contained in:
Chris Palmer
2024-06-30 12:30:29 +01:00
parent 7eaca85e96
commit 53d1ea93cd
2 changed files with 14 additions and 13 deletions

View File

@@ -1459,7 +1459,7 @@ Geared tin can steppers
### Modules
| Module | Description |
|:--- |:--- |
| `geared_stepper(type)` | Draw the specified geared stepper |
| `geared_stepper(type, angle = 0)` | Draw the specified geared stepper with optional shaft angle. |
| `geared_stepper_screw_positions(type)` | Place children at the screw positions |
![geared_steppers](tests/png/geared_steppers.png)

View File

@@ -52,7 +52,7 @@ module geared_stepper_screw_positions(type) //! Place children at the screw posi
motor_colour = "#9BA2AC";
gearbox_colour = "#FFF7EE";
module geared_stepper(type) { //! Draw the specified geared stepper
module geared_stepper(type, angle = 0) { //! Draw the specified geared stepper with optional shaft angle.
vitamin(str("geared_stepper(", type[0], "): Geared stepper - ", type[1]));
radius = gs_diameter(type) / 2;
@@ -125,19 +125,20 @@ module geared_stepper(type) { //! Draw the specified geared stepper
f = gs_shaft_flat(type);
two_flats = f < 0;
vflip()
color(two_flats ? brass : gearbox_colour) {
d = gs_shaft_d(type);
h = gs_shaft_length(type);
linear_extrude(h)
intersection() {
circle(d = d);
rotate(angle)
color(two_flats ? brass : gearbox_colour) {
d = gs_shaft_d(type);
h = gs_shaft_length(type);
linear_extrude(h)
intersection() {
circle(d = d);
translate([0, two_flats ? 0 : (f - d) / 2])
square([d + 1, abs(f)], center = true);
}
translate([0, two_flats ? 0 : (f - d) / 2])
square([d + 1, abs(f)], center = true);
}
cylinder(d = d, h = h - gs_flat_length(type));
}
cylinder(d = d, h = h - gs_flat_length(type));
}
// Wire block
color(bulge_z ? "white" : "skyblue") {