What is the reason for this limitation ?
I am talking about the GetString method. This is basically script specific stuff and nothing to do with Rhino commands. I think the Command(commandString, echo=True) is the one that interacts with Rhino and should to be kosher.
Yes, I understand, but this is the “How” it happens.
What I don’t understand is the “why”; the design decision for the limitation. Why am I not allowed to ask the user to choose discreet numbers for my own script commands ?
I should be able to ask this on my own script
strPrompt = "Choose one of the three incline level angles"
strOptions = ["15 degree","30 degree","45 degree"]
PressAngle = rs.GetString(strPrompt,strOptions[1],strOptions)
import rhinoscriptsyntax as rs
strPrompt = "Choose one of the three incline level angles"
strOptions = ["Angle15","Angle30","Angle45"]
PressAngle = rs.GetString(strPrompt,strOptions[1],strOptions)
The reason I brought it up is not my lack of imagination in workarounds, but because I have OCD on proper UI and usability. We could install doors in your house that only open 10 degrees, which should be enough for a person most of the time. if you ever need more room you could simply workaround by unscrewing the hinges for one rare occasion.
In my book it is a mini instance of poor API (an arbitrary limitation that doesn’t serve a valid purpose to the client). I brought it up, you don’t mind it. Case closed.
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
strPrompt = "Choose one of the three incline level angles"
strOptions = ["15°","30°","45°"]
PressAngle = rs.GetString(strPrompt,strOptions[1],strOptions)
I’ve added a wish to the pile (I’m pretty sure this has already been logged):
Being able to use more types of characters as command options in Rhino.GetString would be - well… revolutionary. It would allow much more elegant command line UI for small and bigger scripts. It’s been one of the biggest limitations in my 10+ years of RhinoScripting, and I never understood why this limitation is there, while regular Rhino commands handle more characters. Please consider allowing this also for Rhino.GetString method
Keeping mind that Rhino.GetString just add strings options using the equivalent of RhinoCommon’s GetBaseClass.AddOption method, can you provide an example of what you’ve stated?
So here regular Rhino command (Offset) allows for “=”, and “.” characters.
This is already great, if could be replicated via Rhino.GetString method.
Currently apart from numbers and characters, only “_” (underscore) is allowed. One of many limitations of this, apart from lack of elegance, is inability to display decimal values this way.
Thanks Dale, it was a nice addition to RS, a bit more complicated to use than GetString, especially for nested mixed options, but yes, it does allow for all that is needed.
Allowing special characters in GetString would allow to make things simpler to code sometimes, but if not achievable we can switch to GetOption for fancier command-line menus.
@ThomasAn - this was a recent addition to V6 RhinoScript; many of these did not make it to RhinoScriptSyntax so this one also may be not implemented, unfortunately. It would be great if the two tracks were more in-synch. While Python allows to do much more sophisticated stuff if you dive into RhinoCommon, on a pure simple scripting level RhinoScript has more methods implemented (thanks @Dale)