Unglue multiple component instances
-
Greetings,
I am trying to batch unglue components, but can't seem to find an easy way to do it.
-
When I select multiple instances, the "unglue" option is no longer available in the context menu.
-
I can't figure out how to modify the component definition (glue settings, etc) once the component has been created.
-
I don't see a way to "unglue" the component instances via the API.
I've searched, but doesn't seem like this is a problem others have had before. The issue is that I've made a house component, set it to be glued long before I knew what a pain it would be, and now I have 400 of them in my model. I'm adding topography, so I need to move all of the houses up to sit on top of the topography, but it isn't letting me, of course, because they are glued to the ground (aka. Google Earth Snapshot).
Any help on how to get out of this without changing each individually would be much appreciated, either using the GUI or writing a Ruby script to do it.
With gratitude,
Shannon -
-
Solved my own problem, after some trial and error in the Ruby console. Here it is.
def unglue
model=Sketchup.active_model
selection=model.selection
comps=selection.grep(Sketchup::ComponentInstance) {|c|
glue = c.glued_to
c.glued_to=nil unless glue==nil
}
end#def -
This code is not exhaustively tested, but it should give you enough ideas:
model = Sketchup.active_model model.start_operation('Unglue', true) insts = model.selection.grep(Sketchup;;ComponentInstance) insts.each{|inst| inst.glued_to= nil } model.commit_operation
One step undo-able...
It un-glues all selected component-instances.
Advertisement