How to export the model in meters?

I am exporting the model in obj format using the following hash.
options_hash = {:model_units => Length::Meter, :doublesided_faces => true, :triangulated_faces => false, :swap_yz => true}

Exported obj file contents.
# Alias OBJ Model File
# Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited
# File units = inches

I don’t think you are setting the options hash correctly. From the Ruby API documentation on the Model#export method:

OBJ

  • :units - Specifies the export units.
    • values: "model" , "inch" , "foot" , "yard" , "mile" , "mm" , "cm" , "m" , or "km"
  • :triangulated_faces - Boolean to indicate whether to export triangulated faces.
  • :doublesided_faces - Boolean to indicate whether to export 2-sided faces.
  • :edges - Boolean to indicate whether to export edges.
  • :texture_maps - Boolean to indicate whether to export texture maps.
  • :swap_yz - Boolean to indicate whether to swap Y and Z coordinates (Y is up).
  • :selectionset_only - Boolean to indicate whether to export the selected entities.
3 Likes

I have tried
:units => "m"
But still export is in inches

What is the model’s internal units set to ?


As Steve said above, refer to the documentation for export options hash …

This extra file has a link to it in the Sketchup::Model#export method documentation, viz:

See the Exporter Options file for information on creating a valid hash for the various exporters.

It is set to Architecture.
Do I have to change it through option manager?

I tested from SU2018, with a file units set to Architectural (Fractional Inches), using
the export option :units => "m". All looks good The exported OBJ file is in meters

At the top of the OBJ file it says …

# Alias OBJ Model File
# Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited
# File units = meters

So make sure you have spelled the export option key ":units" correctly.

NO. The ":units" export option key works correctly (as designed.)

1 Like