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

    PagesObserver.onElementAdded

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 241 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.
    • K Offline
      ktkoh
      last edited by

      My plugin Comp2LayerScene.rb has the ability to create new pages which are used for 2d drawings and the drawing view is on its own layer. Now when the user adds dimensions to the drawing he/she needs to set the dim layer to the page layer or the dim show up in other pages.

      My question is could the PagesObserver.onElementAdded be used to check for dim added to the page and then remind the user to make the change to the dim layer or even better do it for the user atomically ??

      Keith

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

        Not the way your thinking.

        The "Element" added that triggers the observer callback, is a Pages collection element, (or member,) which is always a Sketchup::Page class instance object.

        This means it will only fire once for each page when it is created.

        So you will need to use the EntitiesObserver and watch for a dimension object.
        (In SketchUp versions prior to 2014, you'll need to test the entity's typename which can be slow. BUt it is the only way to identify dimension objects, in those older versions.)

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • K Offline
          ktkoh
          last edited by

          Thanks Dan I had finally figured that out and then I tried different observers since my post and I don't think the overhead is worth it. If the user forgets to move the dim to the dwg layer it only means there will be stray dim in other dwg scenes. I am thinking of adding a note when the dwg scene is first made to remind the user that added dim will need to be placed on the dwg layer.

          Keith

          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