sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Simple example not working...

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    4 Posts 2 Posters 258 Views 2 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.
    • D Offline
      draftomatic
      last edited by

      I wrote a quick test class just to check something, but I can't figure out why it isn't working:

      require 'sketchup.rb'
      
      class Test < Sketchup;;AppObserver
        def onNewModel(model)
          UI.messagebox("new model!")
        end
      end
      
      t = Test.new
      Sketchup.add_observer(t)
      

      That gives an error when SketchUp loads:
      Error Loading File test.rb
      Test is not a class

      Anyone?

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

        "Test" is about the worst name you choose for an identifier. Try something more unique.

        Otherwise, it looks like it should work.

        Hi

        1 Reply Last reply Reply Quote 0
        • D Offline
          draftomatic
          last edited by

          @jim said:

          "Test" is about the worst name you choose for an identifier.

          Ah now it works. Thanks!

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

            No problem. I only knew because I did it myself at least one time. πŸ˜†

            Hi

            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