I have been trying to embed a Rhino Viewport into my XAML form. I’m thinking the only way to do this will be to create my form with a blank square and add the ViewportControl in during runtime.
I have had a read through and play with SampleCsEtoViewportCommand which was very helpful and tried to add it to my project, this lead me to Eto and as such I have referenced in Eto.dll from the Rhino 7 WIP Folder because the NuGet package seems to have issues.
// SampleCsEtoViewportCommand
`internal class SampleCsViewportForm : Dialog
{
public SampleCsViewportForm()
{
Title = “Rhino Viewport in an Eto Control”;
Resizable = true;
var viewport_control = new
{
new Rhino.UI.Controls.ViewportControl {Size = new Size(400, 200)},
new Rhino.UI.Controls.ViewportControl {Size = new Size(400, 200)}
I have a read through the Eto Wiki on GitHub and found no help in the XAML section XAML Tips & Tricks but I did find a section for how to embed Eto.Forms into another application Embed Eto Forms
However I got stuck there on trying to find more on the .ToNative() property that seems to convert an Eto Form to a Windows Form.
This is very helpful, thankyou Menno!
Although it doesn’t solve everything as the Eto Control Is not a Windows Control and I need to cast/convert it somehow using the .ToNative(true)
@dale When bringing in RhinoInside nuget package v7.0.0 RhinoWindows.dll does not get copied into the Bin folder. RhinoInside expects the Version=8.0.0.0, Culture=neutral, PublicKeyToken=552281e97c755530. The nuget package RhinoWindows 8.0.21131.12305-wip does not seem to produce the RhinoWindows.dll in the Bin folder either. The version in the Rhino folder is 7.4. What am I doing wrong? Thanks
It sounds like you got nuget packages installed for Rhino 8. I would recommend using the Rhino 7 version.
You don’t want RhinoWindows to be copied to your bin folder. RhinoInside loads Rhino as a library from its installed location and gets other associated DLLs to also be loaded from that location.
Thanks @stevebaer ! That problem occurred even with Rhino 7 versions of Nuget Packages. However you pointed me in the right direction. The issue was that the call RhinoInside.Resolver.Initialize();
needs to be made before WPF control is initialized. When I added this call in the window constructor, Rhino Inside is able to find the right dlls.
Dale,
Thanks for the update. Sorry I wasn’t more precise. Inside a plugin is working, but do you have an example from a WPF App projects?
I got that error: (process 38500) exited with code 3 (0x3).
Thanks,
static void Main()
{
// NOTE: Make sure to adjust your project settings so this is compiled as a 64 bit
// application. Rhino.Inside will only run in 64 bit
// NEW!
RhinoInside.Resolver.UseLatest = true;
// Set up RhinoInside resolver at the very beginning of the application
// This helps find and load Rhino assemblies while the program runs
RhinoInside.Resolver.Initialize();
Yes, we are actively working on a nuget update right now. Rafa has been in contact with us through email as well and we have him set up with a rhino.inside console sample that uses .NET 7.