Can 'interact' tool interactions be scripted?


#1

The interact tool allows animations to be triggered.
Can one name these interactions and trigger them from ruby script, say by a timer at certain times,
or based on external events ?

Scripting is possible with scenes with the Pages/Page objects, so looking for something similar.


#2

The DC InteractTool is not purposely exposed for other scripts to use (at this time.)


#3

Ok, thanks. What purpose though ?

How are animations like these made - https://www.youtube.com/watch?v=ahKOSb9j9Qg
They are running through each frame with a timer ?


#4

Because it is a proprietary internal SketchUp extension, and they chose not to expose and publish any interfaces to it’s features,… other than via the dynamic attributes.

The poster does not say much, so I’d just be guessing.


Have you looked at the abstract Animation class from the SketchUp API ?

You can use the move! method on groups and component instances within animations.
http://www.sketchup.com/intl/en/developer/docs/ourdoc/componentinstance#move!
This is likely what that poster did.

module Author::SomePlugin

  class CustomAnimation

    MENUTEXT = "Run Custom Animation"

    attr_reader(:timeout)

    def initialize( timeout_sec = 20.0 )
      @timeout = timeout_sec
      @timeout_timer = UI.start_timer(@timeout,false) {
        Sketchup.active_model.active_view.animation = nil
      }
    end

    def nextFrame(view)
      # move groups around with move! method
      # return true to proceed to next frame
      # return false to end the animation
    end

  end # class CustomAnimation

  # This adds an item to the Camera menu to activate a custom animation.
  UI.menu("Camera").add_item(CustomAnimation::MENUTEXT) {
    UI.start_timer(0.0,false) {
      Sketchup.active_model.active_view.animation = CustomAnimation.new(30.0)
    }
  }

end # Author::SomePlugin