sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SU2015 gives NoMethodError for Length class #abs method

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 432 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      archidave
      last edited by

      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.740157480315

      but in SU 2015;
      > 2.m.abs
      gives the NoMethodError

      This 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

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        2.m.abs
        works fine in v2015...
        BUT I am testing it in the latest M3 version - just out...

        TIG

        1 Reply Last reply Reply Quote 0
        • A Offline
          archidave
          last edited by

          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... πŸ˜„

          1 Reply Last reply Reply Quote 0
          • S Offline
            slbaumgartner
            last edited by

            just released this afternoon

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              You get the cutting edge news here πŸ˜‰

              TIG

              1 Reply Last reply Reply Quote 0
              • tt_suT Offline
                tt_su
                last edited by

                @archidave said:

                but in SU 2015;
                > 2.m.abs
                gives the NoMethodError

                This 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?

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement