PagesObserver.onElementAdded
-
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
-
Not the way your thinking.
The "Element" added that triggers the observer callback, is a
Pages
collection element, (or member,) which is always aSketchup::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'stypename
which can be slow. BUt it is the only way to identify dimension objects, in those older versions.) -
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
Advertisement