sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    [Bug] model.valid?() on PC

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 66 Views 2 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.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by

      [As of v8.0M2, this date,] The model.valid?() method is bugged on PC. If you have a reference to a model, then close it (by opening a new empty model,) the reference still points to a valid Sketchup::Model object, and calling valid?() still returns true.

      If you get a reference to the new model, it will have a different object_id, than the old one. Any use of instance methods against the OLD model object (weirdly,) return references to the NEW model object's child objects. (such as active_entities, active_layer, etc.)

      So, on PC, you cannot use valid?() to test model objects (in order to maintain a collection of models for a multi-model plugin.) On PC, you must test for:
      old_model.object_id != Sketchup.active_model.object_id
      .. and if true, delete the old_model reference from your collection Array, Hash, etc

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        And this behaviour is new to M2? I thought it acted like this before as well...

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          I do not know if it is new. I just ran across it. Could not find a bug report, so I filed one.

          This post is just a "head's up" notice.

          I'm not here much anymore.

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

          Advertisement