Loading
JustinSDK

Customizable Klein Bottle

by JustinSDK May 12, 2019
Download All Files

Thing Apps Enabled

Please Login to Comment

I found what seems a bug. Many calls checking the len(a) fail when len(a) is undefined at line 1084 and or line 1099 (function __is_vector()).
I attempted to "fix" the one at 1084 in _to_avect() as follows:

function _to_avect(a) =
    !__is_vector(a)?[0,0,0] :(
     len(a) == 3 ? a : (
         len(a) == 2 ? [a[0], a[1], 0] : (
             len(a) == 1 ? [a[0], 0, 0] : [0, 0, a]
         ) 
     )
     );

This bypasses most of the bad calls and returns a [0,0,0] in that case.
It speeds up rendering as well.
But the author/designer/developer should have a look at curing this issue.

The remaining warnings are generated in the __is_vector() when len(a) ==undef

I use __is_float to avoid warnings. __is_float is still hack, though.

As I said in the summary, I'll fix it after OpenSCAD publishes the next general release.

The next general release of OpenSCAD will have type testing functions is_undef, is_list, is_num, is_bool, is_string. That's what I am waiting for.

Comments deleted.

Thank you so much for this, brilliant bit of code....Renders quickly for such a complex shape.

Thank you for the compliment, especially for knowing the hardness of such a model.