[quote=“barry_milliken_droid, post:1, topic:6111, full:true”]
I could run an initialization method at beginning of each Session recreating the observers.[/quote]
Yes this is how it must be done.
See the API docs for
You create 1 master AppObserver subclass instance (inside your plugin’ module namespace,) and attach it to the application using
Within the AppObserver callbacks
onOpenModel() you attach a new instance of your plugin’s custom
Sketchup::ModelObserver subclass, passing in the model instance reference as an argument with the
Within your model observer’s
initialize(model) method you can attach new instances of your custom
EntitiesObserver subclass to whatever entities collection object that exist at that time. (Which will always be at least the model level entities, even be it empty.)
You can also at this time attach other observer subclass instances to other collection objects that belong to the model, such as the
You could also attach a new
Sketchup::EntityObserver subclass instance, to specific drawing objects, by iterating
Entities collections, and checking for some property or perhaps your plugin’s custom
AttributeDictionary (use “AuthorNamespace_PluginName” as the dictionary name,…) with a certain attribute set to some predetermined value.