Here’s another example. I’m in decimal and choose fractional in the dialog box the fractional unit doesn’t print to the command line. Seems the distance command is acting differently. Beneath the script is the command history, seems like the distance command gets parsed differently in this vbscript syntax.
-RunScript (
Sub DisplayDistanceDecFracFtIn
Dim arrunits(2), strResult,intUnitSystem,setunits
setunits = Rhino.UnitSystem (,false)
arrunits(0) = "Decimal"
arrunits(1) = "Fractional"
arrunits(2) = "Feet and Inches"
strResult = Rhino.ListBox(arrunits, "Show distance in?","Display Unit Options")
If strResult = "Decimal" Then
Rhino.UnitDistanceDisplayMode 0,true
Rhino.command "_Distance"
Rhino.UnitDistanceDisplayMode setunits,true
Else
If strResult = "Fractional" Then
Rhino.UnitDistanceDisplayMode 1,true
Rhino.command "_Distance"
Rhino.UnitDistanceDisplayMode setunits,true
Else
If strResult = "Feet and Inches" Then
Rhino.UnitDistanceDisplayMode 2,true
Rhino.command "_Distance"
Rhino.UnitDistanceDisplayMode setunits,true
End If
End If
End If
End Sub
DisplayDistanceDecFracFtIn
)
DisplayDistanceDecFracFtIn
)
From the command history after command is run:
Subroutine to run ( List ): _Distance
First point for distance ( Units=Model_Units )
Second point for distance ( Units=Model_Units Undo )
CPlane angles and deltas: xy = -54.36845 elevation = 0.00000 dx = 3 11/32 dy = -4 11/16 dz = 0
World angles and deltas: xy = -54.36845 elevation = 0.00000 dx = 3 11/32 dy = -4 11/16 dz = 0
Distance = 5 3/4
Second point for distance ( Units=Model_Units Undo ): 5
Unknown command: 5
Command: _CommandHistory