sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Very Odd Bug

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 229 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
      MartinRinehart
      last edited by

      Edit: Problem solved. Thank you for stopping by to lend a hand.

      Stupid Programmer Trick # 38,298,987,234

      The first component to start moving was shorted by one second. Had nothing to do with the quadrant.

      In this script:

      
      load( Sketchup.find_support_file('sketch_talk.rb', 'Plugins/ruby_console_pro/') )
      n
      box o, [20,20,0], 10
      box1 = g 'box1'
      m box1, [20,20,30], 0, 20
      none
      
      box o, [-20,-20,0], 10
      box2 = g 'box2'
      m box2, [-20,-20,30], 4, 20
      none
      
      box o, [-20,20,0], 10
      box3 = g 'box3'
      m box3, [-20,20,30], 8, 20
      none
      
      box o, [20,-20,0], 10
      box4 = g 'box4'
      m box4, [20,-20,30], 12, 20
      none
      
      go
      
      

      four boxes are created in the four rg quadrants. Translating SketchTalk to English, that's:

      
      n # select all, delete (quickie File/New)
      box o, [20,20,0], 10 # Rectangle, origin to [20,20,0], PushPull up 10
      box1 = g 'box1' # Create ComponentInstance named 'box1'
      m box1, [20,20,30], 0, 20 # schedule a future move during seconds 1 through 19
      none # unselect everything
      
      ...
      go # begin the scheduled moves
      
      

      Each box schedules a move, 20 units out into its quadrant and 30 units up the blue axis. They move, which is great.

      But the box in the positive r, positive g quadrant doesn't quite do a full move. The move code is quite simple-minded. It divides the move vector into distance per frame. It has nothing to do with quadrants.

      
          def create_amcis() # convert registrants into actionable, movable CIs
              for reg in @@registrants
                  duration = reg.stop - reg.start
                  frames = duration * $sketch_talk_fps
                  r = reg.vector[0].to_f() / frames
                  g = reg.vector[1].to_f() / frames
                  b = reg.vector[2].to_f() / frames
                  reg.actionable = Con_Amci.new( reg, r, g, b )
              end # registrant loop
          end # of create_amcis()
      
      

      The move vector is [20,20,30]. Actual move is speed-dependent:
      5 sec. [16,16,24]
      10 sec. [18,18,27]
      20 sec. [19,19,28.5]
      40 sec. [19.5,19.5,29.25]

      The other three boxes animate happily to a full [20,20,30]. Shuffling the box order doesn't change the behavior. The box in the positive red, positive green quadrant doesn't do a full move.

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Glad we helped πŸ˜‰

        TIG

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

          @tig said:

          Glad we helped πŸ˜‰

          Are your martinis as dry as your humor?

          Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

          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