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


#1

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


#2

Hi,

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

hth,

–jarek


(Dale Fugier) #3

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