SU2015 gives NoMethodError for Length class #abs method
-
Since SU 2015, there seems to be a difference in the way the Length class handles the #abs method.
Up to and including SU 2014, it would return the absolute value as would be expected.However, in SU 2015 it is now generating Error: #<NoMethodError: undefined method `abs' for nil:NilClass>
eg. in SU 2014;
> 2.m.abs
78.740157480315but in SU 2015;
> 2.m.abs
gives the NoMethodErrorThis is pretty bad (it has broken my plugin for SU 2015) and means I now need to go hunting through the code for all occurrences of <Length>.abs replacing them with <Length>.to_f.abs and building-in extra validation where the class is not intrinsically known, just in case there could be a Length instead of a Float.
Anybody know why this has been changed? it seems pretty unhelpful
Dave
-
2.m.abs
works fine in v2015...
BUT I am testing it in the latest M3 version - just out... -
Thanks for quick reply TIG.
we were testing on 15.2.685 Windows 64-bit and 15.2.686 Mac 64-bit
didn't know there was an update out - will try that... -
just released this afternoon
-
You get the cutting edge news here
-
@archidave said:
but in SU 2015;
> 2.m.abs
gives the NoMethodErrorThis is pretty bad (it has broken my plugin for SU 2015) and means I now need to go hunting through the code for all occurrences of <Length>.abs replacing them with <Length>.to_f.abs and building-in extra validation where the class is not intrinsically known, just in case there could be a Length instead of a Float.
The Length class used to be a subclass of Float. However this isn't really possible in Ruby, but from the Ruby C API this was hacked together a way to do so.
When we added 64bit support in SU2015 this broke because the data structures where different. So we had to re-implement Length by forwarding the methods to Float. Initially this used the Ruby Standard Library, but due to another bug in Ruby where the StdLib would not always load if there was unicode characters in the user's username the StdLib would fail and the Length class would not properly initialize. There was also a bug in SU at some point where the StdLib would fail to load if the user started SketchUp by double clicking an SKP file.
We later corrected the new Length implementation to not use StdLib so it would not fail if the StdLib failed to load. And we also fixed the bug regarding starting SU via SKP files.But those fixes should be in SU2015M2 - so I don't understand why you'd experience such problems. I am not able to reproduce your error.
Can you try without any extensions enabled - just so we can eliminate that possibility?
Advertisement