Dynamic Component Error

Hello,
I’m working on Plug-ins that use DC and i get often this error. this is an error from su_dynamiccomponents and i can’t do nothing again, not even understand what’s going on. it makes the component window not showing the parameter.

Error: #<NoMethodError: undefined method deleted?' for #<Sketchup::Model:0x007fc7fd95c938>> /users/jbt/library/application support/sketchup 2018/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbe:212:in block in pull_attribute_tree’
/users/jbt/library/application support/sketchup 2018/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbe:212:in delete_if' /users/jbt/library/application support/sketchup 2018/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbe:212:in pull_attribute_tree’
/users/jbt/library/application support/sketchup 2018/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_v1.rbe:245:in block in show_dialog' SketchUp:1:in call’

It looks like it checks whether an entity reference is valid (entity not deleted) before reading attributes from it. However a model is not a normal entity and cannot be deleted, but it can have attributes. Somehow the model gets into the list of entities that are considered.

Since the backtrace does not reference lines of your code, the error is probably triggered by the dynamiccomponents code which could be invoked by observers. But the original cause could still be in your code (if not a bug in dynamiccomponents).

  • Does this still happen when you cleanly restart SketchUp, open the same model and run once your plugin? Maybe the model got into a bad state after several tests of your plugin.
  • It would be helpful to understand what your plugin does, how it interacts with dynamiccomponents and whether it somehow injects entities (or the model) into the list of entities that dynamic components are working with.
  • Dynamiccomponents have no public, stable API that is intended to be used by Ruby programmers. If there is no API, there are no guarantees and if a developer regardlessly uses internal methods it is very risky because he cannot be sure to fully understand the inner workings for all inputs and in all situations of use.

Already reported in the DC errors thread, over 3 years ago !
(And was actually discussed some years before this.)

And I posted a “bandage snippet” further down the thread …

Hi Aurelius,

It doesn’t happen when i restart SU.
I made this Plug-ins in 2011-12 and it worked all the times (used by 4-5 people everyday). you can see what it does hier: VectorWorks Plug-in – Jean Baptiste Trystram – GALADES
i first make it working for 2018 because it didn’t. it works (actually it still work with this error but with empty parameter window). now i have to adapt the PI to the change made on the product it draws.
as you say it could come from my script but i have no way to see where. and it should
Dynamic components have no public, stable API ??? but it comes with the pro version !!
thanks for the answer,
Jean Baptiste

@jb_Trystram

Jean Baptiste, … See my post just above your last post.

It is a long-standing bug with the Dynamic Components code, not your plugin.

Hello Dan,
I look at your post and i ask me the same Question : it’s somebody by Trimble in charge of DC?

I do not know exactly who is responsible for the Dynamic Components extension.

I’ve reported multiple bugs (to whom I believe should be responsible,) and have received mostly silence back.

The only thing more we can do, is to start sending our complaints to product management …

@jbacus @tyler_miller