Zoom_extents dosn't work properly

After:
Sketchup.send_action(“viewRight:”)
Sketchup.send_action(“viewIso:”)
I call
Sketchup.active_model.active_view.zoom_extents.

I would like to get a view of the model dosn’t go beyond the scope of the SketchUp window.
Generaly it works, but from time to time, especialy when model on the begining is zoom in, after calling .zoom_extents the model is bigger then Sketchup window.

Do you have any suggestions?

This sentence does not make sense. Try using smaller sentences with the Bing translator.

This is confusing part: “when model on the begining is zoom in”


As always it helps to post a SKP file that shows the issue.

Screenshot images also help greatly (“A picture is worth a thousand words.”)

And please, list what SketchUp version number and platform shows the problem.


Oh, and are these Ruby statements spaced out ?

Is there time in between each statement for SketchUp to complete the view changes ?

Sketchup.send_action("viewRight:")
Kernel.sleep(1.0)
Sketchup.send_action("viewIso:")
Kernel.sleep(1.0)
Sketchup.active_model.active_view.zoom_extents
Kernel.sleep(1.0)

I suspect Dan’s last comment may be on the money. It is dangerous to assume that send_action executes synchronously rather than being queued up until a later moment when the Ruby API (or maybe the GUI) isn’t busy.

Yea, came from experience. I have a plugin that kept saving the model before the view changes were done. (Even with view transitions off and delay at 0.) I attempted to wrap it in a View observer, but there was still a bug, and I could not release the plugin. (I think the bug has been fixed a couple of versions ago, but I never got back to fixing the plugin.)