Eto Function Call Error.....Rhino Crash

This project attempts to make a user interface using Eto in Rhino 6 WIP. The UI collects geometrical data from Rhino , calculate some lengths parameters / Distances and then is supposed to display information regarding the surface. The problem is that every time the UI tries to run a external function using a button, rhino crashes.


The UI Checks if all the data is selected. when the recompute button is pressed the script is supposed to calculate.

The above image shows the function call that is to be called either from within the script or by importing an external script.

the entire script can be reviewed at:-

I would be Glad if someone could figure out what I am doing wrong…


Hi Arjun,

if i comment out the fixed values and run the function in a try/except block, like so:

        Logic = logic(surf,windowSill,windowLeft,groundLine,length,height,thick)
        total = Logic[0]
        straigh = Logic[1]
        angle = Logic[2]

    except Exception as ex:
        template = "An exception of type {0} occured. Arguments:\n{1!r}"
        message = template.format(type(ex).__name__, ex.args)
        print message
        return False

I get this error:

An exception of type NameError occured. Arguments:
("global name 'surf' is not defined",)

I guess it cannot access these variables globally:

surf, windowSill, windowLeft, groundLine

For more in depth testing it might help if you provide an example geometry together with a short description what has to be picked for the …Line buttons. I’ve just used surface edges :wink:


Oh and btw. if i set the missing variables global at the top of all functions like so:

global surf, windowSill, windowLeft, groundLine

and add the same line as above right to the runscript_Validate() function, your logic function will produce an error because you are trying to add together NumericUpDown fields.

You might change that to use the Value property of the NumericUpDown fields and recomputation works, at least over here:

   A = length.Value + height.Value
   B = height.Value + thick.Value
   C = thick.Value + length.Value
   return (A,B,C)


Dear Clement

Thanks for your response

The below image shows which parts of the surface are to be selected with the button.

Here is a test Rhino File:-Insulation.3dm (65.0 KB)

I hope this is useful…

I would like to try out what you have commented…if there is a height.Value to get the value of the NumericUpDown fields, shouldnt there be something like surf.<something> to get the data from the surface.

the program crashes even if i write Print surf at def recompute_Click(sender, e):

#Recompute Button Definition
def recompute_Click(sender, e):
    #print "Hello World"
    print surf


Hi Arjun,

if you put your print statement in a try/except block you can test out why it crashes. The variable surf is not a global variable. I’ve described above how to make it global.

@stevebaer, ETO seems to behave similar as WinForms, a single error in the form code or function which runs in the scope of the form, it crashes Rhino. Is there anything which could be done to prevent this ?


The dialog is being shown non-modal which makes it very difficult to trap exceptions outside of the dialog’s code. If the dialog were shown modal, then Rhino should be able to trap the exception.

The variable is not accessable unless it is declared globally (after your imports) and in the function from which you want to assign and change it. If you put the print statement in a try/except block it will not crash but print the error. This works with a modal or non-modal dialog.

@stevebaer, no luck to show it modal using dlg.ShowModal(RhinoEtoApp.MainWindow), but i have another script where this same statement works. Btw. i guess the user wants at least a semi modal form so the buttons can be used to pick the objects. In case of a fully modal form, i wonder if there is something ETO equivalent to PushPickButton ?


Ecerything is working perfecty!!!

Thankyou @clement for your help.

I am uploading a video of the final interface in action!!
@curtisw @stevebaer @brian @mathieu_huard

Best Regards
Arjun Sharma

1 Like