Is there a way to read .3dm file embedded preview image with Rhino3dmIO

Hello,

I’m writing a simple .NET file browser application and I want to display the embedded preview in .3dm files. Is this possible with Rhino3dmIO?

Hi Expandable,

I found this:

http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_FileIO_File3dm_GetPreviewImage.htm

Does that help

-Willem

Hi Willem,

Thanks for the reply!

Unfortunately this is only available in RhinoCommon.dll

The standalone .NET assembly Rhino3dmIO.dll that allows you to read .3dm files without having Rhino installed does’t have this method.

Most of the classes and methods that are available in RhinoCommon are also available in Rhino3dmIO but not all of them. I searched, but I couldn’t find anything that reads the preview.

Expandable

Hi @expandable, @Willem,

I’ve created an issue for this.

https://mcneel.myjetbrains.com/youtrack/issue/RH-45096

– Dale

2 Likes

Hi Dale,

Thanks a lot!

– Expandable

Hi,

I was tracking this issue https://mcneel.myjetbrains.com/youtrack/issue/RH-45096 and for as far as I can tell this functionality for reading a preview from .3dm file should be already added to Rhino3dmIO, but I tried the latest .NET Nuget package v 7.0.1 and I still can find how to read the preview.

Thanks!

Does this help?

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_FileIO_File3dm_GetPreviewImage.htm

Sorry… this function is only available in RhinoCommon.dll. I need it available in the standalone Rhino3dmIO.dll https://github.com/mcneel/rhinocommon/wiki/Rhino3dmIO-Toolkit-(OpenNURBS-build) so I can use it from another application.

Thanks!

@dale, can you help with this?

Hi @expandable,

Use File3dm.GetPreviewImage.

– Dale

Hi @dale,

Maybe I’m mistaking something…

I’m building a standalone WPF C# application, not a plugin for Rhino. As far as I understand, I should link to File3DmIO.dll from here https://www.nuget.org/packages/Rhino3dmIO.Desktop/7.0.19092.12305-wip instead of RhinoCommon.dll as it is only used by Rhino and I cannot use it from a standalone application.

I linked to the Rhino3dmIO.dll assembly from Nuget but there is no method File3dm.GetPreviewImage that I can use. I just double checked to make sure that I’m not making a mistake.

Can I link from a standalone WPF app to RhinoCommon.dll and use it without Rhino installed so I can use File3dm.GetPreviewImage method from RhinoCommon.dll?

Thanks!

I don’t think you are missing anything. I just looked at the source code and it looks like the preview image functions are currently only available in RhinoCommon (not Rhino3dmIO). We still need to figure out how to properly support this for all of the different versions of Rhino3dmIO that we compile. You can not use RhinoCommon from a stand alone application.

Thanks @stevebaer

I was keeping track of this issue https://mcneel.myjetbrains.com/youtrack/issue/RH-45096. The last comment said that it was tested with the public NuGet package, so I thought that it was implemented already but for some reason I couldn’t find the method.

If I remember correctly, this was a very special case. The function was written and tested on Windows, but I had to pull it out because it would not work on any of the other platforms that we compile the toolkit to. The idea is to rethink how we could expose this functionality in a more platform neutral way.

Thanks

I’ll keep track of future version for this functionality.