sketchucation logo sketchucation
    • Login
    1. Home
    2. dney
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    D
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 1
    • Groups 1

    dney

    @dney

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    dney Unfollow Follow
    registered-users

    Latest posts made by dney

    • RE: How to install a Ruby Gem for use in SketchUp

      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

      posted in Developers' Forum
      D
      dney