Rhino.FileIO.File3dm: Looking for a possibility to read/write to/from a stream

I was looking for a possibility to use Rhino.FileIO.File3dm for reading from (and writing to) a stream, which would be very useful for using Rhino3dmIO in the context of a cloud application (e.g. reading a 3dm fetched from S3). It seems this possibility doesn’t exist. Am I missing sth?

1 Like

Not currently. I did create static FromByteArray functions for the python and javascript versions of the library. Looks like I need to add this functionality to the .NET version of the library.

That would be fantastic, many thanks for your feedback!

@stevebaer one more question about this: would this also become part of Rhino.FileIO.File3dm in RhinoCommon?

This sounds like something that would be a useful addition to openNURBS too. Or is it already there?

Yes, Rhino3dm for .NET is a subset of RhinoCommon and almost everything added to Rhino3dm will be available in RhinoCommon. I should be able to get this added soon as it is really just more testing than typing.

The functionality already exists in OpenNURBS as this is what rhino3dm.py and rhino3dm.js use

RH-60014 is fixed in the latest WIP

Found the new FromByteArray(byte[]) in the latest WIP, many thanks. Would it be possible to also support this the other way around, ie a byte[] ToByteArray() or similar?

Sure

1 Like

Many thanks!

I just added File3dm.ToByteArray() to V7. This will be available in the next public release of Rhino/RhinoCommon.

Thanks,
Steve

Hi Steve,

Just found this thread while looking into using rhino3dm (.net) for a cloud based project that needs to convert Rhino 6 files to Rhino 5 files, for use with a 3rd party API that doesn’t support Rhino 6.

FromByteArray works perfectly for reading in Rhino 6 files, thanks for adding it!
Is there a targeted release date for the next public release of Rhino/RhinoCommon, just trying to get an idea of when ToByteArray will be available?

Many thanks,
Mark

Check out the latest pre-release version of the RhinoCommon package on NuGet - the File3dm.ToByteArray() method is available there already!

1 Like

@stevebaer I was just about to write a long message formulating a request to add an optional Rhino version argument to the new ToByteArray method before I realized it’s already there :sweat_smile: Thanks again!

1 Like

@emilpoulsen Didn’t think of that, thank you!

1 Like