Write a 3dm file with c# in Grasshopper

Thanks again @Darryl_Menezes, that was the problem.
Here the code, if someone needs it in future (without any exception handling):

private void RunScript(bool write, string path, string newPath, ref object A)
  {

    string[] files = Directory.GetFiles(path);//Get all files

    for (int i = 0; i < files.Length; i++)
    {
      Rhino.FileIO.File3dm file = Rhino.FileIO.File3dm.Read(files[i]);

      string[] chunks = files[i].Split('\\');
      string name = chunks[chunks.Length - 1];

      string fileName = string.Format("{0}\\{1}." + "3dm", newPath, name + "_R6");
      if(write)
        file.Write(fileName, new  Rhino.FileIO.File3dmWriteOptions() {Version = 6});
    }

  }
1 Like