sofian / openscad-tray

OpenSCAD library to create rounded rectangular trays with optional subdividers.
GNU General Public License v3.0
36 stars 8 forks source link

_tray_meniscus appears broken #2

Open dshadowwolf opened 1 year ago

dshadowwolf commented 1 year ago

Everything was working fine, then I loaded OpenSCAD today and tried to work on a design I'd been playing with and the tray module is throwing a warning and not generating any geometry:

WARNING: cylinder(r1=0, r2=0, ...) in file libraries/tray.scad, line 316
TRACE: called by 'cylinder' in file OpenSCAD/libraries/tray.scad, line 316
TRACE: called by 'translate' in file OpenSCAD/libraries/tray.scad, line 316
TRACE: called by 'difference' in file OpenSCAD/libraries/tray.scad, line 313
TRACE: called by '_tray_meniscus' in file OpenSCAD/libraries/tray.scad, line 285
TRACE: called by 'children' in file OpenSCAD/libraries/tray.scad, line 320
TRACE: called by 'translate' in file OpenSCAD/libraries/tray.scad, line 320
TRACE: called by 'rotate' in file OpenSCAD/libraries/tray.scad, line 320
TRACE: called by 'translate' in file OpenSCAD/libraries/tray.scad, line 320
TRACE: called by '_tray_rotate_around' in file OpenSCAD/libraries/tray.scad, line 285
TRACE: called by 'translate' in file OpenSCAD/libraries/tray.scad, line 285
TRACE: called by 'if' in file OpenSCAD/libraries/tray.scad, line 284
TRACE: called by 'translate' in file OpenSCAD/libraries/tray.scad, line 278

Reproducible with just:

include <tray.scad>

tray([200,200,200]);

I have done everything I can to verify that I'm using the exact same version as is in the repo and cannot find any differences (diff and cmp both report no differences) so... I'm at a loss as to what the issue is, beyond it appearing that the ry[2] value for the bevel/rounding is always 0 and this is causing cylinder() to fail.

sofian commented 1 year ago

Thanks for the report. That's odd, I haven't been able to reproduce the problem on my side.

sofian commented 1 year ago

Can you send me your scad.tray file -- just to make sure we're both using the same version? And which version of OpenScad are you using?

dshadowwolf commented 1 year ago

The version I'm using I verified against the repository the same day I opened the comment and the files matched, but... Let me see if I can drag&drop a current copy from my local here... (attached with a .txt added to make GitHub happy) -- tray.scad.txt

And I'm using OpenSCAD 2021.01 -- I should note that I've done some poking and adding some echo() statements to a copy of it and found that, at the point of the crash, it appears to pull a 0 from the third element of the ry array (ry, as far as I can tell, only has non-zero values for the first two elements and passing a 0 to _tray_meniscus causes the resulting cylinder to have a radius of 0)

sofian commented 1 year ago

I ran a diff on your file and the one in my repo and there are no differences. I am also running OpenSCAD 2021.01 -- on Linux/Ubuntu.

dshadowwolf commented 1 year ago

That is why I opened the issue -- I could not see what was going wrong, just that it was consistently spewing the above and not working. Thoughts ?

sofian commented 1 year ago

One thing I find odd is that your program crashed due to a warning. Could it be that there is indeed a call to cylinder with radius of zero, which causes a warning; only perhaps in your settings, any warnings would cause the app to crash (something in the software's preferences) while on mine the warnings are ignored?

sofian commented 1 year ago

Cause I mean: a warning is not an error. But perhaps you have a setting that makes your instance of OpenScad reject running the program is there is a warning.

dshadowwolf commented 1 year ago

Okay, facepalm time for me -- I did have "stop at first warning" enabled for an unrelated project being done for money where I couldn't have warnings in the work I was providing.

sofian commented 1 year ago

I'll still keep the issue open, I'll fix it when I can find the time.

UBaer21 commented 1 year ago

just put if(r) in front on line 316 There are multiple cases where this is called with r=0 (sharp corner) , newer Versions of openSCAD will warn you if an cylinder or circle has r=0 .. older versions (2021) just ignore that and remove the object.