I’m trying to figure out why turning off grid and axes of a new viewport doesn’t work in the python code below. It’s following up to this discussion, Create a new floating viewport and change its display mode
Can someone help me out? Thank you.
import Rhino
import System
import rhinoscriptsyntax as rs
if r:
#Create a new floating view
newView = Rhino.RhinoDoc.ActiveDoc.Views.Add("TEST", Rhino.Display.DefinedViewportProjection.Perspective, System.Drawing.Rectangle(0, 0, 600, 600), True)
#Change display mode to "Shaded"
shaded_id = Rhino.Display.DisplayModeDescription.ShadedId
display_mode = Rhino.Display.DisplayModeDescription.GetDisplayMode(shaded_id)
newView.ActiveViewport.DisplayMode = display_mode
#Maximize viewport
newView.Maximized = True
#Zoom extents
newView.ActiveViewport.ZoomExtents()
#Turn off grid
if rs.ShowGrid(newView) == True:
rs.ShowGrid(newView, False)
#Turn off axes
if rs.ShowGridAxes(newView) == True:
rs.ShowGridAxes(newView, False)
newView.Redraw()