[REQ] Component Instances: Unlock, edit, "relock"
-
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.
-
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, 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
-
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.
-
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.
-
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... -
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.
-
@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
Advertisement