Eto support in all Rhinos

The current issue is to get the panel started in Rhino. Please see the attached image. Some help would be great.

Christian

Here is an example that demonstrates how to display an Eto form in a docking panel.

Word of warning: all this will change in Rhino 6, as it includes the Eto binaries and we’ve done some work to make this easier.

4 Likes

Thanks Dale

Wow. Thanks Dale. This is great. Let’s see if we get it to work.

So we got this panel to work. Thanks again. We are wondering how to get the menubar to add to the panel. The example we found:

doesn’t work. Seems like this only works for Modal and Modeless Forms.

Any help would be great.

Thanks in advance
Christian

This might be a silly question but is Eto accessible from python script (can’t find Eto namespace in python editor) or only c#? I’m asking about Windows Serengeti

Yes, it is accessible from python script and we do plan on making this easier in general to work with from python. I believe @curtisw was looking into this last week.

Oh OK I found it…

@stevebaer, is there any news about using python + ETO in V5 ? I can use ETO in V6 but when i try below in V5, it seems to import the whole namespace properly:

import clr, sys

sys.path.append(r"C:\Program Files\Rhino WIP\System")
clr.AddReference("Eto.dll")
from Eto.Forms import *
from Eto.Drawing import *

…but once i try to create a dialog or a form using:

form = Dialog()

I get this error:

Message: Platform instance is null. Have you created your application?

_
c.

I love it; super hacky :slight_smile:

@curtisw is going to have some better techniques than me, but you might want to try adding the following to your script

platform = Eto.Wpf.Platform()
app = Eto.Forms.Application(platform)
app.Attach()

You’ll probably need to do something like use sticky to hold on to the fact that you initialized the app.

1 Like

Hi @stevebaer, thanks for taking a look. If i run below in Rhino5 x64:

import clr, sys

sys.path.append(r"C:\Program Files\Rhino WIP\System")
clr.AddReference("Eto.dll")

import Eto
from Eto import *
from Eto.Forms import *
from Eto.Drawing import *

platform = Eto.Wpf.Platform()
app = Eto.Forms.Application(platform)
app.Attach()

i get this error:

Message: attribute 'Wpf' of 'namespace#' object is read-only

Could you try it from the built in PythonScript editor in Rhino 5 ?

_
c.

I can test this tomorrow, but in the meantime try adding a reference to Eto.Wpf.dll also
clr.AddReference("Eto.Wpf.dll")

Hi @stevebaer, ok. If i add the dll it tells me that an assembly with strong name is required.

_
c.

ok; I’ll have to try this out and get back to you.

1 Like

Update: not having a whole lot of luck hacking in the use of the V6 Eto DLLs. I suspect a separate installation of Eto would be required. I haven’t tried this yet.

Hi Steve, thank you for taking the time to get this working. I’ll stick with WinForms for now which i stil like a lot.

_
c.

I had time today to look at this, and the problem basically is that Rhino 5 comes with a different version of Microsof.WindowsApiCodePack.Shell.dll which is not strongly named (and appears to be a custom build), whereas Eto.Wpf.dll requires the publicly available version from nuget (1.1.0.0) which is strongly named.

I’ve been able to get it to work by renaming Microsof.WindowsApiCodePack.Shell.dll in the Rhino v5 folder to something else to verify this, but I am unaware what consequence that would be to the stability of Rhino in general (e.g. other things might not work).

Basically, because of this conflict, Eto will unfortunately not be able to run in Rhino v5 as is.

I was running into the same problems when trying to put a python sample together.

We use WindowApiCodePack for the file open dialog which is critical to Rhino. Do not modify this file

Here is an example that demonstrates how to display an Eto form in a docking panel.

https://github.com/dalefugier/SampleCsEto60

@dale This has helped me! Thanks and well done!

Here’s a working link:

https://github.com/mcneel/rhino-developer-samples/tree/6/rhinocommon/cs/SampleCsEto

– Dale