Hi,
does anyone know how I cen get the current state of printdisplay state using rhinoscriptsyntax or rhinocommon?
Thanks!
Tim
Hi,
does anyone know how I cen get the current state of printdisplay state using rhinoscriptsyntax or rhinocommon?
Thanks!
Tim
Hi @timcastelijn, there is nothing in the SDK to query this, i’ve requested it 5 years ago:
https://mcneel.myjetbrains.com/youtrack/issue/RH-42637
@stevebaer will there be some improvements during the V7 lifecycle ? …also regarding other issues:
https://mcneel.myjetbrains.com/youtrack/issue/RH-35496
https://mcneel.myjetbrains.com/youtrack/issue/RH-48102
https://mcneel.myjetbrains.com/youtrack/issue/RH-48110
???
_
c.
Hi Clement -
Just to manage expectations, this is what’s currently on the Rhino 7 list - i.e., at this point, 25 items.
-wim
As a workaround you could read the command state from the command line after running and canceling the command. This is how I’d do it in RhinoScript, should be easy to translate to Python:
Call Rhino.ClearCommandHistory()
Call Rhino.Command("PrintDisplay EnterEnd")
Dim h : h = Rhino.CommandHistory()
h = Rhino.Strtok(h, "= ")
Dim blnState
If h(7) = "Off" Then blnState = False Else blnState = True
Hi @Jarek,
thanks, your approach works for me. See my python version below
Cheers,
Tim
import rhinoscriptsyntax as rs
import Rhino
import re
def is_printdisplay_enabled():
"""
gets current state of PrintDisplay
Returns:
bool: True or False, or None when "State=(On|Off)" is not found
"""
Rhino.RhinoApp.ClearCommandHistoryWindow()
rs.Command('-PrintDisplay EnterEnd', False)
cli_text = Rhino.RhinoApp.CommandHistoryWindowText
match = re.search('State=(On|Off)', cli_text)
if match:
return match.group(1) == 'On' and True or False
# toggle Printdisplay
rs.Command('-PrintDisplay State Toggle EnterEnd', False)
# print current state
print is_printdisplay_enabled()