User data entry in scripts

I’m in the process of throwing together a script collection for Mac Rhino and been considering how to structure the user data entry process best for Mac users - being that I’m not really one.

Many scripts can run with little or no user data entry, but there a number that need quite a few parameters input in order to run. As Windows Rhino is command-line based, the options input sequence usually happens on the command line either sequentially (option/Enter/option/Enter/etc.), or all on one line with multiple clickable/keyboard addressable options and one Enter to accept all. But as Mac Rhino’s “translation” of the Window’s command line is, let’s say, “different”, the interface doesn’t quite work the same way.

I’m throwing out 3 possibilities here, which represent different approaches. Each one asks for the same data - a toggle choice (boolean), a list choice, and number entry from a limited range.

First on the list is the “all-in-one-line” option (requires RhinoCommon), you set all the options and then Enter (Done) to launch. The advantage is you can change your mind on any option up to the time you launch.

MacCLOptions.py (1.8 KB)

Second is the “sequential” options set, you fire them off one at a time with Enter/Done between and there’s no going back to a previous one once set.

MacCLOptionsSequential.py (806 Bytes)

Third is the “in-your-face” where all the input is into message boxes thrown up onto the screen and not the command prompt. Well, almost all in message boxes, there is no dialog for a toggle - on either platform. You will see there is a bug with the number entry, don’t worry, I’ve already reported it.

MacCLOptionsSequentialDialogs.py (823 Bytes)

Personally, I like the second (sequential) way - its also the easiest to code. The first way is cool, but just doesn’t seem to be very natural without a real command line.

The prompts on all of these are also somewhat limited, as some of the methods cannot contain anything other than letters in the option or they fail. If you have the command prompt docked on the left side of the screen, the line length is also limited. And the scripts just work “differently” on Mac than on Windows. If you have access to Windows Rhino, feel free to try them there.

Edit: for those without a Windows to try out, this is what option#1 looks like on the Windows Rhino command line…

Anyway, since I made these up for testing, I just thought I’d throw them out here for FWIW. Just put them anywhere and run them with RunPythonScript.

Oh, and I guess I should also say that once ETO is hooked up and running, I will try to do dialogs for the more complicated stuff… But I guess the ETA for ETO is more like V6.

–Mitch

3 Likes

Hi Mitch,

thanks for the examples! I’m also no Mac user anymore since the early Rhino beta days. Thus I kept off the discussions about the Mac-Rhino interface. However - I think it is important that Rhino behaves consistent across the platforms - at least from a developers point of view. I agree with your observations and hope that this thread evolves quite a bit… ideally it will lead to an optional windows-like commandline on mac :wink:

Regarding Eto (which is already hooked up on Mac Rh5 and Win Rh6) I think it should also be supported from Win Rh5. I know it can be configured manually, but it would be nice if it will be integrated with future service releases of Win-Rhino v5.

Thanks Mitch, I like the examples and your explanation . I will look more when I have a bit more python time.