Controle Servos External
-
How can i controle servos with other programs?
Is ther a API or can i import with a script CSV or INI files?I have test a Ruby code for file reading in the UI but it crash.
-
I'll try and follow-up with a better post but if look at webdialogs and getting ruby to talk to javasript which can make ajax calls you might find your answer. I am doing the same to animate data from an SQL database into a regular sketchup animation so servos should be no different. This may become easier if Sketchup incorporates the a more fully functional Ruby as has been hinted at. Websockets would make this much easier.
-
Can you send me pleas the source?
Ripper121 [at] gmail.com -
http://sketchupapi.blogspot.com/2008/02/sharing-data-between-sketchup-ruby-and.html
http://www.martinrinehart.com/models/rubies/ruby2javascript_javascript2ruby.html
This post by the illustrious Martin Rinehart as well as Scott L. gets you most of the way and then the code looks something like this
In the servo value field place this getVar("@@servovalue") #yes you need the quotes
#Try and avoid global variables and somehow using the getVar and setVar functions makes things crash a little less.
In the callback function set an instance variable like @@servovalue1 = callbackarray[1] #the callback returns a string
#so you need to deal with
#the sub valuesIn reality this can all be done without using the ontick function with the variable value update period being controlled by the setTimer function in the javascript. This give a bit of a choppy simulation as it pauses to get the values from the sql database but if you capture the animation frames you should be able to take the choppiness out.
I'll clean up what I have built on some suggestions and insights from folk like Mr. K and try to post something less cryptic.
http://sketchucation.com/forums/viewtopic.php?f=61&t=38368 is a link back to some work just pulling from a file.
Ciao.
-
Thx
But the second link is down. -
Try again. Worked for me this morning. Perhaps the server was down.
In general I find Mr. Rinehart's Edges to Rubies one of the goto books even if it doesn't specifically target Sketchy Physics.
-
May or may not be relevant but simfonia animation tools does CSV input which I think is severely underutilized in other sketchup plugins
Ash
-
Servo is an actuator (like in a radio controlled plane) but in this instance it is a virtual servo used in the physics plugin "sketchyphysics"
-
I must say that simfonia was pretty impressive at BaseCamp 2012. I think I'll have to dive back into that first chance I get.
-
Hello Mptak,
As Ashscott suggests (thank you!), you should find your happiness with our plugin. You will indeed quickly be able to drive transformations of your choice (rotation, translation, visibility, color, position ...) from data contained in a CSV file.
Do not hesitate to ask me your question, for now I suggest you download the trial version and try the quick-start guide (http://www.simfonia.fr/SAT/index.php?page%20=%20&%20PHPSESSID%20=%20r5d5vdo38o0taei07aaqaj9j04%20documentation)
P.S: what is a servo? Is this an actuator such as in radio control plane?
Advertisement