sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    Adding dynamic attributes to multiple objects

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 4 Posters 1.9k 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.
    • J
      Jim
      last edited by

      So I was able to add a "Quantity" textbox to the user options dialog with the following code:

      ad = selection[0].definition.attribute_dictionaries["dynamic_attributes"]
      
      ad["quantity"] = "1"
      ad["_quantity_access"] = "TEXTBOX"
      ad["_quantity_formlabel"] =  "Quantity"
      

      Hi

      1 Reply Last reply
      Reply Quote 0
      • thomthomT
        thomthom
        last edited by

        Didn't realise one could set attributes like that.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply
        Reply Quote 0
        • J
          Jim
          last edited by

          Yeah, it wouldn't actually be too hard to create a DC editor for non-pro users.

          I was considering doing a specialized one just for animating doors and windows.

          Hi

          1 Reply Last reply
          Reply Quote 0
          • thomthomT
            thomthom
            last edited by

            I meant the way you added items to AttributeDictionaries. I've always used the explicit set_attribute method.

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply
            Reply Quote 0
            • J
              Jim
              last edited by

              set_attribute and get_attribute are probably better to use in the long run, if changes were ever made internally they would likely still work.

              Hi

              1 Reply Last reply
              Reply Quote 0
              • thomthomT
                thomthom
                last edited by

                heeeey? where was that comment of being able to remove attributs using set_attribute? mind trixies!

                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply
                Reply Quote 0
                • J
                  Jim
                  last edited by

                  It was wrong! I was thinking of something else. There was what I thought an odd way to delete an attribute, but I think it was an odd way to delete the entire dictionary.

                  Hi

                  1 Reply Last reply
                  Reply Quote 0
                  • thomthomT
                    thomthom
                    last edited by

                    set_attribute can potentially kill the whole dictionary??

                    Thomas Thomassen — SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply
                    Reply Quote 0
                    • J
                      Jim
                      last edited by

                      Ok, this is what I was remembering:

                      delete_attribute can delete the entire dictionary if the value param is not used.

                      Error 404 (Not Found)!!1

                      favicon

                      (code.google.com)

                      @unknownuser said:

                      Entity.delete_attributeSketchUp 6.0+

                      The delete_attribute method is used to delete an attribute from an entity.
                      
                      If only the dictionary_name is given, then it deletes the entire AttributeDictionary. Otherwise, delete_attribute deletes the attribute with the given key from the given dictionary.
                      

                      Hi

                      1 Reply Last reply
                      Reply Quote 0
                      • Dan RathbunD
                        Dan Rathbun
                        last edited by

                        @jim said:

                        Ok, this is what I was remembering:

                        Entity.delete_attribute can delete the entire dictionary if the value param is not used.

                        AGREED !

                        There should have been (should be,) an explicit Entity.delete_dictionary method (even if it calls the other one with 'secret' parameters. Of course the safest way is to rename and then override the delete_attribute method, so only a call to a delete_dictionary method would do the deletion.
                        Which may actually be how things work with delete_attribute, ie if num args == 1 then it calls the Entity.attribute_dictionaries.delete(arg) method. )

                        I'm not here much anymore.

                        1 Reply Last reply
                        Reply Quote 0
                        • N
                          NewGuy
                          last edited by

                          Guys,
                          Thanks for your help! Great insight.

                          1 Reply Last reply
                          Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement