Specify STL model units when importing STL in Rhinoscript


Dear all,

This morning, I wanted to run a script that I ran several times but something unexpected happened.

The script initializes a few settings. Amongst others, it makes sure that the measurement system is in mm

Rhino.UnitSystem 2, False

However, I wanted to import an STL with different STL model Units (cm) and manually imported that STL to compare with the outcome of a shape of our script, which imports its STL shape using

Rhino.Command “-_Import " & CHR(34) & strStlFileName & CHR(34) & " _Enter”

Now the tricky part comes: after I had manually imported an STL in cm units, my script imported the STL also in cm, while the Rhino measurement system was still in mm. Is there a way to make sure that the STL import settings can be set to mm? When manually importing an STL, you get a dialog to set these units, but how to do that in script to make sure measurement units are consistent?

In short: can I specify in the following command or somewhere else in Rhinoscript which STL model units to use:

Rhino.Command “-_Import " & CHR(34) & strStlFileName & CHR(34) & " _Enter”

instead of using the units used during the previous manual STL import?

Many thanks in advance,


(Dale Fugier) #2

Why not do this:

Rhino.Command "_-Import " & Chr(34) & strFile & Chr(34) & " _ModelUnits=_Centimeters _Enter"