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

    Can page/scene creation be undone in undo/redo system?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 173 Views 2 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.
    • T Offline
      tim
      last edited by

      I've been trying to make nice with the undo system (firstly by wrapping a start/commit around the code) and I notice that when attempting to 'undo' after running my ComponentScenes plugin the pages created are not removed. (I further notice that manually created pages appear to not go away with manual undo.) The created layers and copied components all disappear politely. 'Undo' on a model where a large number of components were processed tends to kill SU completely, which is unfriendly.

      I see the ModelObserver operation methods listed but can't work out how to make use of them from the doc found so far and in fact ThomThom's list of observer issues suggests maybe it wouldn't even work properly. Has anyone found a good explanation of how I might improve my undo/redo?

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

        @tim said:

        'Undo' on a model where a large number of components were processed tends to kill SU completely, which is unfriendly.

        If Sketchup is at or higher than 7, use the 2nd argument to disable the UI. (Won't completely solve "whiteout", but helps a bit.)

        # assume @@text[;undo] is the text string, or format string,
        # you will display in the menu, for the undo operation;
        begin
          if Sketchup.version.to_i >= 7
            mdl.start_operation( @@text[;undo], true )
          else
            mdl.start_operation( @@text[;undo] )
          end
            #
            # time intensive code here
            #
          mdl.commit_operation()
        rescue
          mdl.abort_operation()
          puts( @@text[;error] )
        end
        
        

        I'm not here much anymore.

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

          there is also a thread dedicated to speed:

          Optimization Tips

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • T Offline
            tim
            last edited by

            That's the usage I put in - with the second parameter 'true'. It does indeed speed up making many scenes, quite noticeably.

            I haven't fully characterised how many scenes need to be undone to cause a crash (EDIT - I said originally 'kill' and I realised you might be thinking 'slow down horribly' rather than crash, burn, quit rudely etc) but since 'a few' works OK (except for the damned pages staying in place instead of going away) and 'a few dozen' crashes, I guess it's somewhere in the middle.

            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