IGES exporter doesn't follow unit settings from headless doc

It seems the exporter doesn’t follow unit system settings from headless document. Unit of the exported IGES file is inch instead of millimeter with the following code.

  private void RunScript(string file, Surface srf, bool export, ref object result)
  {
    if(!export) return;
    var doc = RhinoDoc.CreateHeadless(null);

    doc.ModelUnitSystem = UnitSystem.Millimeters;
    doc.Objects.Add(srf);

    result = doc.Export(file);

    doc.Dispose();
  }

test_iges_export.gh (2.3 KB)

(pay attention to unit system indicator in the bottom-left corner)

@pascal I think Rhino Developer is probably better because it’s an issue in RhinoCommon. I just use Grasshopper as a tool to call SDK functions. It’s not necessarily related to GH.

Yep, I see that.

https://mcneel.myjetbrains.com/youtrack/issue/RH-66189

– Dale