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

    Set_attribute and undo operations

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 459 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

      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
      • AdamBA Offline
        AdamB
        last edited by

        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
        • scottliningerS Offline
          scottlininger
          last edited by

          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
          • thomthomT Offline
            thomthom
            last edited by

            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
            • thomthomT Offline
              thomthom
              last edited by

              ...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
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement