sketchucation logo sketchucation
    • Login
    1. Home
    2. globuloz
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    G
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 5
    • Groups 1

    globuloz

    @globuloz

    10
    Reputation
    1
    Profile views
    5
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    globuloz Unfollow Follow
    registered-users

    Latest posts made by globuloz

    • RE: RubyAPI - UI timers

      @thomthom said:

      hm... the timer is redundant. I see it working the same without it. Still find it strange it doesn't lock up SU. AS Ruby 1.8's threads are not real native threads.

      Maybe the operation of adding 1 is so simple it doesn't lock up. Because I've not been able to do anything useful work within a Ruby thread...

      Yes, you're right, it is redundant.

      Even with a block instruction, SU doesn't freeze πŸ˜„

      
      Thread.new {
      	while true
      		puts "plop"
      		sleep 1
      	end
      	
      }
      
      
      posted in Developers' Forum
      G
      globuloz
    • RE: RubyAPI - UI timers

      I am happy to show you a weird thing πŸ˜„ My friends say me often I have a twisted mind... (good thing or not? ^^)

      So, I test this :

      $i=0
      
      $tid = UI.start_timer(1, true) {
      	puts $i
      }
      
      $tid2 = UI.start_timer(1, true) {
      	sleep 2 # blocks SU
      	$i+=1
      }
      

      And in the output we have : 1, 2, 3, 4...
      In conclusion, SU launch a new iteration even if the previous one isn't over.
      (If not, we would have 1, 1, 2, 2, 3, 3...)
      To note : SU is blocked in the iteration but can launch the next one !

      posted in Developers' Forum
      G
      globuloz
    • RE: RubyAPI - UI timers

      @thomthom:
      I forgot to say I'm using the full Ruby library 1.8.6 (with a .dll replacement and $LOAD_PATH adaptation)

      I would like to run a socket listener. But in general way, I want to understand how timers are managed. Maybe Sketchup has a simple loop like : manage events, drawing, timers... like a game engine would distribute time between events, animation, AI, drawing.

      An other point (I am writing code to test it) is to know if a timer would repeat event if the previous iteration has no finished.

      posted in Developers' Forum
      G
      globuloz
    • RE: RubyAPI - UI timers

      @TIG:
      Thank you for your response !

      Well, I just arrive in the company, I will be there for only three months so I have no pretension to represent anyone but me ^^
      I use, for personal projects, only open-source work and collaborative forum like yours. This is why I preferred to go here in a first time.
      Actually, I was a little bit surprised by your first part of your response BUT (;)) I understand it completely !

      To return to the main point of the subject, I have read the API of course and I know what you wrote. However, I wish you explain more your sentence :

      @unknownuser said:

      Timers do work 'asynchronously', BUT of course block up your threads if they are 'incomplete' or still 'running'.

      Moreover, I test a little thing :

      
      UI.start_timer(0, false) {
      	Thread.new {
      		$i=0
      		while true
      			$i+=1
      		end
      	}
      }
      
      

      and you can see in Ruby Console that $i continues to change although the main code has finished.

      Maybe you are right : I should ask to a Boulder guy because he has an access to the source code.

      Thanks again, have a nice day !

      posted in Developers' Forum
      G
      globuloz
    • RubyAPI - UI timers

      Hello,

      I am a new trainee in Trimble Paris and I have to develop a sketchup plugin.
      I am a newbie and I saw that timers (defined in UI module) would be great to do asynchronous stuff.

      In order to think right, I wish to know how these timers work in Sketchup. I mean, how Sketchup manages these timers ? When does it launch them ? Maybe in a thread ? Can two timers run in the same time (if the previous one hasn't finish before the time expire)

      Thanks to help me to understand the Sketchup implementation, and sorry for my poor English !

      posted in Developers' Forum
      G
      globuloz