Open drf5n opened 1 year ago
I think layer height > width isn't physically possible because the nozzle would be too high to place the filament on the bed, or the layer below.
layer_heigth0 is a new addition and only affects round_to_layer at the moment. These utilities would need changing to take it into account I think. I will take a look later as I have to go out now.
Yes, it is a muddled, out-of-bounds edge case. At first I was trying to understand horiholes and horicylinders using only use <NopSCADlib/utils/horiholes.scad>
, then core, and then lib.scad for the teardrops, etc...
Because:
for(i = [-10:1:10]){
echo(str("i = ",i,": ",teardrop_minus_x(5, i, 1)));
}
result:
ECHO: "i = -10: 0"
ECHO: "i = -9: 0"
ECHO: "i = -8: 0"
ECHO: "i = -7: 0"
ECHO: "i = -6: 0"
ECHO: "i = -5: 0"
ECHO: "i = -4: 0"
ECHO: "i = -3: 3.8541"
ECHO: "i = -2: 4.53113"
ECHO: "i = -1: 4.88748"
ECHO: "i = 0: 5"
ECHO: "i = 1: 4.88748"
ECHO: "i = 2: 4.53113"
ECHO: "i = 3: 3.8541"
ECHO: "i = 4: 2.56155"
ECHO: "i = 5: 0.5"
ECHO: "i = 6: 0.5"
ECHO: "i = 7: 0.5"
ECHO: "i = 8: 0.5"
ECHO: "i = 9: 0.5"
ECHO: "i = 10: 0.5"
...it might be in here:
https://github.com/nophead/NopSCADlib/blob/master/utils/horiholes.scad#L59-L67
function teardrop_minus_x(r, y, h) = //! Calculate the ordinate of a compensated teardrop given y and layer height.
let(fr = h / 2,
hpot = r - fr,
x2 = sqr(hpot) - sqr(y),
x = x2 > 0 ? sqrt(x2) : 0,
X = y >= -hpot / sqrt(2) ? x + fr : 0
)
X >= extrusion_width ? X : 0;
If When x goes to zero above the hole, then X = fr, and then if fr >= extrusion_width, tearDrop_minus will return the filament radius.
Probably needs an assert() to check extrusion_width >= layer_height. It can never be less when extruding a perimeter. The filament is either squashed to make it wider than it is high or it just has a circular cross section if not. It can't be stretched vertically.
There's a couple extra layers on top of a horicylinder if the layer_height >= 4 extrusion_width. This is an odd case, but I was looking at printing out how 3DP holes work in a tangible-sized model and ran into this unexpected rendering/problem.