GetString INCLUDING spaces (instead of the space bar ending the command)

Hello everyone,

I have a task where I want to ask the user to input an entire sentence - this will of course include spaces.
If I use rhinoscriptsyntax.GetString(), the input ends as soon as you hit the space bar.

Is there any way to get around this?

Cheers,
Max

Hi,

They can either use " " when typing in command line or you can use .StringBox method that does not have this problem.

hth,

–jarek

Hi @MaxMarschall,

Using RhinoCommon, you can use a GetString object and use it’s GetLiteralString method.

For example:

import Rhino
gs = Rhino.Input.Custom.GetString()
gs.SetCommandPrompt("Enter some string")
gs.GetLiteralString()
if (gs.CommandResult() == Rhino.Commands.Result.Success):
    print gs.StringResult()

http://developer.rhino3d.com/api/RhinoCommonWin/html/M_Rhino_Input_Custom_GetString_GetLiteralString.htm

– Dale

1 Like