Thursday, November 30, 2023
Home3D ModelingTypeError when subtract is used - Ruby API

TypeError when subtract is used – Ruby API


An extension I’m creating makes use of subtract to edit two element situations.
This technique is described within the Ruby API.

However once I apply the strategy within the code, an error is proven 2 occasions:
Error: #<TypeError: reference to deleted Entity>

Additionally, once I apply the under code snippit from the API, I get the next error:

# Code from Ruby API

entities = Sketchup.active_model.entities
instance1 = entities[0]
instance2 = entities[1]
consequence = instance1.subtract(instance2)
# Outcome Ruby Console

Error: #<TypeError: reference to deleted Entity>
<primary>:3:in `attribute_dictionaries'
<primary>:3:in `onComponentAdded'
<primary>:3:in `subtract'
<primary>:3:in `<primary>'
SketchUp:in `eval'
Error: #<TypeError: reference to deleted Entity>
<primary>:3:in `attribute_dictionaries'
<primary>:3:in `onComponentAdded'
<primary>:3:in `subtract'
<primary>:3:in `<primary>'
SketchUp:in `eval'
=> #<Sketchup::Group:0x0000015e87548af8>

Am I overlooking one thing that’s inflicting this error message?


Probably it’s attributable to your particular modell (share it, and somebody can examine).

For me it really works (Home windows 10, SU2021)

subtract

Here’s a demo mannequin.
I’ve it with all subtract operations in several fashions.

SU22_subtract demo.skp (105.0 KB)

In any case, good to see that it really works for you in SketchUp 2021.
Now I nonetheless have to seek out out why I do get the error message in SketchUp Professional 2022.

I simply checked your mannequin and obtained an identical consequence as my animation above. (Nonetheless in SU2021, I can check later as we speak with 2022 at residence)

Studying your error messages, you could have an Extension, operating an observer in a background…?

Thanks for the fast responses @dezmo.

I simply turned off all extensions.
Then the error message was not displayed.

Turned on all extensions one after the other and it seems that Enscape, at this level, is triggering the error message.



1 Like

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments