Ruby Errors in Dynamic Components

Ruby Errors in Dynamic Components

As there is no public Issue list at https://github.com/SketchUp

… I’ll start a thread to post errors with the Dynamic Components extension.

:loud_sound:

3 Likes

DC v 1.3.2

All SketchUp versons & editions.

Both Platforms.

The Model class has no deleted? method.

Annoying error clutters console:

Error: #<NoMethodError: undefined method `deleted?' for #<Sketchup::Model:0x00000007d4f010>>
c:/users/dan/appdata/roaming/sketchup/sketchup 2015/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbs:200:in `block in pull_attribute_tree'
c:/users/dan/appdata/roaming/sketchup/sketchup 2015/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbs:200:in `delete_if'
c:/users/dan/appdata/roaming/sketchup/sketchup 2015/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbs:200:in `pull_attribute_tree'
c:/users/dan/appdata/roaming/sketchup/sketchup 2015/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_v1.rbs:225:in `block in show_dialog'
SketchUp:1:in `call'

ADD (2018-06-20): It has been over 3 years and still users are reporting this error in SketchUp 2018 !

1 Like

Component Attributes dialog redraw error.

In Pro, editing a DC. Widening the dialog window to see more of the formulae.

Then loading another model (which causes the selection set to empty, and then there is no DC component selected.)

The dialog looks like this:
(Discourse lost the image and I don’t have it on this machine.)

I no longer see this exact web rendering error on v1.7.0 of the DC extension.

However, loading a new file leaves the previous attribute information displayed in the both of the DC dialogs. This data should be cleared as the neither the definition nor the instance is in the new empty model. (Closing and opening the dialogs clears them.)

SketchUp hangs as if stuck in an infinite loop:

See: Using either scale function or user input to set LenXYZ

This one is a Javascript Error I think:

Script error with Dynamic Components

I’m not a Ruby person, but @DanRathbun has assured me in private correspondence that this is appropriate to this topic:

Check out the topic: How to put special characters - "<" and ">" - into component attributes for display in component options.

While I’ve found a workaround for what I want to do, I think I’ve revealed a bug in the DC Component Attributes and Component Options boxes. Specifically, using HTML shortcut entities results in the correct display in Options initially, but the Attribute value that drives it is CHANGED to reflect the actual character, so the NEXT time you edit it, it’s treated as a special character (opening an HTML tag) and stops displaying.

And sorry for embedding YouTube videos - I still haven’t figured out how the rest of you embed animated SU demos that loop in forum posts. If you want to give me advice on that, please message me, or reply as a new topic.

Thanks!

Dan,
I noticed the word sash in your code. I was hoping you we’re writing a new windows plugin for SU.
All the plugins I see do not Really emphasize the true parts of a window. Whether fixed,.casement,
awning or double hung. Mullions are so important to design,so many rows this way so many that way.
Jamb width a plus, since I’m a residential builder most jamb widths are 4.5 or 6.5 . It would be really cool
to have the rough opening. Put a face on that. Click the face window menu pops up. window style dou. hung
etc. jamb width, jamb thickness. sash width,sash thickness. Mullions rows horiz. rows vertical. casing interior
casing exterior. sill style and so on. Something quick and fast. All the window and doors that I download from the 3D wharehouse. take to long to up date. I can practically draw the the window faster with native tools.
Sure would like to see a plugin like this same for doors.
Thanks for all your help Steve

DC v 1.3.2

All SketchUp versons & editions.

Both Platforms.

The Model class has no deleted? method.

Annoying error clutters console:

I’ve noticed this happens intermittently in Sketchup 2015 with the latest DC plugin. Do you know when this happens? So one can maybe avoid the error cluttering the ruby console… until (if) this is solved…

The only way to band-aid it is to modify the Sketchup::Model class, which is a no-no for extensions. (It will be rejected for publication on the Extension Warehouse.)

But if you want to do it only for yourself, then:

class Sketchup::Model
  unless method_defined?(:deleted?)
    def deleted?()
      self.valid?() ? false : true
    end
  end
end

There is no way of forcing the DC code to use a class refinement, because that must be done from the DC ruby file that needs to use it.

What can I say? I have reported it publicly and privately multiple times.

Thanks Dan,

I think I can ‘more or less’ reproduce it:

  1. Have a blank model open,
  2. Have Both, ‘Components Options Window’ and ‘Component Attributes Window’ open
  3. Create new geometry and make a component => the error appears.

If you create the component and only later open the ‘windows’ - it ‘usually’ doesn’t happen… and it won’t happen later on either…

Yes I know why it happens, the code calls the deleted? method upon a reference object that is usually a group or component, but occasionally can be pointing at the model object.

It is just that duck-typing needs to be done before making the call.

if (obj.respond_to?(:deleted?) ? obj.deleted? : !obj.valid?)

or class-typing:

if (obj.is_a?(Sketchup::Model) ? !obj.valid? : obj.deleted?)

It is just a silly mistake that we’ve all made. This one has been happening for years.
It is low priority apparently.

Have you checked out Vali Architect Instant Door Window plugin? It’s pretty handy for doors & windows. Can save you own style and edit also cuts through double walls. I got sick of messing with 3D warehouse models & the cut through double walls is great. Can also move after & re-cut the opening.

Made a couple of videos on DC Attributes Add All. One showing it working as it should. One showing it broken. As pointed out by frandzel3d, if the Dynamic Components Attributes window is open prior to the component the error occurs, if not, it works fine.

1 Like

\u (unicode escape character) in double-quoted path strings causes a Javascript error in DC options dialog.

Undo then Redo causes <TypeError: reference to deleted Entity>


v 1.7.0

Loading a new file leaves the previous attribute information displayed in the both of the DC dialogs.

This data should be cleared as neither the definition nor the instance is in the new empty model. (Closing and opening the dialogs clears them.)

in 2020 i got this

Error: #<NoMethodError: undefined method deleted?' for #<Sketchup::Model:0x000001efa0e5d530>> c:/users/tbornhaupt/appdata/roaming/sketchup/sketchup 2020/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbe:396:in block in push_attribute_set’
c:/users/tbornhaupt/appdata/roaming/sketchup/sketchup 2020/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbe:396:in delete_if' c:/users/tbornhaupt/appdata/roaming/sketchup/sketchup 2020/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbe:396:in push_attribute_set’
c:/users/tbornhaupt/appdata/roaming/sketchup/sketchup 2020/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_overlays.rbe:42:in `block in show_dialog’

Yes we know. We have reported it forever … and they just don’t fix it.
I filed a formal report 5 years ago at least, but users have complained before that.

For some reason (perhaps recent code changes) this error is now causing the Options dialog to no longer work (ie, be blank.)