Show/hide all 3 axes with/without grid?

Hello.
The z-axes seems to be controlled per viewport (wireframe, shaded, etc) (…why?..) and it stays visible even when ShowGridAxes is off, unless grid is hidden, then it also hides z-axes. The command line grid command doesn’t expose the x-axes toggle.

So, we can have a toggle hotkey -_Grid _ShowGridAxes _Enter (or Gridaxes) to show/hide all 3 axes while grid is hidden and only x/y-axes when grid is shown.

How do we show and hide all 3 axes lines with a hotkey, regardless if grid is on or off?

Thank you

Hi Vano,

I recently added a feature request for more control.

This python script toggles the XY axes and also modifies the active view’s display mode to show/hide the Z axis as well.

#! python 3
import Rhino
import rhinoscriptsyntax as rs

def toggle_three_axes():
	grid_axes_state = rs.ShowGridAxes()
	new_state = not grid_axes_state
	rs.ShowGridAxes(show = new_state)
	display_mode_id = rs.ViewDisplayMode(return_name = False)
	display_mode = Rhino.Display.DisplayModeDescription.GetDisplayMode(display_mode_id)
	display_mode.DisplayAttributes.ViewSpecificAttributes.DrawZAxis = new_state
	Rhino.Display.DisplayModeDescription.UpdateDisplayMode(display_mode)

toggle_three_axes()

@Measure thank you for the script. It works, but it doesn’t update other viewports, so hidden axes in one viewport might show z-axes in another.

This version updates all viewports (it does current viewport first and updates others in separate thread for speed)

import Rhino
import rhinoscriptsyntax as rs
import threading

def toggle_three_axes():
	grid_axes_state = rs.ShowGridAxes()
	new_state = not grid_axes_state
	rs.ShowGridAxes(show = new_state)

	current_mode_id = rs.ViewDisplayMode(return_name = False)

	# Update current viewport's display mode immediately
	current_mode = Rhino.Display.DisplayModeDescription.GetDisplayMode(current_mode_id)
	current_mode.DisplayAttributes.ViewSpecificAttributes.DrawZAxis = new_state
	Rhino.Display.DisplayModeDescription.UpdateDisplayMode(current_mode)

	# Update all other display modes in the background
	def update_others():
		for display_mode in Rhino.Display.DisplayModeDescription.GetDisplayModes():
			if display_mode.Id != current_mode_id:
				display_mode.DisplayAttributes.ViewSpecificAttributes.DrawZAxis = new_state
				Rhino.Display.DisplayModeDescription.UpdateDisplayMode(display_mode)

	t = threading.Thread(target=update_others)
	t.daemon = True
	t.start()

toggle_three_axes()