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

Set_attribute and undo operations

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 4 Posters 456 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 Offline
    Jim
    last edited by 18 Apr 2009, 12:15

    I'm using attribute dictionaries to manage entities in a tool, but whenever I call set_attribute, another operation is pushed on the undo stack creating unnecessary (in my opinion) undo operations. The operations show up as "Undo Properties" on the Undo button Tooltip.

    Is it possible to make SU not put these changes on the undo stack?

    Hi

    1 Reply Last reply Reply Quote 0
    • A Offline
      AdamB
      last edited by 18 Apr 2009, 17:53

      Can you not just keep a reference to the dictionary and twiddle key-value pairs without calling set_attribute?

      Developer of LightUp Click for website

      1 Reply Last reply Reply Quote 0
      • S Offline
        scottlininger
        last edited by 20 Apr 2009, 21:37

        Jim,

        Consider trying something like this, which will group them into a single undo event...

        Sketchup.active_model.start_operation "Modify Attributes"
        # make multiple attribute changes here.
        Sketchup.active_model.commit_operation
        

        ...and if you're responding to an observer event, you might consider something like this, which will "append" your attribute changes to the previous event. See start_operation for details on the 3rd param...

        Smodel.start_operation "Modify Attributes", true, false, true
        # make multiple attribute changes here.
        model.commit_operation
        

        Hope that helps!

        • Scott Lininger
          SketchUp Software Engineer
          Have you visited the Ruby API Docs?
        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 21 Apr 2009, 05:48

          Third param?? Where did that fly in from?

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

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 21 Apr 2009, 05:50

            ...correction four... ...now that might come in handy.

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

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

            Advertisement