Ruby to trigger DC onClick Function
-
Hi,
Is there a way to get a ruby script to trigger the onClick attribute of a Dynamic Component? In particular, I would like to run an ANIMATE function without clicking with the interact tool.
If not, has anyone written a Animation Class that can parse the onClick Attribute and recreate a similar effect?
I am trying to animate objects based on Scene Changes and not with the interact tool.
Thanks,
MikePS why is the source code for Dynamic Components not open? Seems like Google would want us to play under the hood.
-
@mtalbott said:
I am trying to animate objects based on Scene Changes and not with the interact tool.
topic: Dynamic Components that react to scene (aka page) changes
in this post: Re: Using an observer to delete a screen note I said the following:
@chris fullmer said:
That's interesting. I've never noticed that [FrameChangeObserver observer] ...
Yes that is because is one of the API missing class boo-boos. It IS mentioned within the API, in passing.
Pages.add_frame_change_observer
Pages.remove_frame_change_observerIt was featured (documented) in the Sketchup API BlogSpot:
Dynamic Components that react to scene (aka page) changes('scenes.rb') Code properly formatted (by Todd Burch) at:
http://www.smustard.com/forum/viewtopic.php?f=9&t=25It basically only has one event callback:
frameChange( fromPage, toPage, percent_done ),
the intialize method, plus any custom method(s) you need inside to keep your code readable and organized. -
thanks for the info, Dan
I have read that article and I think my problem was that I was looking for the easy way out. I was wishing for a simple way to run the "OnClick" attribute, in particular, without having to create the animation object myself. It's easy to change a simple attribute like material, or lenZ but the interactive nature of OnClick and the tweening of the ANIMATE function make it a little over my head. But I guess this is how I learn.
Thanks,
Mike
Advertisement