sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Removing observers

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 192 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.
    • thomthomT Offline
      thomthom
      last edited by

      How do you remove observers? What is the argument to pass on?

      I've been using an entities observer to monitor the enitites of the active path. Whenever the path changes I need to remove the observers watchign the old path. But now?
      http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#remove_observer
      The example in the manual doesn't give much of a clue. Just says observers. I tried passing my Observer class, but that didn't do anything. The remove_observer method return false every time.

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

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

        @tig said:

        http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#remove_observer ?

        That would be the same link I provided in my OP. It's not obvious to me what it does and what the observer is.

        I've tried to make store the return value when I do MyEntitiesObserver.new ( myTemp = MyEntitiesObserver.new )

        And then I try entities.remove_observer( myTemp ) and that returns true. But the old observers still triggers... 😞

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

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#remove_observer ?

          You need to pass the observer to the 'remove_'... You must have an entity_ or entities_observer ?

          TIG

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

            Ok. Found the problem. I was using model.active_path to cache the last path. When the last path was the model itself it'd return an empty array.

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

            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