Best observer to implement on “classification change”

What would be the best observer to implement to execute a function each time the classification of a component is changed?
Would it be “EntityObserver”?
Would it hurt the performance of SketchUp too much?

I think that Classification changes are really attribute dictionary changes, and dictionaries are an Entity sublcass.

But changes to attribute dictionaries or dictionary objects do not yet fire any observers, as far as I know.

I thought that this was an API request, but I cannot find it in the tracker.

A potential problem with classifications is that they use nested dictionaries. And the nesting can change as the class changes. This would make it difficult to track a tree structure of dictionaries when the structure can change. (Think, dynamic pruning and grafting of branches.)

Whoops, my test was wrong. Yes they do. Ie …

EntitySpy#onChangeEntity: #<Sketchup::AttributeDictionary:0x000001d44bf4ea18>

But the callback does not tell what attribute key changed.

That is precisely the reason why I want to put an observer. If you change the classification from ifcwall to ifcwindow,
all the information that was inside the previous one (ifcwall) disappears and you have to generate it again.

There is no problem, only one change let me know that I have to test the entity info again.

If the observer only test changes on dictionaries will be SketchUp slower?
Would SketchUp slow down the observer too much?

I do not have an answer to either question. You would need to do benchmarking comparisons to know the answer.

1 Like