Components don't appear in "Component Option" Window

@colin, AND I just confirmed that the NoMethodError due to #deleted? getting called upon the model object, is what is causing the problem with the Options dialog.

Put your Options dialog into the error state where it will not populate when you click on a DC component.

At the console, paste in this command …

$dc_observers.get_latest_class.refresh_dialogs(true)

You should see the error displayed thus …

Error: #<NoMethodError: undefined method `deleted?' for
 #<Sketchup::Model:0x000001b044a6b198>>
c:/users/%UserName%/appdata/roaming/sketchup/sketchup 2020/sketchup/plugins/
su_dynamiccomponents/ruby/dcclass_overlays.rbe:212:in `block in pull_attribute_tree'

Now let’s give the Sketchup::Model class a temporary #deleted? method.
Paste in this definition …

class Sketchup::Model; def deleted?; !valid?(); end; end

… it simply defines the method that calls the existing #valid? method but negates the result and returns it. This satisfies the DC’s pull_attribute_tree method’s conditional statement, so it doesn’t raise an exception.

Now, again execute the refresh dialogs method call …

$dc_observers.get_latest_class.refresh_dialogs(true)

The Options dialog populates ! Yeah! (The crowd goes wild!) :cheer:


So for a fix, a fix script can be dropped into the Plugins folder …

unless Sketchup::Model.method_defined? :deleted?
  class Sketchup::Model
    def deleted?
      !valid?()
    end
  end # class
end # unless

Do y’all realize that I reported this 5 YEARS AGO ! … back in v1.3.2 ?

Ruby Errors in Dynamic Components - #2 by DanRathbun

… but as this thread shows people were having issues back in DEC of 2014.

2 Likes