@Jim and other coders
-
Hi Jim and all,
I just discovered that the method "OnTransactionEnd" of the ModelObserver class doesn't work or doesn't exist.
It tried a logic name "OntransactionCommit" and it worked as expected -
Hi Didier,
With a language like Ruby that supports reflection you can always query objects to see what they actually do respond to:
Sketchup::ModelObserver.new.methods - Object.methods
gives:
["onDeleteModel", "onTransactionAbort", "onSaveModel", "onTransactionRedo", "onTransactionStart", "onTransactionUndo", "onTransactionEmpty", "onEraseAll", "onTransactionCommit"]
So perhaps its called "onTransactionCommit"
-
Check the method index also. It has methods that have are not listed on the individual pages - even if they lack documentation.
-
@jim said:
Check the method index also. It has methods that have are not listed on the individual pages - even if they lack documentation.
Totally agree. However using the methods() method is 'straight from the horses mouth' as it were. No worrying whether the docs are right / up to date etc. If it reports there is a method called "blah", it is 100% certain there is a method called that.
Adam
-
@adamb said:
@jim said:
Check the method index also. It has methods that have are not listed on the individual pages - even if they lack documentation.
Totally agree. However using the methods() method is 'straight from the horses mouth' as it were. No worrying whether the docs are right / up to date etc. If it reports there is a method called "blah", it is 100% certain there is a method called that.
Adam
That right, even if the method is not part of the API and was created by another plugin.
-
Using Object#respond_to? should also be possible. And if you really want to use "OnTransactionEnd", set an alias on "OntransactionCommit"
azuby
Advertisement