1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-11 18:04:02 +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 ### Modules
| Module | Description | | 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_stepper_screw_positions(type)` | Place children at the screw positions |
![geared_steppers](tests/png/geared_steppers.png) ![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"; motor_colour = "#9BA2AC";
gearbox_colour = "#FFF7EE"; 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])); vitamin(str("geared_stepper(", type[0], "): Geared stepper - ", type[1]));
radius = gs_diameter(type) / 2; radius = gs_diameter(type) / 2;
@@ -125,19 +125,20 @@ module geared_stepper(type) { //! Draw the specified geared stepper
f = gs_shaft_flat(type); f = gs_shaft_flat(type);
two_flats = f < 0; two_flats = f < 0;
vflip() vflip()
color(two_flats ? brass : gearbox_colour) { rotate(angle)
d = gs_shaft_d(type); color(two_flats ? brass : gearbox_colour) {
h = gs_shaft_length(type); d = gs_shaft_d(type);
linear_extrude(h) h = gs_shaft_length(type);
intersection() { linear_extrude(h)
circle(d = d); intersection() {
circle(d = d);
translate([0, two_flats ? 0 : (f - d) / 2]) translate([0, two_flats ? 0 : (f - d) / 2])
square([d + 1, abs(f)], center = true); 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 // Wire block
color(bulge_z ? "white" : "skyblue") { color(bulge_z ? "white" : "skyblue") {