Rhino.UI.Dialogs.PushPickButton missing in WIP




i have a script which calls above method from a button in a Windows Form. The method works fine in Rhino 5 but does nothing in the WIP. It does not generate any error unless i add my own error handling for the delegate. The button event calls this:

Rhino.UI.Dialogs.PushPickButton(self, self.CustomPickerFunction)

In the WIP, it generates this error:

An exception of type AttributeError occured. Arguments:
("'type' object has no attribute 'PushPickButton'",)

Can this be added to Rhino 6 so it runs like Rhino 5 ?

Will there be an equivalent for an ETO form ?


(Dale Fugier) #2

Hi @clement,

In your plug-in project, added a reference to RhinoWindows.dll. Then use RhinoWindows.Extensions.PushPickButton.

For Eto, use Rhino.UI.EtoExtensions.PushPickButton.

– Dale


Hi @dale,

i am not sure i can do this. It is a python script which runs in V5 but not in V6.


(Dale Fugier) #4


For now, you can do something like this:

import clr    
clr.AddReferenceToFileAndPath(r"C:\Program Files\Rhino WIP\System\RhinoWindows.dll")
import RhinoWindows
print RhinoWindows.Forms.Dpi.DpiScale()

– Dale


Hi @Dale,

thanks for adding it as a bug. It seems i can find it here when using V6:


but here in V5:


but it is kinda hacky:

import clr
import rhinoscriptsyntax as rs

rh_win_dll = rs.FindFile("RhinoWindows.dll")
if not rh_win_dll: 
    assert False, "Error importing RhinoWindows.dll"


import RhinoWindows



@dale, while searching for a way to use the same code in V5 and V6 (Win) i’ve found that:


is also missing in the WIP.


(Dale Fugier) #7


The stuff in RhinoCommon that was Winforms-specific was moved to RhinoWindows, as RhinoCommon should work cross platform.

– D


Hi @Dale,

i have created conditional imports now for Rhino 5 (Win) nothing is required and this works when called from a button event handler in my form:

Rhino.UI.Dialogs.PushPickButton(self, self.CustomPickerFunction)

For Rhino 6 (Win) i imported RhinoWindows, then check the exe version in my form and try to run:

RhinoWindows.Extensions.PushPickButton(self, self.CustomPickerFunction)

This gives me below error:

An exception of type TypeError occured. Arguments: (‘expected Window, got Form_5$5’,)

It looks like in Rhino 5 it accepts a Form but in Rhino 6 it requires a window ?!

Edit: it seems to be this one which works with a form in V6:

RhinoWindows.Forms.FormUtilities.PushPickButton(self, self.CustomPickerFunction)


(Dale Fugier) #9

Hi @clement,

RhinoWindows.Extensions.PushPickButton is an extension method.

@stevebaer and I are chatting about this. Perhaps it was a mistake moving this stuff around. Can you hang tight until we have a chance to discuss?

– Dale

(Dale Fugier) #10

This is in the Rhino.UI assemby, not the Rhino.UI namespace. Thus, you can do this:

import Rhino
import Rhino.UI # bingo...
import clr

import System.Windows.Forms

class TestForm( System.Windows.Forms.Form):

    def __init__(self):
        self.Text = 'Simple'
        self.Width = 250
        self.Height = 200

if __name__ == "__main__":
    form = TestForm()

– Dale


Yes, no problem. I just would like to point out that it would be the easiest for the user if the code which works in V5 (Win) works the same in V6 (Win). For people trying to make cross compatible forms then with Win using WinForms and ETO on Mac, it would require only two different kind of forms. Currently it seems it requires special handling just between V5 and V6 (Win).

Thank you for this example. It works the same in 5 and 6. In the current WIP it prints:

string>:1: DeprecationWarning: Dialogs.ShowSemiModal has been obsoleted.