• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

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 27 Aug 2010, 20:19

    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 27 Aug 2010, 20:52

      "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 27 Aug 2010, 20:54

        @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 27 Aug 2010, 21:16

          No problem. I only knew because I did it myself at least one time. 😆

          Hi

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

          Advertisement