Yes, true, you are correct.
(1) It still exists.
(2) It itself is poor practice, and could have been a class variable reference (implemented in a singleton manner.) It could have been exposed via a class constant or a class getter method.
(3) As I said above, It might not exist in future versions, if they re-implement it’s reference per (2).
So, you’ll need to do a object search and hold a local reference inside your module, to the same singleton object that $dc_observers
is also referencing.
def recalc_dc(inst)
return nil unless defined?(DCObservers)
if inst.is_a?(Sketchup::ComponentInstance) &&
inst.attribute_dictionary('dynamic_attributes')
if @dc_observers.nil?
ObjectSpace.each_object(DCObservers) {|o| break @dc_observers = o }
end
return nil unless @dc_observers.respond_to?(:get_latest_class)
latest_dc_class = @dc_observers.get_latest_class
return nil unless latest_dc_class.respond_to?(:redraw_with_undo)
latest_dc_class.redraw_with_undo(inst)
end
nil # (there is no particular return value)
end
But, since the DC extension is Trimble’s extension, there is still no guarantee they’ll approve your extension.