@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
do not forget to stop timer
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.
It is a step to complex path+profile modeling tool, I guess. Looks like, the final destination is to set some 'key' positions along the path and apply some transformations (move, rotate, scale) to the profile at each 'key' position. Intermediate steps transformations (between key positions) will be interpolated between 'key' transformations.
. Only if you change some properties of the edge (for example layer or smoothness), then modify event rises and onChangeEntity envokes.
The point is that script processes vertices with corresponding indices: so maybe flipping normal or 180 degrees rotation (or 90) of one of 2 faces may help.
