mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-12-22 14:53:25 +00:00
Fix cylinder depth; fix chamfer; formatting
- Cylinder depth now consistent across all axes - Chamfer disabled in non-z axes, since that's nonsensical and wasn't working anyway - Cleaned up formatting around math symbols for readability
This commit is contained in:
parent
36345f3efb
commit
0b80167413
1 changed files with 19 additions and 12 deletions
|
@ -95,6 +95,13 @@ module cutCylinders(n_divx=1, n_divy=1, cylinder_diameter=1, cylinder_height=1,
|
||||||
? [90, 0, 0]
|
? [90, 0, 0]
|
||||||
: [0, 0, 0];
|
: [0, 0, 0];
|
||||||
|
|
||||||
|
// When oriented vertically along the z axis, half of the cutting cylinder is in the air
|
||||||
|
// When oriented along the x or y axes, the entire height of the cylinder is cut out
|
||||||
|
cylinder_height = (orientation == 2) ? cylinder_height * 2 : cylinder_height;
|
||||||
|
|
||||||
|
// Chamfer is only enabled for vertical, since it doesn't make sense in other orientations
|
||||||
|
chamfer = (orientation == 2) ? chamfer : 0;
|
||||||
|
|
||||||
gridx_mm = $gxx * l_grid;
|
gridx_mm = $gxx * l_grid;
|
||||||
gridy_mm = $gyy * l_grid;
|
gridy_mm = $gyy * l_grid;
|
||||||
padding = 2;
|
padding = 2;
|
||||||
|
@ -108,7 +115,7 @@ module cutCylinders(n_divx=1, n_divy=1, cylinder_diameter=1, cylinder_height=1,
|
||||||
pattern_linear(x=n_divx, y=n_divy, sx=(gridx_mm - padding) / n_divx, sy=(gridy_mm - padding) / n_divy)
|
pattern_linear(x=n_divx, y=n_divy, sx=(gridx_mm - padding) / n_divx, sy=(gridy_mm - padding) / n_divy)
|
||||||
rotate(rotation)
|
rotate(rotation)
|
||||||
union() {
|
union() {
|
||||||
cylinder(d=cylinder_diameter, h=cylinder_height*2, center=true);
|
cylinder(d=cylinder_diameter, h=cylinder_height, center=true);
|
||||||
if (chamfer > 0) {
|
if (chamfer > 0) {
|
||||||
translate([0, 0, -chamfer]) cylinder(d1=cylinder_diameter, d2=cylinder_diameter + 4 * chamfer, h=2 * chamfer);
|
translate([0, 0, -chamfer]) cylinder(d1=cylinder_diameter, d2=cylinder_diameter + 4 * chamfer, h=2 * chamfer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue