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

    Editing geometry while onActivePathChanged

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 125 Views 1 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

      I'm using the ModelObserver's onActivePathChanged event to detect when components/groups are closed after editing. When that condition is met I call a method which deletes and adds some edges to a component definition in the model.

      However, when an edge is added or removed onActivePathChanged is called again for every change. And since onActivePathChanged calls the method which causes the edges to be added or removed I now suddenly have an endless loop that runs until the call stack is full and SU bugsplats.

      
      onActivePathChanged -- calls --> updateComponentMethod
      updateComponentMethod -- when adding/removing edges; calls --> onActivePathChanged --> LOOP!!!
      
      

      If I remove the lines that add or removed the edges the loop doesn't occur.
      I have worked around it by setting a module variable when I start updating which makes onActivePathChanged exit immediately if the update flag is set to true.

      But I don't understand at all why onActivePathChanged is called back when I add/remove edges. Some kind of weird bug?

      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