How this error is corrected, "Display Mode

python

#1

good day

It was working well but I stop working.
I thank any help
ERROR
I downloaded it from this link ; but on my pc it does not work


(Dale Fugier) #2

Hi @vikthor,

There is a lot going on in the thread you’ve referenced. Can you just upload the source code that is not working for you?

– Dale


#4

is this

SetObjDisplayModeAllViewports.py (1.2 KB)

Message: El valor no puede ser nulo.
Nombre del parámetro: item

Traceback:
line 629, in ListBox, “C:\Users\Administrador.DESKTOP-4J5EPO7\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\userinterface.py”
line 19, in SetObjDisplayModeAllViewports, “C:\Users\Administrador.DESKTOP-4J5EPO7\Downloads\SetObjDisplayModeAllViewports.py”
line 35, in , “C:\Users\Administrador.DESKTOP-4J5EPO7\Downloads\SetObjDisplayModeAllViewports.py”


#5

It would be good to know what version of Rhino you are running and on which platform. Looks like you are running in Spanish.

The line where it is erroring out is where it wants to create a list box with the names of all the display modes found to put on-screen and let you choose. The list box method needs a valid list supplied in order to work and in your case looks like that list - called modeNames - is None, i.e. trying to get the list of display modes has failed a couple of lines earlier.

The two lines trying to collect the display modes currently on your system are these:

    dModes = Rhino.Display.DisplayModeDescription.GetDisplayModes()
    modeNames=[dMode.LocalName for dMode in dModes if not dMode.PipelineLocked]

So, I don’t know why it is failing, I suspect some localization error… The “standard” display mode names are localized, but any custom ones are not…

You say it worked previously. When did it stop? What changed? --Mitch


#6

Rhino 5 (SR14)
thanks for the reply

I used to work on another user of the same PC but the user stopped working and now I use the PC administrator.
that change caused havoc only in this script

how can I create the location to work correctly


#7

Can you just run the following code and post what it prints out?

import Rhino

dModes = Rhino.Display.DisplayModeDescription.GetDisplayModes()
if dModes:
    EmodeNames=[dMode.EnglishName for dMode in dModes if not dMode.PipelineLocked]
    LmodeNames=[dMode.LocalName for dMode in dModes if not dMode.PipelineLocked]
    print "English: {}".format(EmodeNames)
    print "Local: {}".format(LmodeNames)
else:
    print "GetDisplayModes() Failed!"

#8

this is

English: [‘Wireframe’, ‘Shaded’, ‘Rendered’, ‘Ghosted’, ‘X-Ray’, None, None,‘AuxpeckerRendered’, ‘blanco’, ‘azul’, ‘Blueprint’, ‘Mio’, ‘green’, ‘White’,‘Thea Render’]
Local: [u’Estructura al\xe1mbrica’, ‘Sombreado’, ‘Renderizado’, ‘Semitransparente’, ‘Rayos X’, None, None, ‘AuxpeckerRendered’,‘blanco’, ‘azul’, ‘Blueprint’, ‘Mio’, ‘green’, ‘White’,‘Thea Render’]

I’ve also tested it in safe mode, and it gives the same 2Traceback message "from the previous post


#9

I do not know if this is helpful, but whenever the rhinoceron speaks, that message appears on the lower right side.

auxpecker


#10

OK, that’s pretty informative. There appear to be two display modes that are causing problems - the display mode description returns “None” which means that the function failed to get a name for those two modes. I don’t know what they are, but they are in your list between “X-Ray” and “Auxpecker rendered”.

I will add some error checking to this and see if I can make it work better and ignore the bad entries - but I am having trouble with the non-standard display modes now, so I don’t really know how reliable I can make it…

Edit @vikthor : OK, here is a re-write of the script with an attempt to eliminate the above-mentioned errors - give it a shot and let me know if it works any better.

SetObjDisplayModeAllViewports.py (1.8 KB)

As far as the Auxpecker nag screen goes, I know nothing about that…

–Mitch


Rhino Common Issue with Rhinoview.CaptureToBitmap