Does the Google (Trimble) Sketchup Ruby Interpreter work the same as regular Ruby. If not, what differences are there?
Posts
-
RE: Load Newton.dylib file via Ruby
-
RE: Load Newton.dylib file via Ruby
Thanks for your answers in advance so far. Some more questions...
How would you go about including the newton dynamic library? What would the code look like to do this.
Could I just say...
require('newton.dylib')
Make sure it's in the same folder as my .rb plugin code and it should work?
Then the question would be, how do I let ruby know about the functions that exists in the dynamic library, especially if those functions were c-based functions. I vaguely remember declaring externs, but don't know the syntax.
As for loading .bundle files, I'm not entirely sure how I would compile the newton library into a .bundle, any ideas for this?
I can get it to compile to a .a (static library), and I had to do some tricks to get it to compile to a dynamic library (.dylib). Not sure something like that could be a .bundle, since .bundle is usually for applications?
-
RE: Load Newton.dylib file via Ruby
I guess I should have been more clear. DL is NOT DLL. DL is a library apparently which helps you load dynamic files (either .DYLIB for mac or DLL for windows) (http://www.ruby-doc.org/stdlib-2.0/libdoc/dl/rdoc/DL.html), not sure how to use this either though, but I noticed SketchyPhysics used it. FFI is a library which apparently makes this even easier.
I do have the newest version of Sketchup, but I assumed it was still owned by Google since I downloaded it from there. But I do remember seeing Trimble. I will look into that to see what it is.
Is the only way to get Ruby C Extensions to write them myself in C? What do you think of the ruby library FFI?
-
Load Newton.dylib file via Ruby
Hi guys, I have a post here,
http://sketchucation.com/forums/viewtopic.php?f=79&t=51464&p=464580#p464580
Trying to learn how to load .dylib files via ruby in Google Sketchup, any help is appreciated!
-
RE: Load Newton.dylib file via Ruby
If anyone knows to load c-libraries at all in ruby via sketchup I'd be interested to know.
-
Load Newton.dylib file via Ruby
Hi everyone, nice to meet you. My name is Joe and this is my first post. Hopefully someone can help me put this in the right place.
Currently the mac version of Sketchy Physics is broken so I've made it my task to bring it back as I need it for a physics project I'm working on involving magnetic forces.
I got the sourcecode to the newton physics library and compiled it into a .dylib after some trouble. This is the dynamic library equivlant to .DLL on the windows platform.
Now I'm trying to figure out how to load the functions into Ruby.
Looking at the previous sketchy physics tool, it appears the used a library called DL. I did some research into this and apparently there is a better way to do this now using (https://github.com/ffi/ffi) FFI.
I really like how the interface looks how FFI and it seems like it will be easy to use.
Only problem is, unlike the newton source code which compiles to a C-dynamic library, I'm not sure how to compile something like ffi or use it. I noticed the lib folder had some ruby files so I put it in my sketchup's plugin folder, and tried making a require statement to ffi.rb, but it appears it's missing ffi_c. I'm not sure what that is, I assume something I was supposed to have compiled.
I'm running Mac Os 10.8.2, with the latest version of xCode and latest version of Google SketchUp. Any help is appreciated if anyone has an idea how to make this work. Maybe DL is the only way to load external c library commands?
-
RE: [Help] Servo won't move, tell me why? [File included]
First, thanks for taking the time to respond mitcorb and oganocali.
I must have implied that I didn't know what density 'really' was. As for density being weight per unit volume I understand.
In the context I was speaking, I was explaining that density is a value you can give in sketchy physics to any 'group'. Therefore density is how the program interprets it to be. I was asking how it was 'supposed' to act for the program and what it's intended purpose was (like to be given an example to where it's used correctly).
What I'm trying to argue is that the density should not interfere with the joints trying to rotate an object or not. It appears for small objects a high density number is required before rotation or ANY kind of joint movement for that matter can happen. I'm saying this is a bug.
Proof of the bug is listed here, that is where I found my answer. If you find it to be a bug also please star the issue.
Thank you.
-
RE: [Help] Servo won't move, tell me why? [File included]
Actually I did some more tests and it appears the density value has something to do with it, when I changed the density to 10 for the objects it started working correctly (I had to add a floor since the objects instantly started to drop). Apparently the smaller the object is there more density it needs to work. I'm not sure why... anyone have any idea why this is the case?
What does density really do?
-
RE: Groups, Components and Joints
I agree the video is very helpful, i've been having a very frustrating time understanding the physics engine and it was not for you to test all the different ways to do things and what errors could occur because of it.
-
[Help] Servo won't move, tell me why? [File included]
Hi,
I've been stuck for 2 days trying to solve an issue and finally broke down to write a message here.
My problem is I'm trying to make a servo motor I modeled act like a servo. Using Sketchy Physics 3.2 on windows OR mac (I tried both), I've attempted to get the top part of my servo to spin. I've understand how to use joints to move objects as I've done so in other tests successfully.
Just to demonstrate.
1.) You create the servo joint (I scale it down to appropriate size) and set it's axis to how I want it to spin.
2.) I attach this to the object I want to move (in this case the servo head).
3.) I group the servo joint and the servo head into a group.
4.) Using the joint connector button, I click the joint inside the group hold control and click the servo base (part of the servo that does not rotate) as the reference.What it should do is when I click run a slider bar should appear that lets me rotate the servo arm. What happens for me is nothing! I move the slider bar and nothing seems to happen.
I've tried...
- Adding a floor (didn't work)
- Using Mac OS X (Lion), didn't work (some midi missing error did occur but read up about it and it should work anyways)
- Using Windows 7
- Creating new files (without using my model and new shapes) (works!)
- Create new file (with my model) (doesn't work??)
I went through a lot of trouble ( a good 6 hours) to model the servo exactly to the 1/10th of a millimeter accuracy. This is why I want to use the existing model. In case you are curious it's modeling a JRServo DSR581 with 127ounces per inch of torque.
The file with the problem is linked here on my server
Any help is much appreciated, thank you! I can donate $5 by PayPal for help.