Unit conversion broke changed? Vb scripts no longer work

Hi,
I have my rhino set to decimal inches and I use vbscripts to quickly measure in other units without having to click in the command line, this way I can stay in decimal inches and check any other unit type quickly, however I find that something has changed and my scripts no longer work properly.

The Vb unit script below was working just fine but after upgrading to Sr 19 no longer works. I get unknown command instead of the units printed on the command line.

-RunScript (
Sub DisplayDistanceIn
Dim setunits,dblDistance
setunits = Rhino.UnitSystem (,false)
Rhino.UnitDistanceDisplayMode 2,true
Rhino.command “_Distance”

Rhino.UnitDistanceDisplayMode setunits,true

End Sub
DisplayDistanceIn
)

RM

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

Hi Roland,
I see this - I tried testing your first example - but I have no idea why…

I also tried to test in Python rhinoscriptsyntax, but unfortunately, there is no method rs.UnitDistanceDisplayMode() in rhinoscriptsyntax. The Help indicates there should be, but this is probably because the rhinoscriptsyntax help has just been pulled for the most part out of the Rhinoscript help. @dale

I don’t see anything in Rhino.RhinoDoc that exposes this setting either, but maybe I missed it.

Hi @3dsynergy,

I’m not fluent enough in RhinoScript to tell you why your script fails, but I found the corresponding Rhinocommon methods and made a quick python script which should do the functionality you are describing:

Give it a try and tell me if it works for your:

distanceDisplayMultipleUnits.py (971 Bytes)

1 Like

Hi Roland, yes, this works fine in SR18 (haven’t upgraded to SR19 yet…)
So something got messed up…

Thanks for the script Lando, I hope McNeel can fix this it’s been working I think since v3.
RM

Hi Mitch, Jarek,
Thanks to both of you for taking look and for confirming it. Hope it’s and easy fix for McNeel I have many more unit scripts that I use especially my custom unit scripts.
RM

Hello - thanks, I see that -

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

-Pascal

RH-55449 is fixed in the latest Service Release Candidate

Thank you for the fast fix I waited for the official release but am glad you serviced this so quickly.
RM