It’s probably me, but how come the simplest example taken from the API doesn’t work.
What is that Prompt supposed to do?
Where can I find examples where user can click on the parameters on an active command to enter values instead of being prompted each value separately?
Willem
(Willem Derks)
May 29, 2018, 8:15pm
2
Have a look at this example: ( click the python tab for the example)
-Willem
1 Like
Thanks Willem.
Under the RhinoCommon examples. Never would’ve guessed that.
When I read RhinoCommon I get the C#/VisualStudio image in my head.
nathanletwory
(Nathan 'jesterKing' Letwory)
May 29, 2018, 10:11pm
4
Python in Rhino is IronPython is .NET, thus RhinoCommon.
Yes, I know that IronPython is .NET. Just it’s a bit confusing here: http://developer.rhino3d.com/api/
http://developer.rhino3d.com/samples/
I thought RhinoCommon is more for compiling RhinoPlugins and GH components. That’s why I didn’t look inside RhinoCommon for scripting purposes.
Does it mean that I can use Python inside VisualStudio to compile RH plugins and GH components?
nathanletwory
(Nathan 'jesterKing' Letwory)
May 29, 2018, 10:46pm
6
IronPython yes. Or any other .NET language for that matter. I like F#.
piac
(Giulio Piacentino)
May 29, 2018, 10:51pm
7
Hi all,
DLR (Dynamic Language Runtime) languages in .Net are a little special, actually. We had to add some special binding to load IronPython-based Grasshopper assemblies , and Rhino commands also have a special system to be found. Both already exist, though, and are supported in Rhino 6.
To be back on the topic:
Why doesn’t this do anything?
import rhinoscriptsyntax as rs
rs.Prompt("Hello Rhino!")
dale
(Dale Fugier)
May 29, 2018, 11:11pm
9
Hi @ivelin.peychev ,
When run from the editor, the code really doesn’t do anything because the editor itself changes the prompt when running scripts.
If all you want to do is print something to the Rhino command line, just use Print
.
– Dale
Hi Dale,
dale:
When run from the editor
How else can I run it?
Does Print and Prompt the same? I firtst I thought Prompt was like a pop-up gui message.
I saw I can also print in the status bar.
dale
(Dale Fugier)
May 29, 2018, 11:17pm
11
Save your code to a .py
and then use the RunPythonScript
.
– Dale
Thanks @dale ,
I still don’t see Prompt doing anything.
emilio
May 30, 2018, 6:01am
13
Hi Ivelin,
I think the prompt is very soon overwritten and you cannot see it.
Something like this gives us a little more time .
import rhinoscriptsyntax as rs
for n in range( 999 ):
rs.Prompt( str( n ) )
Regards
How can it be overwritten, this is why I am using different string for Prompt and print?
emilio
May 30, 2018, 6:08am
15
AFAIK, the prompt is what you see temporarily, until a print (or another prompt) overwrites it.
The prompt text is not saved in the history, it is only shown to the user until something else is shown there.
nathanletwory
(Nathan 'jesterKing' Letwory)
May 30, 2018, 7:19am
16
It indeed works for the duration of your script/command.
or this:
import rhinoscriptsyntax as rs
for n in range(10,0,-1):
rs.Prompt("Countdown: {}".format(n))
rs.Sleep(1000)
rs.Prompt("Go!")
rs.Sleep(1000)
1 Like
dale
(Dale Fugier)
May 30, 2018, 3:08pm
18
Your script is setting the prompt. But when the script ends, the prompt is reset. All this happens so quickly you can’t tell anything is going on.
Here is (another) sample that might demonstrate its purpose:
import rhinoscriptsyntax as rs
for n in range(0, 100):
rs.Prompt('Calculating (' + str(n) + '%)')
rs.Sleep(50)
– Dale
1 Like
Thanks everyone,
I’m a bit pre-occupied at the moment, I’ll definitely check what you proposed.
Regards