• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Error message : 'reference to deleted Entities'

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 5 Posters 1.0k Views 5 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    kmk111890
    last edited by 17 Apr 2016, 19:12

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

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

    1 Reply Last reply Reply Quote 0
    • D Offline
      driven
      last edited by 17 Apr 2016, 19:33

      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

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 17 Apr 2016, 19:55

        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 ?

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          kmk111890
          last edited by 17 Apr 2016, 19:59

          I will message you. please check inbox

          1 Reply Last reply Reply Quote 0
          • S Offline
            slbaumgartner
            last edited by 22 Apr 2016, 14:07

            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.

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by 22 Apr 2016, 20:18

              Wild guess - he started a New model and so the @entities variable now refers to an invalid collection.

              Hi

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                1/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement