Rhino3dm .NET source available

The github rhino3dm repo now has the source code needed to compile a .NET version of Rhino3dm and as an added bonus the code is capable of compiling to .NET standard for use in dotnet core scenarios. This includes (or at least should) support for Windows, Mac, and Linux. We will be working on iOS and Android support soon.

We need to clean things up to improve the compile process, but I wanted to make people aware that this is available now.

The binary produced is different depending on the platform you are compiling on (at least right now).

  • If you are building on Windows, a .NET Framework DLL is produced with native 32 and 64 bit binaries embedded in the .NET assembly
  • If you are building on Mac, a mono based .NET Framework DLL is produced with a native 64 bit binary (.dylib) embedded in the .NET assembly
  • If you are building on Linux, a .NET standard DLL is produced along with an independent native .so library.

I am experimenting with embedding native libraries in the .NET assembly to allow for a single .DLL representing Rhino3dm. The embedded libraries are extracted to a temp folder when loaded by the top level process.

If a native library (named librhino3dmio_native .dll, .dylib, or .so) is placed in the output directory for your project, that library will be used instead of any embedded library.


You will need cmake and dotnet core (for Linux) installed.

  • clone the repo. Remember to git submodule init and git submodule update to get the opennurbs source code
  • go to the ./rhino3dm/src directory
  • python build_dotnet.py
    • running the script will:
    • build and run a tool that we use to parse our source code and generate pinvoke declarations for Rhino3dm
    • compile the opennurbs and C binding source to generate a rhino3dmio_native library
    • compile the Rhino3dm C# source into a .NET library

Let me know if you have any problems or questions (or submit a PR). I literally just got the code to github an hour ago and am expecting to make changes to improve the whole compile process. We will also start investigating CI processes to build, test, and generate nuget packages, but that may take a while to complete. Figured best to let you have access to this now and let you build everything yourself.

Rhino3dm.dll is intended to replace Rhino3dmIO.dll in the future. This is just a name change
to stay consistent with our python and javascript libraries. All of the classes and namespaces will stay the same.

7 Likes

Have been stumbling around in the dark trying to things to work with CI so this is great news. Big thanks!

1 Like

I’ve updated the project’s CI builds to cover .NET (see #91). Just a compile test for now; NuGet will come later.

P.S. To speed things up (to make up for the extra builds) I’ve built a couple of pre-bootstrapped docker images that are ready to rock for rhino3dm development. Might come in handy if anyone wants to build, tweak and submit a pull request!

1 Like