Display Properties Within Python

Hi everyone,
part of a custom script that I am writing in Python I was wondering if there is a way to control the display properties within Python itself. What I mean is switching on some of the categories, in particular the Text one.
What I was trying to do is through the rhinoscriptcontext:
rs.Command("_DisplayProperties" … but then not sure how to thick the boxes within the script.
Thank you in advance for the help.


some of this categories

import Rhino
import rhinoscriptsyntax as rs

def HideText():
    shaded = Rhino.Display.DisplayModeDescription.FindByName('Shaded')
    if not shaded: return Rhino.Commands.Result.Failure

    shaded.DisplayAttributes.ShowText = False
    Rhino.Display.DisplayModeDescription.UpdateDisplayMode(shaded)
    rs.Redraw()
    return Rhino.Commands.Result.Success

if __name__=="__main__":
    HideText()

HideText.py (412 Bytes)

1 Like

Thank you @Mahdiyar !

I have modified a little bit your code to adapt to the active display mode so that it isn’t linked only to the Shaded one. Thanks again!

import Rhino
import rhinoscriptsyntax as rs

def ShowText():
activemode=rs.ViewDisplayMode()
displaymode=Rhino.Display.DisplayModeDescription.FindByName(activemode)
displaymode.DisplayAttributes.ShowText=True
Rhino.Display.DisplayModeDescription.UpdateDisplayMode(displaymode)
rs.Redraw()

if name==β€œmain”:
ShowText()