Merging and Image Processing C# Program into Rhino Plugin Ecosystem

Hello Everyone,

Im currently working on a Plugin for Rhino it has multiple commands and a lot of other utils. We are using C# and Rhinocommon to develop for Windows and Mac. The following problems only appears on my mac at the moment, but i haven’t tested it on windows yet. (Using Visual Studio for Mac currently)

So we created a tiny C# project that is searching for paths in a rendering of a model. It is using some Libs for example ImageProcessor and one for path finding. Running it standalone works without any issues at all. Integrating this project into our Rhino Plugin seemed very straight forward, just adding the needed references and Libs worked fine. But unfortunately the command is not doing anything at all and seems to be crashing because of an assembly reference issue. The error log shows missing reference “MonoMac” Version x.y.z. but adding this reference in Visual Studio(It also says “provided by visual studio” in the Edit References Menu) is not resolving the issue.
Anybody out there who has experience with this error or adding C# projects (little Utils) into a Rhino Common Plugin?

Currently i am trying a very dirty workaround running the C# executable of the tiny project with the mono command within a shell script thats called in the Rhino Plugin. The crazy thing is with other C# projects this works just fine. But my little Image Processing project is not executed when called within a command. Also there are no error shown.

I know its not very specific, i can provide more detailed information if needed.

Thank you in advance.

Best Regards,
Philipp

Hi @phoberg97,

This isn’t much to go on. When you say it works running standalone, I assume this is some sort of .NET console applciation that you’ve written? Can you provide a link to the library you are trying to use?

– Dale

i took a quick poke at ImageProcesser in windows rhino, works fine. my code as follows, just flips an image upside down.

add a reference to ImageProcessor.dll to your project (and be sure to set [Copy Local] to true)

using System;
using Rhino;
using Rhino.Commands;
using ImageProcessor;
using Rhino.UI;

namespace RH_ImageProcessor
{
[System.Runtime.InteropServices.Guid(“e20aea0a-2b8b-4489-b193-76d3fd479257”)]
public class RHImageProcessorCommand : Command
{
public RHImageProcessorCommand(){Instance = this;}
public static RHImageProcessorCommand Instance{get; private set;}
public override string EnglishName{get { return “RHImageProcessorCommand”; }}
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
string FileName = “”;
OpenFileDialog GrabImage = new OpenFileDialog();
GrabImage.InitialDirectory = Environment.SpecialFolder.Desktop.ToString();
GrabImage.Filter = “Image files (.)|.”;
if (GrabImage.ShowOpenDialog())FileName = GrabImage.FileName;
else { return Result.Cancel; }

        ImageFactory ImageFile = new ImageFactory();
        ImageFile.Load(FileName);
        ImageFile.Flip(true, true);
        ImageFile.Save(FileName);
        return Result.Success;
    }
}

}

Thank you for responding!

It is a .NET console Application including ImageProcessor, EpPathFining.cs and C5.
ImageProcessor
EpPathFinding.cs
C5

  • Philipp

Thank you very much for testing ImageProcessor in RhinoCommon using the windows version.

It works just fine, i will try my code on a Windows Machine as well. Maybe it is a Mac specific issue…

  • Philipp