Serializing Rhino geometry outside the context of File read/write calls

Hi all,

Is there any way to create a new instance of a BinaryArchiveWriter (/Reader), outside the context of Rhino file read/write operations? I want to serialize various GeometryBase objects directly to a byte array or memory stream.

Cheers,

Jon

Here’s a sample that uses JSON.NET to serialize / deserialize geometry
https://github.com/mcneel/compute.rhino3d/blob/master/src/compute.geometry/RhinoCompute.cs

Woahh. Thanks Steve.

Just out of curiosity, is there a non-JSON version of this? If I have lots of geometry, I don’t imagine strings are too space-efficient…

The strings are base 64 encoded strings from byte arrays.
I don’t have other samples on hand. All geometry implements ISerializable so you may find general samples online for serializing ISerializable interfaces in .NET

Ah gotcha – this is super helpful. Thanks again Steve.