sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    @Jim and other coders

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 663 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Didier BurD Offline
      Didier Bur
      last edited by

      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 🎉

      DB

      1 Reply Last reply Reply Quote 0
      • AdamBA Offline
        AdamB
        last edited by

        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"

        Developer of LightUp Click for website

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          Check the method index also. It has methods that have are not listed on the individual pages - even if they lack documentation.

          Hi

          1 Reply Last reply Reply Quote 0
          • AdamBA Offline
            AdamB
            last edited by

            @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

            Developer of LightUp Click for website

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by

              @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.

              Hi

              1 Reply Last reply Reply Quote 0
              • A Offline
                azuby
                last edited by

                Using Object#respond_to? should also be possible. And if you really want to use "OnTransactionEnd", set an alias on "OntransactionCommit"

                azuby

                *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

                Bad English? PM me, correct me. :smile:**

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement