Enscape plugin TypeError in Ruby Console

Hello
why after Enscape plugin for SketchUp installation SketchUp API starts to act differently? for example without plugin i can create empty group like this (you can type this directly to ruby console):

model = Sketchup.active_model
model.start_operation("DrawExtends", true)
	entities = model.entities
	extg = entities.add_group	
model.commit_operation
=> true

But with Enscape it throws error:

model = Sketchup.active_model
model.start_operation("DrawExtends", true)
	entities = model.entities
	extg = entities.add_group	
model.commit_operation
Error: 
#<TypeError: reference to deleted Entity>
<main>:4:in `attribute_dictionaries'
<main>:4:in `onComponentAdded'
<main>:4:in `commit_operation'
<main>:4:in `<main>'
SketchUp:in `eval'

=> true

Is there a problem with my script or should I call that Enscape is breaking my script :slight_smile:

SketchUp Ruby is known to quickly delete an empty group, so recommended practice is to immediately add an entity such as a cpoint that you can delete later after adding real content. It is likely that escape tries to access the empty group after it is erased.

1 Like

I also suggest changing the topic title as it does not really correctly describe what is happening.
Ie, it is a bit bombastic to say that the “API” is broken, when in fact it is not.

The API is acting normally and properly raising an exception because an extension’s observer is trying to access your group’s dictionaries collection.

Now, we could also be fair and say that the Enscape code is not acting defensively to ensure that the object passed into the observer callback is valid. We might also ask @tt_su & team why would the observer queue continue to call callbacks with invalid objects ?

1 Like

Dan, Done! :innocent:

1 Like