• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

What is needed to script?

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 3 Posters 1.5k Views
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.
  • S Offline
    sk.lion
    last edited by 27 Feb 2008, 00:46

    One area of sketchup which i have not gotten much into is the ruby scripting. While i do use various scripts for my models, like the mirror and roof script, i have not tried to make any scripts myself. Would someone be able to tell me what programming language or coding that should learned to become able to create my own scripts for sketchup? There are some ideas that are floating in my head, and would like to see them become reality one of these days.

    Thanks.

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jim
      last edited by 27 Feb 2008, 01:22

      @sk.lion said:

      One area of sketchup which i have not gotten much into is the ruby scripting. While i do use various scripts for my models, like the mirror and roof script, i have not tried to make any scripts myself. Would someone be able to tell me what programming language or coding that should learned to become able to create my own scripts for sketchup? There are some ideas that are floating in my head, and would like to see them become reality one of these days.

      Thanks.

      SKlion,

      I have moved this thread to the Ruby Discussion forum. It was originally posted in the Ruby Scripting section of the How to Forum.

      As far as software you need SketchUp, and a text editor; even the most basic is enough to get started with: notepad.exe, edit.com (MS DOS).

      SketchUp scripts are written in the Ruby language . There's actually a lot of information on learning Ruby online.

      If you want some instant gratification, try this:

      • open your text editor of choice.
      • Enter the following code:
      
      require "sketchup.rb"
      def myHello
      UI.messagebox("Hello, SketchUp")
      end
      UI.menu("Plugins").add_item("Hello!") { myHello }
      
      
      

      That's it. Save the file as hello.rb and move it into your Plugins folder. Now you could close and restart SketchUp, but that gets tedious after awhile. Open the Ruby Console window, and type:

      load "hello.rb"
      

      This will load the file and execute it, giving you a menu item named Hello! If you makchanges tot he script you need to load it again so SketchUp knows about the changes.

      Next you'll want to start reading the API documentation , and also look at other plugins.

      And of course, come back here and ask questions.

      Note to the other scripters, I think it's a good experience to see what happens to the Plugins menu when you load the script again - I left it out on purpose.

      Hi

      1 Reply Last reply Reply Quote 0
      • S Offline
        sk.lion
        last edited by 27 Feb 2008, 03:14

        Thanks, i think there is still lots of room to grow in scripting, just wanted to learn a new trick 😛

        1 Reply Last reply Reply Quote 0
        • A Offline
          Alan Fraser
          last edited by 27 Feb 2008, 11:19

          Useful link for the more advanced.
          http://notepad-plus.sourceforge.net/uk/site.htm

          3D Figures
          Were you required to walk 500 miles? Were you advised to walk 500 more?
          You could be entitled to compensation. Call the Pro Claimers now!

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

          Advertisement