Reimplemented teardrop_plus() again.

This commit is contained in:
Chris Palmer 2020-07-20 16:55:55 +01:00
parent 6a26903514
commit cb4fa40643
9 changed files with 70 additions and 46 deletions

View File

@ -5292,7 +5292,7 @@ Method to print holes in mid air. See <https://hydraraptor.blogspot.com/2014/03/
--- ---
<a name="Horiholes"></a> <a name="Horiholes"></a>
## Horiholes ## Horiholes
Utilities for depicting the staircase slicing of horizontal holes made with [`teardrop_plus()`](#teardrops), see <https://hydraraptor.blogspot.com/2020/07/horiholes_36.html> Utilities for depicting the staircase slicing of horizontal holes made with [`teardrop_plus()`](#teardrops), see <https://hydraraptor.blogspot.com/2020/07/horiholes-2.html>
[utils/horiholes.scad](utils/horiholes.scad) Implementation. [utils/horiholes.scad](utils/horiholes.scad) Implementation.
@ -5302,8 +5302,7 @@ Utilities for depicting the staircase slicing of horizontal holes made with [`te
### Functions ### Functions
| Function | Description | | Function | Description |
|:--- |:--- | |:--- |:--- |
| ```teardrop_plus_x(r, y, h)``` | Calculate the ordinate of a compensated teardrop given y. | | ```teardrop_plus_x(r, y, h)``` | Calculate the ordinate of a compensated teardrop given y and layer height. |
| ```teardrop_x(r, y)``` | Calculate the ordinate of a teardrop given y. Sweeping y from -r to + r yields the positive X half of the shape. |
### Modules ### Modules
| Module | Description | | Module | Description |
@ -5886,7 +5885,7 @@ For making horizontal holes that don't need support material.
Small holes can get away without it, but they print better with truncated teardrops. Small holes can get away without it, but they print better with truncated teardrops.
Using teardrop_plus() or setting the plus option on other modules will elongate the teardrop vertically by the layer height, so when sliced the staircase tips Using teardrop_plus() or setting the plus option on other modules will elongate the teardrop vertically by the layer height, so when sliced the staircase tips
do not intrude into the circle. See <https://hydraraptor.blogspot.com/2020/07/horiholes_36.html> do not intrude into the circle. See <https://hydraraptor.blogspot.com/2020/07/horiholes-2.html>
[utils/core/teardrops.scad](utils/core/teardrops.scad) Implementation. [utils/core/teardrops.scad](utils/core/teardrops.scad) Implementation.

View File

@ -21,19 +21,21 @@ include <../utils/core/core.scad>
use <../utils/horiholes.scad> use <../utils/horiholes.scad>
show_disc = true; show_disc = true;
thickness = 3; use_horihole = true;
length = 50; thickness = 6;
length = 60;
height = 20; height = 20;
overlap_x = 15; overlap_x = 15;
overlap_y = 5; overlap_y = 10;
module hole_positions() { module hole_positions() {
x0 = (length - 40) / 2;
for($i = [0 : 4], $z = 5 + $i * layer_height / 5, $r = 3) for($i = [0 : 4], $z = 5 + $i * layer_height / 5, $r = 3)
translate([5 + $i * 10, $z]) translate([x0 + $i * 10, $z])
children(); children();
for($i = [0 : 4], $z = 15 + $i * layer_height / 5, $r = 0.5 + $i / 2) for($i = [0 : 4], $z = 15 + $i * layer_height / 5, $r = 0.5 + $i / 2)
translate([5 + $i * 10, $z]) translate([x0 + $i * 10, $z])
children(); children();
} }
@ -45,7 +47,10 @@ module horiholes_stl(t = thickness) {
square([length, height]); square([length, height]);
hole_positions() hole_positions()
horihole($r, $z); if(use_horihole)
horihole($r, $z);
else
teardrop_plus(h = 0, r = $r);
} }
} }
} }
@ -67,16 +72,15 @@ module horiholes() {
hole_positions() hole_positions()
color("red") color("red")
linear_extrude(2 * eps, center = true) linear_extrude(2 * eps, center = true)
//offset(0.01, $fn = 360) intersection() {
intersection() { difference() {
difference() { square(8, center = true);
square(8, center = true);
horihole($r, $z); horihole($r, $z);
}
circle($r, $fn = 360);
} }
circle($r, $fn = 360);
}
} }
if($preview) if($preview)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -41,7 +41,10 @@ module teardrops() {
translate([20, 10]) translate([20, 10])
semi_teardrop(h = 0, r = 3); semi_teardrop(h = 0, r = 3);
}
translate([20, 20])
teardrop(h = 0, r = 3, truncate = false, plus = true);
}
} }
translate([40, 0, 1.5]) { translate([40, 0, 1.5]) {
h = 3 + eps; h = 3 + eps;
@ -61,6 +64,9 @@ module teardrops() {
translate([20, 10]) translate([20, 10])
semi_teardrop(h = h, r = 3, chamfer = chamfer); semi_teardrop(h = h, r = 3, chamfer = chamfer);
translate([20, 20])
teardrop(h = h, r = 3, truncate = false, plus = false, chamfer = chamfer);
} }
} }
} }

View File

@ -22,22 +22,31 @@
//! Small holes can get away without it, but they print better with truncated teardrops. //! Small holes can get away without it, but they print better with truncated teardrops.
//! //!
//! Using teardrop_plus() or setting the plus option on other modules will elongate the teardrop vertically by the layer height, so when sliced the staircase tips //! Using teardrop_plus() or setting the plus option on other modules will elongate the teardrop vertically by the layer height, so when sliced the staircase tips
//! do not intrude into the circle. See <https://hydraraptor.blogspot.com/2020/07/horiholes_36.html> //! do not intrude into the circle. See <https://hydraraptor.blogspot.com/2020/07/horiholes-2.html>
// //
module teardrop(h, r, center = true, truncate = true, chamfer = 0, plus = false) { //! For making horizontal holes that don't need support material, set ```truncate = false``` to make traditional RepRap teardrops that don't even need bridging module teardrop(h, r, center = true, truncate = true, chamfer = 0, plus = false) { //! For making horizontal holes that don't need support material, set ```truncate = false``` to make traditional RepRap teardrops that don't even need bridging
module teardrop_2d(r, truncate) module teardrop_2d(r, truncate) {
er = layer_height / 2 - eps; // Extrustion edge radius
R = plus ? r + er : r; // Corrected radius
offset = plus ? -er : 0; // Offset inwards
hull() hull()
for(y = plus ? [-1 : 1] : 0) for(side = [0 : 1])
translate([0, y * (layer_height / 2 - eps)]) { mirror([side, 0, 0])
intersection() {
hull()
translate([offset, 0]) {
circle4n(R);
circle4n(r); if(truncate)
translate([0, R / 2])
if(truncate) square([2 * R * (sqrt(2) - 1), R], center = true);
translate([0, r / 2]) else
square([2 * r * (sqrt(2) - 1), r], center = true); polygon([[0, 0], [eps, 0], [0, R * sqrt(2)]]);
else }
polygon([[0, 0], [eps, 0], [0, r * sqrt(2)]]); translate([0, -2 * R])
} square([R, 4 * R]);
}
}
render(convexity = 5) render(convexity = 5)
extrude_if(h, center) extrude_if(h, center)

View File

@ -18,21 +18,20 @@
// //
// //
//! Utilities for depicting the staircase slicing of horizontal holes made with [`teardrop_plus()`](#teardrops), see <https://hydraraptor.blogspot.com/2020/07/horiholes_36.html> //! Utilities for depicting the staircase slicing of horizontal holes made with [`teardrop_plus()`](#teardrops), see <https://hydraraptor.blogspot.com/2020/07/horiholes-2.html>
// //
include <../utils/core/core.scad> include <../utils/core/core.scad>
function teardrop_x(r, y) = //! Calculate the ordinate of a teardrop given y. Sweeping y from -r to + r yields the positive X half of the shape. function teardrop_plus_x(r, y, h) = //! Calculate the ordinate of a compensated teardrop given y and layer height.
let(x2 = sqr(r) - sqr(y)) let(fr = h / 2,
y > r / sqrt(2) ? y >= r ? 0 hpot = r + fr,
: r * sqrt(2) - y x2 = sqr(hpot) - sqr(y),
: x2 > 0 ? sqrt(x2) x = x2 > 0 ? sqrt(x2) : 0
: 0; )
max(0,
function teardrop_plus_x(r, y, h) = //! Calculate the ordinate of a compensated teardrop given y. y < hpot / sqrt(2) ? x - fr :
y < -h ? teardrop_x(r, y + h) y < hpot ? hpot * sqrt(2) - y - fr :
: y > h ? teardrop_x(r, y - h) 0);
: r;
module horihole(r, z, h = 0, center = true) { //! For making horizontal holes that don't need support material and are correct dimensions module horihole(r, z, h = 0, center = true) { //! For making horizontal holes that don't need support material and are correct dimensions
bot_layer = floor((z - r) / layer_height); bot_layer = floor((z - r) / layer_height);
@ -41,9 +40,16 @@ module horihole(r, z, h = 0, center = true) { //! For making horizontal holes th
extrude_if(h, center) extrude_if(h, center)
for(i = [bot_layer : top_layer]) { for(i = [bot_layer : top_layer]) {
Z = i * layer_height; Z = i * layer_height;
x = teardrop_plus_x(r, Z - z + layer_height / 2, layer_height / 2); y = Z - z + layer_height / 2;
x = teardrop_plus_x(r, y, layer_height);
if(x > 0) if(x > 0)
translate([-x, Z - z]) translate([0, y])
square([2 * x, layer_height]); difference() {
square([2 * x + layer_height, layer_height], center = true);
for(end = [-1, 1])
translate([end * (x + layer_height / 2), 0])
circle(d = layer_height, $fn = 32);
}
} }
} }