Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

view.ActiveViewport.PopViewProjection() no effect

$
0
0

@dale I am trying to store and restore the current view. I based my attempt on Select object by WindowBox - #14 by dale but do not get it to work. Any hints would be greatly appreciated. Thank you - Silvan

import Rhino.Geometry as rhg
import scriptcontext as sc


def main():
    # Store view
    view = sc.doc.Views.ActiveView
    if not view:
        print("Could not store current view to restore")
    view.ActiveViewport.PushViewProjection()
    
    # Modify viewport
    viewport = view.ActiveViewport
    viewport.SetToPlanView(rhg.Plane.WorldXY.Origin, 
                           rhg.Plane.WorldXY.XAxis, 
                           rhg.Plane.WorldXY.YAxis * -1., False)
    viewport.ZoomExtents()
    
    # Restore view and redraw the document
    view.ActiveViewport.PopViewProjection()
    view.Redraw()


main()

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles