@ruts said:
In my calculations ... I want to use the base ruby class Matrix which is made for such operations. I found out that it's not just adding require 'matrix' to your code.
Because SketchUp was not distributed with the Ruby Standard Library until version 2014.
@ruts said:
I did copy the matrix.rb and e2mmap.rb (which is required by matrix.rb) from the ruby2.2.2 folder ...
This will not work, as you need to use the library compiled and distributed with the Ruby version that SketchUp uses. The constants RUBY_VERSION and RUBY_PATCHLEVEL typed at the console tell you what SketchUp embedded Ruby is.
@ruts said:
... I believe this is the right way to require 'matrix'.
Nope (when the standard library is properly installed,) just a simple require 'matrix' will do (because it will load it's own dependencies as it is evaluated.)
@ruts said:
I think I already have a solution for my problem.
NO you don't, because you "don't have time to read the book," all this basic Ruby 101 knowledge is escaping you.
So just go to my GitHub repo and get the Standard Ruby 1.8.6-p287 Library packaged for SketchUp 2013 and earlier on Windows ONLY.
https://github.com/DanRathbun/sketchup-ruby186-stdlib-extension/releases/tag/2
With SketchUp closed:
(1) Put the RBZ archive someplace where you can navigate easily to it.
(2) Delete any manually copied library files (such as those you mentioned copying above.)
(3) Then start SketchUp 8 and use the manual "Install Extension ..." button from
Window > Preferences > Extensions
(3a) Navigate to where you saved the RBZ archive, and select it, click OK.
(4) Open the console and test that the paths are correctly set in $LOAD_PATH (aka $:) by typing:
puts $: and ENTER
You should see a listing similar to:
puts $:%(green)[C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins C:/Program Files (x86)/SketchUp/SketchUp 8/Tools C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/1.8 C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/1.8/i386-mswin32 C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/site_ruby/1.8 C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/site_ruby/1.8/i386-msvcrt]nil
The actual program files path might also look like:
%(green)[C:/Program Files (x86)/Google/Google SketchUp 8/...]
(5) Then further test the loading of "matrix.rb" via:
require "matrix"
You should see true returned.