@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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement