openscad-tray icon indicating copy to clipboard operation
openscad-tray copied to clipboard

_tray_meniscus appears broken

Open dshadowwolf opened this issue 2 years ago • 10 comments

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.

dshadowwolf avatar Jan 26 '23 17:01 dshadowwolf

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

sofian avatar Jan 28 '23 22:01 sofian

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?

sofian avatar Jan 28 '23 22:01 sofian

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)

dshadowwolf avatar Jan 28 '23 23:01 dshadowwolf

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.

sofian avatar Jan 29 '23 01:01 sofian

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 ?

dshadowwolf avatar Jan 29 '23 01:01 dshadowwolf

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 avatar Jan 29 '23 01:01 sofian

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.

sofian avatar Jan 29 '23 01:01 sofian

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.

dshadowwolf avatar Jan 29 '23 16:01 dshadowwolf

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

sofian avatar Jan 29 '23 18:01 sofian

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.

UBaer21 avatar Feb 07 '23 22:02 UBaer21