sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Ruby to trigger DC onClick Function

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 1.2k Views 2 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.
    • M Offline
      mtalbott
      last edited by

      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,
      Mike

      PS why is the source code for Dynamic Components not open? Seems like Google would want us to play under the hood.

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        @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_observer

        It 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=25

        It 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.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • M Offline
          mtalbott
          last edited by

          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

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

          Advertisement