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

    Undo Deleted Entities

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 495 Views 3 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

      So, apparently if you Undo a deleted entity, you don't get back exactly the same entity?

      
      entity;#<Sketchup;;Face;0x422be20> 
      entityID;27
      # Delete and Undo the Face
      entity;#<Sketchup;;Face;0x3ed63c8>
      entityID;27
      
      

      I get the same entityID, but not exactly the same Face? I guess I can manage them through the entityID, right? I'll just need to search the entities for the entityID.

      Hi

      1 Reply Last reply Reply Quote 0
      • AdamBA Offline
        AdamB
        last edited by

        Jim,

        Yes, expected behavior - particularly with GC-ed languages. But also because the Ruby objects are just proxies of the 'real' objects buried inside SU proper, so I think the wrapper can change at any time, while the value is persistent for the lifetime of the underlying object.

        You have to tread very carefully when matching Entities. Even comparing EntityID isn't enough sometime - well thats what I found anyway. In LightUp I ended up just hashing the entity, which works great.

        Adam

        Developer of LightUp Click for website

        1 Reply Last reply Reply Quote 0
        • tbdT Offline
          tbd
          last edited by

          agree with Adam - using entityID sometimes makes you chase dead horses. better using hashes even if there is a slight time penalty.
          hope there will be a fix in future SU versions

          SketchUp Ruby Consultant | Podium 1.x developer
          http://plugins.ro

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

            I know what a Hash is in Ruby, but are you guys talking about the same "hash"? It's not clear how I could use a Ruby hash without running into the same problem; needing to search Entities for the matching ID.

            I wanted one of my plugins to handle selections in undo and redo operations, so I wrote a Selection Manager to handle it. It appears to work just fine using the entityID of each selected entity stored in an array of arrays; and stepping back and forth thru the stack.

            Second issue, there appears to be a que-ing, or scheduler in Sketchup? If I call Sketchup.undo followed immediately by my undo, the entities have not been "undone" in time for my undo to find them. I hacked it up using...

            
            Sketchup.undo
            UI.start_timer(0.1) { my_undo}
            
            

            Any alternative?

            Hi

            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