Skip to content

Instantly share code, notes, and snippets.

@aberant
Created June 11, 2009 00:58
Show Gist options
  • Save aberant/127633 to your computer and use it in GitHub Desktop.
Save aberant/127633 to your computer and use it in GitHub Desktop.
# Show the Ruby Console at startup so we can
# see any programming errors we may make.
Sketchup.send_action "showRubyPanel:"
# This is an example of a simple animation that floats the camera up to
# a z position of 200". The only required method for an animation is
# nextFrame. It is called whenever you need to show the next frame of
# the animation. If nextFrame returns false, the animation will stop.
class FloatUpAnimation
def nextFrame( view )
File.open( "/Users/charris/projects/sketchupmultitouch/test.txt", "r" ) do |f|
puts f.read
end
true
end
# def nextFrame(view)
# new_eye = view.camera.eye
# new_eye.z = new_eye.z + 1.0
# view.camera.set(new_eye, view.camera.target, view.camera.up)
# view.show_frame
# return new_eye.z < 500.0
# end
end
# This adds an item to the Camera menu to activate our custom animation.
UI.menu("PlugIns").add_item("Multi Touch") {
Sketchup.active_model.active_view.animation = FloatUpAnimation.new
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment