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

    [REQ] Component Instances: Unlock, edit, "relock"

    Scheduled Pinned Locked Moved Plugins
    8 Posts 5 Posters 302 Views 5 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.
    • JClementsJ Offline
      JClements
      last edited by

      I had a model with multiple instances of a various components. Most were locked to prevent those collaborating (whom have different experience levels using SU) from accidentally moving or deleting them.

      If one of these instances need to be edited then it must be unlocked first. However, SU requires ALL instances be unlocked (or make the instance unique ... which is not what I want to happen). Components are spread throughout the model and on multiple layers so finding all instance requires manually search the Outliner and relocking them.

      I was wondering if this process could be simplified with a script?
      It would be activated via a context menu option [named "Edit Locked Instance"] if the selected object was a component with multiple instances, ANY OF WHICH are locked. When activated the script would drill down through the entire model and unlock the instances. The dialog could be persistent such that after unlocking, editing, and exiting the component, the user would be given the option of relocking all previously locked instances.

      Basically the script would memorize the locked instances associated with a selected component and then reselects them after editing the component so they can be given the locked attribute.

      John | Illustrator | Beaverton, Oregon

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        I'm not sure I understand...
        Each Instance of a Component or a Group can be Locked individually...
        A simple script to check if it's locked [and any of it's siblings are locked] and then unlock it/them for editing of the selected one is OK, but you then need to enter the edit context manually, and then the re-locking of it/them after the edit would need some convoluted observer coding ?

        TIG

        1 Reply Last reply Reply Quote 0
        • sdmitchS Offline
          sdmitch
          last edited by

          Tig, How about this

              mod = Sketchup.active_model
              ent = mod.active_entities
              sel = mod.selection
              if sel.first.is_a?(Sketchup;;ComponentInstance)
                def_name = sel.first.definition.name
                comps = ent.find_all{|e| e.is_a?(Sketchup;;ComponentInstance) and e.definition.name == def_name}
                for c in comps
                  if  c.locked?
                    c.name = 'Lock Me' + c.name
                    c.locked = false
                  elsif c.name[0..6] == 'Lock Me'
                    c.name = c.name[7..-1]
                    c.locked = true
                  end
                 end
              else
               UI.messagebox("Select component to UNLOCK/RELOCK")
              end
          
          

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • dereiD Offline
            derei
            last edited by

            Well, It seems you can UNLOCK them all to edit, but they will remain unlocked. So, I think here is a request for something that will Lock Back everything after the editing has ended.


            2011-11-08_232552.png

            DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

            1 Reply Last reply Reply Quote 0
            • JClementsJ Offline
              JClements
              last edited by

              Tig:
              @unknownuser said:

              ... but you then need to enter the edit context manually, and then the re-locking of it/them after the edit would need some convoluted observer coding ?

              Yes, relock all the instances that were unlocked for editing.

              I thought that once the instances were selected then there might be away of collecting the object number of each instance and store those numbers in memory, then after editing is finished, those object numbers could be used to reselect and lock the instances.

              John | Illustrator | Beaverton, Oregon

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                Think of it this way...
                Assuming that all groups/instances should 'always' be 'locked'.
                If a user unlocks any instance an observer spots it.
                It waits...
                After a few seconds it re-locks all instances... or if the current edit context (Sketchup.active_model.active_path) is NOT nil, i.e it's not the Sketchup.active_model.entities, then it waits until it is and then re-locks all instances...

                TIG

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  That's how my car works. If I unlock the doors with the remote, but don't ever open the door, it will re-lock itself after about 30 seconds. Crazy.

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    @chris fullmer said:

                    That's how my car works. If I unlock the doors with the remote, but don't ever open the door, it will re-lock itself after about 30 seconds. Crazy.
                    My car does that too 😕

                    TIG

                    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