I failed to find a complete how-to for successfully compiling an extension for Sketchup, so here is how I did:
- I used Sketchup 8.0.4811 in this how-to
- installed Ruby using RubyInstaller-1.8.7-p352.exe to c:\
- Installed Development Kit using DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe to c:\ including the post installation steps.
- Found the page http://www.rubyinside.com/how-to-create-a-ruby-extension-in-c-in-under-5-minutes-100.html and downloaded http://www.rubyinside.com/files/extension-code.tar.gz from the link in the article.
- unpack the extension-code.tar.gz into the DevKit folder resulting in the folder module-experiment
- run DevKit/msys.bat to get a shell window, and in that shell do:
- cd /module-experiment/MyTest
- ruby extconf.rb
- make
- now you should have mytest.so in the current directory
- copy mytest.so to the sketchup Plugins folder - in my case C:\Program Files\Google\Google SketchUp 8\Plugins
- start sketchup
- use menu Window/Ruby Console
- in the ruby console edit field do as the rubyinside.com/how-to... page says:
- require 'mytest'
- include MyTest
- puts test1
- the last command should print 10
No comments:
Post a Comment