Ruby Errors in Dynamic Components

This one is a Javascript Error I think:

Script error with Dynamic Components

1 Like

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.

1 Like

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.)

1 Like

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.)

3 Likes

Good day. We have implemented a system for displaying letters and numbers from an attribute into a real 2D form of a figure for drawings. But they ran into the following problem: “0” is not perceived as a digit, but is perceived as a cancellation of the formula, and from the hidden everything turns out not hidden. The sign “-” is also not perceived.

What is it that they do except ignore long standing problems and come up with new (useless) ways to justify their employment? Getting really annoyed with the non-performance.

1 Like

Noticed another error today, after creating a normal (non-DC) component, I see in the console …

Error: #<NoMethodError: undefined method `length' for nil:NilClass>
c:/users/dan/appdata/roaming/sketchup/sketchup 2020/sketchup/plugins/su_dynamiccomponents/ruby/dcobservers.rbe:584:in `onToolStateChanged'
Error: #<NoMethodError: undefined method `length' for nil:NilClass>
c:/users/dan/appdata/roaming/sketchup/sketchup 2020/sketchup/plugins/su_dynamiccomponents/ruby/dcobservers.rbe:584:in `onToolStateChanged'

Another probable DC bug is the frivolous creation of multiple “dynamic materials” when copying a DC.

See:

1 Like