Stop sketchup from visualizing changes in model while code is running

Im not really sure how to even ask this, but when I change something like ShadowTime in my ruby code, I can visually see it changing in my Sketchup Model (shadow, toolbar, etc.). If, for example, I had to loop through different times, the visual representation of this would really bog down my execution.

I have noticed that after running for more than a few second, it will stop displaying and go into a loading state (shadows stop updating and the curser changes to the load symbol). Once this happens, the rest of the code executes successfully and much faster.

Sorry if this is confusing but that was my best explanation. Thanks in advance!

on my mac I find ā€˜Inspectorā€™ windows have a far greater effect than updating the view, and often deliberately call for view.refresh to show progress in the pluginā€¦

If I wrap the code in model.start_operation (ā€œMake Setā€,true), all the user will see is the beachball, which few appreciate as a progress indicatorā€¦

hereā€™s an example from one of mine that makes sets of images for each sceneā€¦

I also believe the running of large loops runs very differently on a mac than a PCā€¦

CREDIT: model and Style set by @DaveR

1 Like

Iā€™m not sure if you want to stop displaying, or if you want to update the view each time you do something. To update the view, I have done simple animation loops that do not use Sketchupā€™s animation class. It requires a method call to refresh the view after the model has been modified. I assign a reference to the view object with:
view = Sketchup.active_model.active_view

Then, inside of any code loop that updates the model, the last line or so is:

view.refresh

That does not have to be done if you use the animation class.

1 Like

Bruce,
sorry, I should have been clear about this, I want to stop the visual display so that my code runs faster.

Make sure you set the second argument of model.start_operation to true. It tells SketchUp to disable UI updates until you commit the operation.
http://www.sketchup.com/intl/en/developer/docs/ourdoc/model#start_operation

The only reason itā€™s not true by default is backwards compatibility for the API.