Error message : 'reference to deleted Entities'
-
Hi,
I have a problem with the error message 'reference to deleted Entities' when i run the code i made.
My work was to indicate my code in another way.
At first, the structure of code was
` toolbar = UI::Toolbar.new "Name"
....
toolbar.showdef Name2
model = Sketchup.active_model
entities = model.active_entities
...
inputbox
...
entities.add_face
....
selection = model.selection
...
end`That is a simple code to make a inputbox. And now, I am trying to make webdialog(Actually, I refered to other posts on this site for making my own codes, Im very thankful to all users here) and the code is shown below
` def Name3
@model = Sketchup.active_model
@entities = @model.active_entities
...
HTML
...
@entities.add_face
...
end
Name3`This is the simplest code to make a webdialog. The result of running both codes above is same. I just tried to change 'inputbox' way to 'webdialog' way. Since I know the structure of both codes very well, it looked like it has no problem. But, I could see the error message and it was started since the line
@entities.add_face
which can be seen above(Error: #'reference to deleted Entities' C:/Users/name/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/practice.rb:112:in `add_face').What Im wondering is the webdialog was run very well for other codes. Only one code isn't working with the error message 'reference to deleted Entities'.
Is there someone who knows the error message? Please help me solve the problem.
-
are you using Capitals for method names in your real code?
You need to post the full example for anyone else to find the problem...
if you do, wrap it in a 'code' block so it's easy to read and copy paste for testing...
webDialogs normally work fine...
john
-
I moved this to the proper forum.
As @driven says, you only use a CAPITAL letter to start a module, class or constant name.But without seeing your 'proper code' how are we ever going to help you debug it ?
-
I will message you. please check inbox
-
The message means that you are trying to use a Ruby variable that refers to a SketchUp entity that has been deleted since the variable was assigned, in other words, you are hanging onto a Ruby variable beyond the lifetime of the underlying SketchUp entity. There are several reasons why this could have happened, such as your code explicitly deleting the relevant object or performing an operation that caused SketchUp to need to replace the original object with a new one. As already noted, it is impossible to diagnose what is really wrong based on the snippet you posted, especially since the expressions there aren't even correct (e.g. add_face needs arguments).
I assume based on your last post that you have taken this discussion offline to PMs. It would be helpful to others who might encounter similar issues if you can post the resolution here once you find it.
-
Wild guess - he started a New model and so the @entities variable now refers to an invalid collection.
Advertisement