Is there a way to check the Rhino version of a 3dm file using Rhino Common?
Thanks,
Alan
Hi @AlanTai,
Something like this should work.
public bool Rhino3dmFileVersion(string fileName, out int fileVersion)
{
fileVersion = 0;
if (string.IsNullOrEmpty(fileName))
return false;
var extension = System.IO.Path.GetExtension(fileName);
if (!extension.Equals(".3dm") && !extension.Equals(".3dmbak"))
return false;
if (!System.IO.File.Exists(fileName))
return false;
var archive_version = Rhino.FileIO.File3dm.ReadArchiveVersion(fileName);
switch (archive_version)
{
case 1:
case 2:
case 3:
case 4:
fileVersion = archive_version;
break;
case 50:
fileVersion = 5;
break;
case 60:
fileVersion = 6;
break;
default:
return false;
}
return true;
}
– Dale
Dale,
Thanks.
I did not notice that File3dm.ReadArchiveVersion returns the Rhino version 3dm when I browsed through the help file. I thought it returns something else.
Alan