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

Merge branch 'AlexVerschoot-master'

This commit is contained in:
Chris Palmer
2025-02-22 12:18:10 +00:00
5 changed files with 188 additions and 45 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 KiB

After

Width:  |  Height:  |  Size: 1018 KiB

View File

@@ -7220,9 +7220,9 @@ allows flexible positioning of the motors.
### Modules
| Module | Description |
|:--- |:--- |
| `coreXY(type, size, pos, separation, x_gap = 0, plain_idler_offset = [0, 0], upper_drive_pulley_offset = [0, 0], lower_drive_pulley_offset = [0, 0], show_pulleys = false, left_lower = false)` | Wrapper module to draw both belts of a coreXY setup |
| `coreXY(type, size, pos, separation, x_gap = 0, plain_idler_offset = [0, 0], upper_drive_pulley_offset = [0, 0], lower_drive_pulley_offset = [0, 0], show_pulleys = false, left_lower = false, motor_back = false)` | Wrapper module to draw both belts of a coreXY setup |
| `coreXY_belts(type, carriagePosition, coreXYPosBL, coreXYPosTR, separation, x_gap = 0, plain_idler_offset = [0, 0], upper_drive_pulley_offset = [0, 0], lower_drive_pulley_offset = [0, 0], show_pulleys = false, left_lower = false)` | Draw the coreXY belts |
| `coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_offset = [0, 0], drive_pulley_offset = [0, 0], show_pulleys = false, lower_belt = false, hflip = false)` | Draw one belt of a coreXY setup |
| `coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_offset = [0, 0], drive_pulley_offset = [0, 0], show_pulleys = false, lower_belt = false, hflip = false, motor_back = false)` | Draw one belt of a coreXY setup |
![core_xy](tests/png/core_xy.png)
@@ -7231,12 +7231,15 @@ allows flexible positioning of the motors.
| ---:|:--- |:---|
| 1 | `belt(GT2x6, [ ... ])` | Belt GT2 x 6mm x 728mm |
| 1 | `belt(GT2x6, [ ... ])` | Belt GT2 x 6mm x 790mm |
| 7 | `pulley(GT2x16_toothed_idler)` | Pulley GT2 idler 16 teeth |
| 3 | `pulley(GT2x16_plain_idler)` | Pulley GT2 idler smooth 9.63mm |
| 2 | `pulley(GT2x20ob_pulley)` | Pulley GT2OB 20 teeth |
| 1 | `belt(GT2x6, [ ... ])` | Belt GT2 x 6mm x 826mm |
| 1 | `belt(GT2x6, [ ... ])` | Belt GT2 x 6mm x 826mm |
| 2 | `belt(GT2x6, [ ... ])` | Belt GT2 x 6mm x 836mm |
| 15 | `pulley(GT2x16_toothed_idler)` | Pulley GT2 idler 16 teeth |
| 15 | `pulley(GT2x16_plain_idler)` | Pulley GT2 idler smooth 9.63mm |
| 6 | `pulley(GT2x20ob_pulley)` | Pulley GT2OB 20 teeth |
| 8 | `screw(M3_cap_screw, 20)` | Screw M3 cap x 20mm |
| 4 | `screw(M3_grub_screw, 6)` | Screw M3 grub x 6mm |
| 2 | `NEMA(NEMA17_40)` | Stepper motor NEMA17 x 40mm (5x20 shaft) |
| 12 | `screw(M3_grub_screw, 6)` | Screw M3 grub x 6mm |
| 6 | `NEMA(NEMA17_40)` | Stepper motor NEMA17 x 40mm (5x20 shaft) |
<a href="#top">Top</a>

View File

@@ -132,5 +132,57 @@ module coreXY_belts_test() {
}
}
if ($preview)
module coreXY_motor_in_back_test1() {
size = [200,200];
pos = [100,100];
separation = [20,5,10];
coreXY(coreXY_GT2_20_16, size, pos, separation, x_gap = 0, plain_idler_offset = [0, 0], upper_drive_pulley_offset = [0, 0], lower_drive_pulley_offset = [0, 0], show_pulleys = true, left_lower = false, motor_back = true);
rotate([180,0,0])
translate (
[ separation.x/2
, 0
, -separation.z/2 -15 ])
NEMA(NEMA17_40);
translate (
[ size.x - separation.x/2
, 0
, -separation.z/2 - 15 ])
NEMA(NEMA17_40);
}
module coreXY_motor_in_back_test2() {
size = [200,200];
pos = [100,100];
separation = [0,5,10];
upper_drive_pulley_offset = [20, 5];
lower_drive_pulley_offset = [20, 5];
coreXY(coreXY_GT2_20_16, size, pos, separation, x_gap = 0, plain_idler_offset = [20, 0], upper_drive_pulley_offset, lower_drive_pulley_offset, show_pulleys = true, left_lower = false, motor_back = true);
translate (
[ size.x - separation.x/2 - lower_drive_pulley_offset.x
, lower_drive_pulley_offset.y
, -separation.z/2 - 15 ])
NEMA(NEMA17_40);
translate (
[ separation.x/2 + upper_drive_pulley_offset.x
, upper_drive_pulley_offset.y
, separation.z/2 - 25 ])
NEMA(NEMA17_40);
}
if ($preview) {
coreXY_belts_test();
translate ([-250, 0,0])
coreXY_motor_in_back_test1();
translate ([-250, -250,0])
coreXY_motor_in_back_test2();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 187 KiB

162
utils/core_xy.scad Normal file → Executable file
View File

@@ -68,41 +68,61 @@ function coreXY_drive_plain_idler_offset(type) = //! Offset of plain drive idler
[ coreXY_plain_idler_offset(type).x, -(pulley_od(coreXY_plain_idler(type)) + pulley_od(coreXY_drive_pulley(type))) / 2, 0 ];
module coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_offset = [0, 0], drive_pulley_offset = [0, 0], show_pulleys = false, lower_belt = false, hflip = false) { //! Draw one belt of a coreXY setup
module coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_offset = [0, 0], drive_pulley_offset = [0, 0], show_pulleys = false, lower_belt = false, hflip = false, motor_back = false) { //! Draw one belt of a coreXY setup
// y-carriage toothed pulley
p0_type = coreXY_toothed_idler(type);
p0 = [ size.x / 2, -size.y / 2 - pulley_od(p0_type) / 2 + pos.y - separation_y / 2 ];
p0t_type = coreXY_toothed_idler(type);
p0p_type = coreXY_plain_idler(type);
p0t = [ size.x / 2, -size.y / 2 - pulley_od(p0t_type) / 2 + pos.y - separation_y / 2 ];
p0p = [ size.x / 2, -size.y / 2 - pulley_od(p0p_type) / 2 + pos.y - separation_y / 2 ];
// bottom right toothed idler pulley
p1_type = p0_type;
p1t_type = p0t_type;
p1p_type = p0p_type;
p1 = [ size.x / 2, -size.y / 2 ];
// bottom left anchor toothed idler pulley
p2_type = p0_type;
p2_type = coreXY_toothed_idler(type);
p2 = [ -size.x / 2, -size.y / 2 ];
//drive type if the motor is in the back
p2d_type = coreXY_drive_pulley(type);
p2d = [ lower_belt ? p2.x - drive_pulley_offset.x:p2.x + drive_pulley_offset.x,
p2.y + drive_pulley_offset.y
];
// plain idler for offset stepper motor if the motor is in the back
p2p_type = coreXY_plain_idler(type);
p2p = [ lower_belt ? p2.x + plain_idler_offset.x - drive_pulley_offset.x : p2.x + plain_idler_offset.x + drive_pulley_offset.x,
p2.y + plain_idler_offset.y
];
// stepper motor drive pulley
// stepper motor drive pulley if motor not in back
p3d_type = coreXY_drive_pulley(type);
p3d = [ -size.x / 2 + coreXY_drive_pulley_x_alignment(type) + drive_pulley_offset.x,
size.y / 2 + drive_pulley_offset.y
];
// toothed idler for offset stepper motor drive pulley
// toothed idler for offset stepper motor drive pulley if motor not in back
p3t_type = coreXY_toothed_idler(type);
p3t = [ -size.x / 2 + (drive_pulley_offset.x > 0 ? 0 : plain_idler_offset.x + 2 * coreXY_drive_pulley_x_alignment(type)),
p3t = [ -size.x / 2 + ((drive_pulley_offset.x > 0 || motor_back ) ? 0 : plain_idler_offset.x + 2 * coreXY_drive_pulley_x_alignment(type)),
size.y / 2 + coreXY_drive_pulley_x_alignment(type)
];
// y-carriage plain pulley
p4_type = coreXY_plain_idler(type);
p4t_type = coreXY_toothed_idler(type);
p4 = [ -size.x / 2 + pulley_od(p4_type) / 2 + pulley_od(p3d_type) / 2 + coreXY_drive_pulley_x_alignment(type) + (drive_pulley_offset.x == 0 ? 0 : plain_idler_offset.x),
-size.y / 2 + pulley_od(p4_type) / 2 + pos.y + separation_y / 2
];
p4mb = [-size.x / 2 + pulley_od(p4_type) / 2 + pulley_od(p3t_type) / 2 + coreXY_drive_pulley_x_alignment(type),
-size.y / 2 + pulley_od(p4_type) / 2 + pos.y + separation_y / 2];
// plain idler for offset stepper motor drive pulley
// plain idler for offset stepper motor drive pulley if motor not in back
p3p_type = p4_type;
p3p = [ drive_pulley_offset.x > 0 ? p4.x : -p0.x - pulley_od(p0_type),
p3p = [ drive_pulley_offset.x > 0 ? p4.x : -p0p.x - pulley_od(p0p_type),
size.y / 2 - pulley_od(p3p_type) / 2 - pulley_od(p3d_type) / 2 + plain_idler_offset.y
];
@@ -110,7 +130,7 @@ module coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_off
start_p = [ pos.x - size.x / 2 + x_gap / 2, -size.y / 2 + pos.y - separation_y / 2, 0 ];
end_p = [ pos.x - size.x / 2 - x_gap / 2, -size.y / 2 + pos.y + separation_y / 2, 0 ];
//p6_type = p0_type;
//p6_type = p0p_type;
module show_pulleys(show_pulleys) {// Allows the pulley colour to be set for debugging
if (is_list(show_pulleys))
@@ -121,33 +141,81 @@ module coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_off
}
show_pulleys(show_pulleys) {
translate(p0)
pulley_assembly(p0_type); // y-carriage toothed pulley
if ( !motor_back ) {
translate(p0t)
pulley_assembly(p0t_type); // y-carriage toothed pulley
translate(p1)
pulley_assembly(p1t_type); // bottom right toothed idler pulley
translate(p2)
pulley_assembly(p2_type); // bottom left anchor toothed idler pulley
translate(p3d)
hflip(hflip)
pulley_assembly(p3d_type); // top left stepper motor drive pulley
translate(p1)
pulley_assembly(p1_type); // bottom right toothed idler pulley
if (drive_pulley_offset.x ) { // idler pulleys for offset stepper motor drive pulley
translate(p3t)
pulley_assembly(p3t_type); // toothed idler
translate(p2)
pulley_assembly(p2_type); // bottom left anchor toothed idler pulley
translate(p3d)
hflip(hflip)
pulley_assembly(p3d_type); // top left stepper motor drive pulley
if (drive_pulley_offset.x) { // idler pulleys for offset stepper motor drive pulley
translate(p3t)
pulley_assembly(p3t_type); // toothed idler
translate(p3p)
pulley_assembly(p3p_type); // plain idler
translate(p3p)
pulley_assembly(p3p_type); // plain idler
}
translate(p4)
pulley_assembly(p4_type); // y-carriage plain pulley
}
translate(p4)
pulley_assembly(p4_type); // y-carriage plain pulley
else { //motor in the back
if (drive_pulley_offset.x ) { // idler pulleys for offset stepper motor drive pulley
translate(p0p)
pulley_assembly(p0p_type); // y-carriage plain pulley
translate(p1)
pulley_assembly(p1p_type); // bottom right plain idler pulley
//left bottom corner
translate(p2)
pulley_assembly(p2p_type); // plain idler
translate(p2p)
pulley_assembly(p2p_type); // plain idler
translate(p2d)
hflip(hflip)
pulley_assembly(p2d_type); // bottom left stepper motor drive pulley
translate(p3t)
pulley_assembly(p3p_type); // top left plain idler
translate(p4mb)
pulley_assembly(p4t_type); // y-carriage toothed pulley
} else {
translate(p0t)
pulley_assembly(p0t_type); // y-carriage toothed pulley
translate(p1)
pulley_assembly(p1t_type); // bottom right toothed idler pulley
//left bottom corner
// bottom left stepper motor drive pulley
translate(p2)
if(lower_belt)
hflip(hflip)
pulley_assembly(p2d_type);
else
hflip(!hflip)
pulley_assembly(p2d_type);
translate(p3t)
pulley_assembly(p3t_type); // top left toothed idler
translate(p4mb)
pulley_assembly(p4_type); // y-carriage plain pulley
}
}
}
path0a = [
[ p0.x, p0.y, pulley_od(p0_type) / 2 ],
[ p1.x, p1.y, pulley_od(p1_type) / 2 ],
[ p0p.x, p0p.y, pulley_od(p0p_type) / 2 ],
[ p1.x, p1.y, pulley_od(p1p_type) / 2 ],
[ p2.x, p2.y, pulley_od(p2_type) / 2 ]
];
path0b = [
@@ -169,8 +237,28 @@ module coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_off
belt = coreXY_belt(type);
path0 = drive_pulley_offset.x == 0 ? concat(path0a, path0b) : drive_pulley_offset.x > 0 ? concat(path0a, path0c) : concat(path0a, path0d);
path = concat([start_p], path0, [end_p]);
path0 = drive_pulley_offset.x == 0 ? concat(path0a, path0b) : drive_pulley_offset.x > 0 ? concat(path0a, path0c) : concat(path0a, path0d);
path_mb_0a = [
[ p0p.x, p0p.y, pulley_od(p0p_type) / 2 ],
[ p1.x, p1.y, pulley_od(p1p_type) / 2 ],
[ p2.x, p2.y, pulley_od(p2d_type) / 2 ],
[ p3t.x, p3t.y, pulley_od(p3t_type) / 2 ],
[ p4mb.x, p4mb.y, -pulley_od(p4_type) / 2 ]
];
path_mb_0b = [
[ p0t.x, p0t.y, pulley_od(p0t_type) / 2 ],
[ p1.x, p1.y, pulley_od(p1p_type) / 2 ],
[ p2p.x, p2p.y, pulley_od(p2p_type) / 2 ],
[ p2d.x, p2d.y, -pulley_od(p2d_type) / 2 ],
[ p2.x, p2.y, pulley_od(p2p_type) / 2 ],
[ p3t.x, p3t.y, pulley_od(p3p_type) / 2 ],
[ p4mb.x, p4mb.y, -pulley_od(p4_type) / 2 ]
];
path_mb0 = drive_pulley_offset.x == 0 ? path_mb_0a : path_mb_0b;
path = motor_back? concat([start_p], path_mb0, [end_p]):concat([start_p], path0, [end_p]);
belt(type = belt,
points = path,
@@ -179,18 +267,18 @@ module coreXY_half(type, size, pos, separation_y = 0, x_gap = 0, plain_idler_off
tooth_colour = lower_belt ? coreXY_lower_tooth_colour(type) : coreXY_upper_tooth_colour(type));
}
module coreXY(type, size, pos, separation, x_gap = 0, plain_idler_offset = [0, 0], upper_drive_pulley_offset = [0, 0], lower_drive_pulley_offset = [0, 0], show_pulleys = false, left_lower = false) { //! Wrapper module to draw both belts of a coreXY setup
module coreXY(type, size, pos, separation, x_gap = 0, plain_idler_offset = [0, 0], upper_drive_pulley_offset = [0, 0], lower_drive_pulley_offset = [0, 0], show_pulleys = false, left_lower = false, motor_back = false) { //! Wrapper module to draw both belts of a coreXY setup
translate([size.x / 2 - separation.x / 2, size.y / 2, -separation.z / 2]) {
// lower belt
hflip(!left_lower)
explode(25)
coreXY_half(type, size, [size.x - pos.x - separation.x/2 - (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, [-lower_drive_pulley_offset.x, lower_drive_pulley_offset.y], show_pulleys, lower_belt = true, hflip = true);
coreXY_half(type, size, [size.x - pos.x - separation.x/2 - (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, [-lower_drive_pulley_offset.x, lower_drive_pulley_offset.y], show_pulleys, lower_belt = true, hflip = true, motor_back);
// upper belt
translate([separation.x, 0, separation.z])
hflip(left_lower)
explode(25)
coreXY_half(type, size, [pos.x + separation.x/2 + (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, upper_drive_pulley_offset, show_pulleys, lower_belt = false, hflip = false);
coreXY_half(type, size, [pos.x + separation.x/2 + (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, upper_drive_pulley_offset, show_pulleys, lower_belt = false, hflip = false, motor_back);
}
}