• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Coding with Ruby

Scheduled Pinned Locked Moved SketchyPhysics
5 Posts 3 Posters 763 Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    rfresa
    last edited by 13 Dec 2009, 20:04

    Hi, I am new to SketchyPhysics. I have seen several topics on this board that have bits of ruby code in them. I was wondering, is there a tutorial for using code in SketchyPhysics somewhere? I have taken a few programming classes, and am pretty good at figuring things out, but none of the examples I've seen make sense to me yet. Thanks!

    1 Reply Last reply Reply Quote 0
    • S Offline
      Swindel
      last edited by 14 Dec 2009, 17:45

      I don't know anything about ruby but maybe you're looking for this; press Window then Ruby Console.

      1 Reply Last reply Reply Quote 0
      • W Offline
        Wacov
        last edited by 14 Dec 2009, 19:36

        Open the SP UI, select a group in your model. The ontick and ontouch fields appear at the bottom, under 'Properties' (you must have SketchyPhysics 3 X installed). ontouch code is called when the object collides with another, ontick every rate frame. Leave rate at 0 to run every frame. $curEvalGroup is always the group the code is written in, and there are a few other commands which are on various topics in the forums. The SketchUp ruby API may or may not be relevant to what you want to do, remember that almost any API code will work (some commands might crash the sim by attempting to end it). Hope this helps 😄

        http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

        1 Reply Last reply Reply Quote 0
        • R Offline
          rfresa
          last edited by 15 Dec 2009, 10:42

          Thanks! That should be enough to get me started. Is there a "master list" somewhere in my file I could look at to check if my variables, joint names, etc. are being recorded correctly. I have had some trouble with UI sliders not showing up when they should, joints misbehaving, and so forth.

          1 Reply Last reply Reply Quote 0
          • W Offline
            Wacov
            last edited by 15 Dec 2009, 15:29

            If you set global variables (start with a $), you can check them out from the Ruby Console by typing them in. This'll work during the sim, and global variables will also stay behind afterwards. Btw, forgot to say the normal joint controller field also takes ruby code (Any blue field will). You can use a ';' to mark line breaks where there's only a single line to type in.

            http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              1/5
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement