How to install a Ruby Gem for use in SketchUp
-
hmmm...I replaced the original DLL with the 1.8.6 version and I am now getting this message at Startup
Error Loading File ruby-prof.rb
no such file to load -- erbI have ruby-prof.so, ruby-prof.rb and the ruby-prof folder in my plugins folder. Any ideas?
-
comment out these lines from ruby-prof.rb if you dont want pretty outputs or add erb.rb to your ruby-prof dir (I choosed the first one )
require "ruby-prof/graph_printer" require "ruby-prof/graph_html_printer"
-
@dan rathbun said:
Anyone want to make a Mac version out of this?
_making one is out of my league, but I'd like to use it if someone does, I'm attempting to learn ruby as my first, ever, programming language, any tools that work with ruby, SU and Mac should aid may grasp on the mechanics...
any other recommendations welcome.
john
EDIT: I was digging around in systems library and came across this, can anyone shine a light on it's meaning and if it may be causing any of the many Mac ruby glitches that rear their heads.
Notes on building the stand-alone reader.
-
When trying to link with only MacWin and Utils, EqualTol came up as an unresolved external, so someone must be including Tol.h or something at the wrong level.
-
Text.cpp in Model includes BaseApp/BaseAppServices.h. It is calling GetActiveView(). It should be restructured so that it doesn't need to call this.
-
Model/MergeController.cpp is calling AppServices::GetUndoManager() which is not defined at the Model level.
-
InstancePath.cpp and SectionPlane.cpp both reference CPickRecord which is not defined at the Model level.
-
SteStatusText should be removed from PushPullController.cpp
-
The output variable for OpenDocument should be of type IDocument rather than IDispatch.
-
Need Mac implementations of OpenDocument and CloseDocument.
(added in special reader version of XApplication.cpp) -
OpenDocument and CloseDocument are not implemented in the standard version of XApplicaiton. I have copied XAxpplication to the Reader folder so that I can implement this for the reader without changing SketchUp. After 3.0 releases, these implementations should be merged.
-
IApplication::CloseDocument is a worthless method. There should really be a Close method on Document instead. Or at least CloseDocument should take an argument to tell you which document you should close. Maybe XDocument should delete the CSketchUpModel if it was created by a call to OpenDocument?
-
Some methods still return IDispatch* rather than the real type. For example, get_Relationships.
-
-
@driven said:
EDIT: I was digging around in systems library and came across this, can anyone shine a light on it's meaning and if it may be causing any of the many Mac ruby glitches that rear their heads.
Notes on building the stand-alone reader.
That looks like it refers to the C++ files for building the SKP Reader extension for a third-party application. So those 'issues' are C++ issues with the SKP Reader SDK, not Sketchup itself or the SU Ruby API.
-
@adamb said:
I've build it on a Mac and works just fine.
I had to remove some Rails stuff from the startup but it works pretty nicely too.erb.rb is in the standard ruby library.
If you have a full ruby install, you need to add paths to the $: ($LOAD_PATH) array.
[OR.. you could try to comment the stuff for erb out and see if it runs.]Here's a little script I had posted over at Google Groups for Win32 to load standard ruby paths.
-- !loadpaths.rb --
CODE moved to it's own post and updated. (06 JUL 2010)
http://forums.sketchucation.com/viewtopic.php?f=180&t=29412Anyone want to make a Mac version out of this?
_ -
I was trying to use a gem named "cfpropertylist" to create an export script on Mac OS X (Lion) with sketchup 8. I had lots of problems, but finally got it working. Others using Mac may be interested.
I installed the GEM to the standard OS X installed ruby (version 1.8.7). I did "sudo gem install CFPropertyList-2.0.17.gem".
That worked, but messed up the permissions on the files so non-superusers could not read the files. I think this may be because I had a weird umask. I used /bin/find to fix that up.
Then I could require cfpropertylist in an irb session.I then tried to require it in a sample script I loaded in the sketchup ruby console. But it got a file not found. I found a post about replacing the ruby provided with sketchup with the standard OS X ruby on stack overflow: http://stackoverflow.com/questions/3333163/how-to-update-ruby-in-google-sketchup. That worked even thou I have sketchup 8 (and there was no Headers there originally, but I linked one in anyways).
I also saw posts about modifying LOAD_PATH to include the standard dirs. So I put this at the front of my test script:
osx_stdlibpath = ["/Library/Ruby/Site/1.8", "/Library/Ruby/Site/1.8/powerpc-darwin11.0", "/Library/Ruby/Site/1.8/universal-darwin11.0", "/Library/Ruby/Site", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin11.0", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin11.0", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0", "."] $LOAD_PATH.concat(osx_stdlibpath) $LOAD_PATH.uniq!
It still did not work.
Finally I figured out that I had to require the stuff for GEM in order for it to find the package.
Guess it makes sense--I think irb was including the GEM loader for me.So I put this into my script after the code modifying LOAD_PATH:
require 'rubygems'
And finally the require of CFPropertyList worked!
-Derek -
Good job Derek !
1) Now can you d/l and install gems from within Sketchup embedded Ruby ??
2) You are running OSX Lion, so I assume your machine is Intel based. I wonder why you need to add platform dir paths for a PowerPC (MacOS9) platform ??
3) The following dir paths should not have files in them, only subdirs. Why add them ??
- "
/Library/Ruby/Site
" - "
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby
"
4) You also add the current working directory, ie: "
.
" (which can change from time to time, via calls toDir.chdir
in other author's plugins.) So, is this necessary for RubyGems ??5) After
require('rubygems')
returns (sucessfully,) has it added any paths to the$LOAD_PATH
array ?? - "
Advertisement