1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-27 09:14:24 +02:00

Added NEMA_connection_pos().

Changed motor wire colours and tweaked wire position and size,
This commit is contained in:
Chris Palmer
2022-06-23 18:24:44 +01:00
parent 0d828f8f7f
commit ecd534b577
4 changed files with 31 additions and 8 deletions

View File

@@ -3887,6 +3887,7 @@ NEMA stepper motor model.
| Function | Description | | Function | Description |
|:--- |:--- | |:--- |:--- |
| `NEMA_big_hole(type)` | Clearance hole for the big boss | | `NEMA_big_hole(type)` | Clearance hole for the big boss |
| `NEMA_connection_pos(type, jst_connector = false)` | Position of the wires or the connector |
| `NEMA_holes(type)` | Screw positions for for loop | | `NEMA_holes(type)` | Screw positions for for loop |
### Modules ### Modules

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@@ -16,18 +16,28 @@
// You should have received a copy of the GNU General Public License along with NopSCADlib. // You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>. // If not, see <https://www.gnu.org/licenses/>.
// //
show_connection_pos = false;
/* [Hidden] */
include <../core.scad> include <../core.scad>
include <../vitamins/stepper_motors.scad> include <../vitamins/stepper_motors.scad>
use <../utils/layout.scad> use <../utils/layout.scad>
has_connector = [NEMA17_27, NEMA17_40, NEMA17_40L280, NEMA8_30, NEMA8_30BH];
module stepper_motors() module stepper_motors()
layout([for(s = stepper_motors) NEMA_width(s)], 5, no_offset = false) let(m = stepper_motors[$i]) { layout([for(s = stepper_motors) NEMA_width(s)], 5, no_offset = false) let(m = stepper_motors[$i]) {
rotate(180) rotate(180) {
NEMA(m, 0, in([NEMA17_27, NEMA17_40, NEMA17_40L280, NEMA8_30, NEMA8_30BH], m)); NEMA(m, 0, in(has_connector, m) ? true : show_connection_pos ? undef : false);
translate_z(4) if(show_connection_pos)
NEMA_screws(m, M3_pan_screw, n = $i - 2, earth = $i > 6 ? undef : $i - 3); translate(NEMA_connection_pos(m, in(has_connector, m)))
sphere();
translate_z(4)
NEMA_screws(m, M3_pan_screw, n = $i - 2, earth = $i > 6 ? undef : $i - 3);
}
} }
if($preview) if($preview)

View File

@@ -51,6 +51,18 @@ stepper_body_colour = grey(20);
stepper_cap_colour = grey(50); stepper_cap_colour = grey(50);
stepper_machined_colour = grey(90); stepper_machined_colour = grey(90);
function NEMA_connection_pos(type, jst_connector = false) = let( //! Position of the wires or the connector
side = NEMA_width(type),
length = NEMA_length(type),
cap = NEMA_cap_heights(type)[1],
hdr = NEMA_end_connector(type) ? jst_zh_header : jst_ph_header,
socket_size = hdr_box_size(hdr),
end_conn_inset = socket_size.y - 2
)
jst_connector ? NEMA_end_connector(type) ? [0, side / 2 + hdr_y_offset(hdr) + socket_size.y / 2 - end_conn_inset, -length]
: [0, side / 2 + socket_size.z, hdr_y_offset(hdr) - socket_size.y / 2 - length + cap]
: [0, side / 2, -length + cap / 2];
module NEMA_outline(type) //! 2D outline module NEMA_outline(type) //! 2D outline
intersection() { intersection() {
side = NEMA_width(type); side = NEMA_width(type);
@@ -185,14 +197,14 @@ module NEMA(type, shaft_angle = 0, jst_connector = false) { //! Draw specified N
not_on_bom() not_on_bom()
leadscrew(shaft_rad * 2, shaft.x + length + shaft2, shaft.y, shaft.z, center = false); leadscrew(shaft_rad * 2, shaft.x + length + shaft2, shaft.y, shaft.z, center = false);
if(!jst_connector) if(jst_connector == false)
translate([0, side / 2, -length + cap / 2]) translate([0, side / 2, -length + cap / 2])
rotate([90, 0, 0]) rotate([90, 0, 0])
for(i = [0 : 3]) for(i = [0 : 3])
rotate(225 + i * 90) rotate(225 + i * 90)
color(["red", "blue","green","black"][i]) color(["red", "green", "black", "blue"][i])
translate([1, 0, 0]) translate([1.48 / sqrt(2), 0, 0])
cylinder(r = 1.5 / 2, h = 12, center = true); cylinder(d = 1.48, h = 12, center = true);
} }
module NEMA_screw_positions(type, n = 4) { //! Positions children at the screw holes module NEMA_screw_positions(type, n = 4) { //! Positions children at the screw holes