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

    Help with Animation

    Scheduled Pinned Locked Moved Developers' Forum
    23 Posts 7 Posters 3.3k Views 7 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.
    • renderizaR Offline
      renderiza
      last edited by

      @chris fullmer said:

      Here is a quick animation showing your code in action (no sound):

      [flash=1004,675:rhvt88ob]http://chrisfullmer.com/forums/martin_jumper.swf[/flash:rhvt88ob]

      Hi,

      The code runs while using the “Ruby Web Console” but when I try to make a jumper.rb out of it to put it on the plugins folder the following error shows;

      Load Errors
      Undefined method ‘transform!’ for nil:NilClassError Loading File
      jumper.rb
      undefined method ‘transform!’ for nil: NilClass

      If I try to put the following;

      def transform
      $gc = Sketchup.active_model.selection[0]
      vec = Geom;;Vector3d.new(0,0,1)
      $t = Geom;;Transformation.new(vec)
      $start = Time.now()
      
      view = Sketchup.active_model().active_view()
      
      view.animation = Jumper.new
      end
      

      The jumper.rb loads ok but when I press it no animations are triggered. Can someone please help me with this.

      Thanks

      [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

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

        @unknownuser said:

        The code runs while using the “Ruby Web Console” but when I try to make a jumper.rb out of it to put it on the plugins folder the following error shows;


        Load Errors

        Undefined method ‘transform!’ for nil:NilClassError Loading File
        jumper.rb
        undefined method ‘transform!’ for nil: NilClass


        Because the examples in this topic show very poor programming practice!

        (1) The code is not namespace protected

        (2) The code uses global variables that can conflict with other global variables.

        (3) There is no selection checking that prevents an exception if the selection is empty.

        (4) There is no entity Type checking to ensure that the selected entity(ies) can have the transform! method called upon them.

        I'll see if I can cobble up a better example, perhaps I'll post it in a new [ Code ] topic (so it can be indexed with the Code Snippet indexer.)

        🤓

        I'm not here much anymore.

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

          @dan rathbun said:

          I'll see if I can cobble up a better example, perhaps I'll post it in a new [ Code ] topic (so it can be indexed with the Code Snippet indexer.)

          Done!

          ➡ [Code] AnimateSelection Example v1.0.0

          .

          I'm not here much anymore.

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

          Advertisement