[Solved] Reading UnitSystem with Rhino.FileIO

Hi guys,

I’m writing a small component that will read files using the Rhino.FileIO package and I need to find a way to read the UnitSystem used in that specific file. I know it’s possible reading the UnitSystem in the active Rhino file by using the rhinoscriptsyntax. But is is possible to do the same in a file opened with the FileIO?

Best regards
Daniel

Sorry, pressed the send button a bit too early:

Hi Nathan,

I checked out the documentation prior to posting this, but couldn’t quite figure it out.

If you could post some kind of sample code to show how to get the UnitSystem, that would be very appeciated.

// assume 'using Rhino.FileIO;'

using(File3dm f = File3dm.Read(pathtofile)) {
  if(f!=null) {
    File3dmSettings s = f.Settings;
    // now can access 's.ModelUnitSystem'
  }
}

Works. Thanks :slight_smile: