Bug rs.ZoomExtents() with rs.EnableRedraw(False)


#1

Greetings,
I have written the following script to set a specific layout as the current view then for each detail in the layout I call the rs.ZoomExtents() command. However I get different results depending on weather or not rs.EnableRedraw() is True or False.
When I set EnableRedraw(False) all of the views on the layout are not set to the proper zoom, but when I commented out rs.EnableRedraw() the script functioned as anticipated. However I am not sure why turning off redraw would have an effect on this.
Any assistance would be greatly appreciated.
Below is my short bit of code as well as images of before and after images with and without redraw enabled.

import scriptcontext
import rhinoscriptsyntax as rs

LayoutNames=scriptcontext.doc.Views.GetPageViews()
Layouts=[]
for name in LayoutNames:
    Layouts.append(name.PageName)
Layout=rs.GetString("Select which layout the block should be place into.",Layouts[0],Layouts)
if rs.IsLayout(Layout)==True:
    rs.CurrentView(Layout)
    Details = scriptcontext.doc.Views.ActiveView.GetDetailViews()
    #rs.EnableRedraw(False)
    for detail in Details:
        guid = rs.coerceguid(detail)
        rs.CurrentDetail("DRAWING",guid)
        rs.DetailLock(guid,False)
        rs.ZoomExtents()

Before the script was run:

Script with rs.EnableRedraw(False)

Script with #rs.EnableRedraw(False) commented out

Also, I should note that this is happening with SR 5.8.40128


(Dale Fugier) #2

Just curious, if you want to zoom extents, which requires drawing, why would you disable drawing?


#3

This is part of a larger script where I am selecting a large number of objects from the model and hiding them in each detail, then doing rs.ZoomExtents() then changing the scale of each detail. With all of these actions the script slows down significantly if redraw is enabled. I would prefer to disable redraw then preform all of the selecting, hiding and scaling then preform rs.Redraw() once for optimum performance.

It runs normally with redraw enabled it just takes longer than I would like, and I can’t see why disabling redrawing would effect final output of the script.

Thanks