Method to ask a dynamic component instance to recalc itself?

Yes, provided that the global reference is always there. (It shouldn’t really be a global and could change in the future to a class method that returns a reference to the singleton instance.)

def recalc_dc(inst)
  return nil unless defined?($dc_observers)
  if inst.is_a?(Sketchup::ComponentInstance) &&
  inst.attribute_dictionary('dynamic_attributes')
    $dc_observers.get_latest_class.redraw_with_undo(inst)
  end
  nil # (there is no particular return value)
end
3 Likes