• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Disabling advanced camera tools causing error

Scheduled Pinned Locked Moved SketchUp Bug Reporting
sketchup
7 Posts 2 Posters 6.9k Views
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.
  • H Offline
    halroach
    last edited by 12 Dec 2016, 09:49

    When disabling "Advanced Camera Tools" both in Sketchup 2015 and in 2016 (maybe further), it causes an undefined method error with scripts that use 'get_attributes' (with the S) on a component definition.

    The error:
    " Could not load xxx.rb:
    undefined method 'get_attributes' for
    #Sketchup::ComponentDefinition0x000000.... "

    I usually disable the 'Advanced Camera Tools' extension (It may cause all sorts of scene problems in some models), but I guess I'll have to live with this one when I want to run a certain script...

    1. Does this happen to anyone else?
    2. I can't seem to find 'get_attributes' (with the s) in the Sketchup API, nor in the Ruby Docs... ?

    Good Day

    Yoni

    FlexTools - Super Quick Windows, Doors, Slats...

    1 Reply Last reply Reply Quote 0
    • D Offline
      driven
      last edited by 12 Dec 2016, 15:17

      it's a Dynamic Components method...

      do you have a model and a code snippet that generates the error...

      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • H Offline
        halroach
        last edited by 12 Dec 2016, 15:21

        You can test it with your DC encrypter decrypter.

        FlexTools - Super Quick Windows, Doors, Slats...

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by 12 Dec 2016, 16:11

          I'll have a look, it was a test...

          ok I can reproduce it with a new model with any DC and this code...

               m = Sketchup.active_model
              m.definitions.each do |d|
                if defined? d.attribute_dictionaries
                next unless d.attribute_dictionaries && d.attribute_dictionaries['dynamic_attributes']
                if defined? d.get_attributes
                  p d.name
                  d.get_attributes('dynamic_attributes').each do |a|
                    p a
                  end
               else
                 p d.name.upcase
               end end end
                 
          

          Run with ACT off and you get the UPCASED definition names, turn ACT on and run again, you get the list...

          I only tested on mac, v2017...

          it 'looks' like get attributes is defined in ACT...

          john

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by 12 Dec 2016, 18:43

            it definitely part of ACT...

            and is the equivalent of this attribute_dictionaries['dynamic_attributes'].entries.to_h...

            proof:

                m = Sketchup.active_model
                m.definitions.each do |d|
                  next unless d.attribute_dictionaries && d.attribute_dictionaries['dynamic_attributes']
                   p d.name
                   p d.attribute_dictionaries['dynamic_attributes'].entries.to_h == d.get_attributes('dynamic_attributes')
                  end 
            

            solution:

            do a search and replace in any plugin that uses get_attributes('dynamic_attributes')... [untested]

            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • H Offline
              halroach
              last edited by 12 Dec 2016, 18:59

              Thanks John!
              That definitely clears up a lot of things I couldn't understand. 😄

              When I was analyzing your decrypter, 'get_attributes' fit in so well it looked like it's part of the API. Maybe it should be?!

              FlexTools - Super Quick Windows, Doors, Slats...

              1 Reply Last reply Reply Quote 0
              • D Offline
                driven
                last edited by 12 Dec 2016, 19:09

                when I write 'quick and dirty' tests I tend to check for methods using Ruby :methods method...

                that can expose 'undocumented' methods that I have no idea of the owner of...

                I must of had ACT on when I first wrote this one [ I don't normally ]...

                good thing you found it, I'll find and change my snippet...

                john

                learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                Advertisement