SetCommandPrompt

Hi there,

I would like to create some dialog for the script that I am working on. I have checked the CommandLineOption script however I noticed that it is for the Get classes. I would like to set the dialog as the first part of the script without to select anythong.
The user could select some option Op1, Op2, Op3 and than the script would continue accordingly.

I have found the Rhino.RhinoApp.SetCommandPrompt() but it does not work. It is interesting because WriteLine() works well.

Another question. I got the message for the Rhino.RhinoApp.BuildDate() that DateTime is not callable. Is it because Python does not have this data type?

import Rhino
import scriptcontext

sc = Rhino.RhinoApp.SetCommandPrompt("message-CommandPrompt")
#Rhino.RhinoApp.BuildDate()
Rhino.RhinoApp.WriteLine("message-WriteLine")

BuildDate is a property ( see its .NET documentation). That means you should use it like so:

import Rhino
print(Rhino.RhinoApp.BuildDate)

The command prompt is changed for the duration of the script. Your script is so short that you probably don’t notice it was changed. It got changed back to its original prompt after your script ended.

See for instance with

import Rhino
import time

Rhino.RhinoApp.SetCommandPrompt("The changed command prompt")

for i in range(0,1000):
	Rhino.RhinoApp.Wait()
	time.sleep(0.001)
	
print("done")

Thank you it works well now. I do understand Command prompt as well. Timer was confusing but it makes sense now.

However in the meantime I found a post where Dale suggest a method after that he corrected into an another syntax I do not understand what “L” meant to be in the argument

Rhino.RhinoApp.SetCommandPrompt(L"The changed command prompt")

and after RhinoApp there is a parenthesis as well.

The thread you link to uses C++ code, not Python.

The timer was there merely to have a one-second wait (thousand times 0.001 second) while allowing Rhino to still update and respond to usage. That makes it show the command-prompt as set by our code.

Thank you,