How does zoom to fit calculate the border that is left on the screen?

I would like to zoom to fit or zoom to selection without leaving a border. I intend to use a macro to first zoom to fit and then zoom by a factor that eliminates the border, but I don't know how the border is calculated. Is it a percentage of the model bounding box in the current view?

SolidworksGeneral
Answers 2
DG
DG 2017-11-28 Best Answer

​, are you looking to do this in a model or drawing? Also you then looking to export the zoomed view as picture?

DS
DS 2017-11-28

Hi Deepak, I'm looking to zoom to a part within an assembly, and then save the zoomed view as an image. When I use the command ModelView.ZoomToSelection() with the part I want to focus, SW leaves an space between the bounding box of my part and the window border. I would like to zoom more, so that my part fills the entire window.

This is what I get with ZoomToSelection():

This is what I want:

If I knew how SW calculates the margin it leaves maybe I could use the ZoomByFactor() command to eliminate it from the view.

I appreciate your help very much!

comment imagecomment imagecomment imagecomment image