You are on page 1of 1

*---------------------------------------------------------------------------------

* https://forums.sketchup.com/t/redraw-all-dynamic-components/77512/14
* Redraw all dynamic components
* Open the Ruby Console (Window) and paste

# Redraw all selected (and siblings)


UI.add_context_menu_handler do |context_menu|
ss = Sketchup.active_model.selection
if defined?($dc_observers) && !ss.empty?
insts = ss.grep(Sketchup::ComponentInstance)
if !insts.empty?
dynatts = 'dynamic_attributes'
insts.select! {|i| i.definition.attribute_dictionary(dynatts) }
if !insts.empty?
cdefs = insts.map(&:definition).uniq
dco = $dc_observers.get_latest_class
context_menu.add_item("Redraw ALL sibling DCs") {
cdefs.each {|cdef|
puts "\nRedrawing Instances of: \"#{cdef.name}\"..."
cdef.instances.each {|i|
puts "Redrawing ... #{i.inspect}"
dco.redraw_with_undo(i)
}
}
}
context_menu.add_item("Redraw ONLY selected DCs") {
puts
insts.each {|i|
puts "Redrawing Instance of: \"#{i.definition.name}\"... #{i.inspect}"
dco.redraw_with_undo(i)
}
}
end # if DC instances were selected
end # if component instances were selected
end # if DC loaded and something is selected
end # context menu handler block
*---------------------------------------------------------------------------------
* works like regen all in autocad
Sketchup.active_model.selection.grep(Sketchup::ComponentInstance).each do |s|
$dc_observers.get_latest_class.redraw_with_undo(s)
end
*---------------------------------------------------------------------------------

* Extensions o Plug ins


Solid Inspector
Eneroth Component to group

You might also like