Change units in file3dm before write

Hi,

I am saving out a bunch of milling files using fileIO.file3dm.write, and it keeps converting mm in the original file to cm in the saved version. I see in RhinoCommon how to get units from file3dm.settings, but not how to change them. Is there a way to set the units on the file3dm before writing? I’m using C# in a grasshopper component.

Thanks!!
Oliver

The units can also be set:

File3dm f = new File3dm();
f.Settings.ModelUnitSystem = UnitSystem.Millimeters;

Does that not work? Also, have you called f.Polish() before writing the file? It “quickly fills in little details” according to the documentation…

Great, thank you so much!