@designforlife said:
Can anyone explain the correct use of view.invalidate and/or start_timer?
You may try to substitute "while...end" or "for...end" etc control structures by timer. The funny thing is that maybe it is not necessary to put 'Sketchup.active_model.active_view.invalidate' line inside the timer.
` wait_time=(<suspend period>)
times=(how many times you want to repeat <some code>)
timer_id=UI.start_timer(wait_time,true) {
<some code> # put some geometry to active_model
times -=1 # decrement times to be able to stop timer
Sketchup.active_model.active_view.invalidate
timer_id=UI.stop_timer timer_id if times==0
}`
I noticed, that visual results of <some code> processing appears even without view.invalidate. Note, that <some code> appears to work a kind of 'transparent' way (you may zoom, pan, rotate view and even launch other commands during the timer processing).Such behaviour indicates, that during <suspend period> all possible events (mouse events, key stroke events and so on) rise and you can handle them.
Hope that helps.