Save to other Rhino versions?

I have not upgraded my Rhino to V6 yet, but I’ve updated to the latest Rhino3dmIO. Now I can’t read the files I write because they are in V6 format. I thought the File3dmWriteOptions.Version could be it, but it doesn’t seem to change anything. Is there a way I can specify the output rhino version?


Hi @AlexM,

File3dm.Write allows you to specify the 3dm file version.

For example:

var path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var filename = Path.Combine(path, "test-alexm_v5.3dm");

using (var file = new File3dm())
  var layer = new Layer {Name = "Default", Color = Color.Blue};

  var layer_index = file.AllLayers.Count - 1;
  var attributes = new ObjectAttributes {LayerIndex = layer_index};

  for (var x = 0; x < 100; x++)
    var line_curve = new LineCurve(new Point3d(x, 0, 0), new Point3d(x, 1, 0));
    if (line_curve.IsValid)
      file.Objects.AddCurve(line_curve, attributes);

  // Write a version 5 .3dm file
  var rc = file.Write(filename, 5);

Does this help?

– Dale

Thanks Dale it works like a charm! It seems the override with the File3dmWriteOptions also works when putting other integers values other than 0-1. So basically this would work with values 2-6? Otherwise it defaults to latest?

Hi @dale,

Version must be a value that is: 2 <= version <= current_version.

– Dale

Thanks for the information. It makes sense. Using the actual version number was just too obvious for me :wink:

I’m reviving this because this no longer seems to be the case in Rhino 6. At least I can’t get it to work.

The write function seems to have been changed so that 2 is the current version.

Is there no longer an option to write the file to Rhino 5 instead of Rhino 6?


I’ve just tested the example Dale posted with the latest Rhino3dmIO.Desktop (7.0.18273.20055-wip) and it seems to work correctly.

This outputs a V6 file:
file.Write(filename, 0);
file.Write(filename, 1);
file.Write(filename, 6);
file.Write(filename, 7);

This outputs a V5 file:
file.Write(filename, 5);

This outputs a V4 file:
file.Write(filename, 4);

This outputs a V3 file:
file.Write(filename, 3);

This outputs a V2 file:
file.Write(filename, 2);

However if you use the Write(file, options) overload, make sure you assign the File3dmWriteOptions.Version property, because it defaults to 0, which would output a V6 file.