Using 'what' command inside the script


I hope you can help me to figure out how I could use Rhinoceros more efficiently.

I have built a cnc machine to cut out elements for mosaic. I am using Rhinoceros on Mac to create a model (because of specifics of my particular case the model is flat consisting only lines and arc). then I am using ‘what’ command to produce a txt file describing that model. Then I am running python script, which I have written and out of txt file my script produces gcode file to be used by cnc machine.

Now I am wondering if I could automate this three-step process and invoke my python script within Rhino application. Rhinoceros does provide a way to invoke python script, however, in my particular case I need to run what command first. I’ve been searching Rhino’s command help and other sources but did not find clear description of ‘what’ command. (Rhinoceros’s help is still more Windows oriented and despite of the fact that I am running it on Mac, many examples still refer to windows. ). Unfortunately, what command invokes GUI, prompting user to either save its output to file or just exit (by clicking ‘Done’).

I guess my question is:

Is ‘what’ command a script or is it part of compiled program? Is it a way to pass some arguments to what command, so, I could use it inside the script without a need to deal with GUI?

I would also appreciate if you could suggest any other approach, different from what I am using - perhaps I missed something in your documentation and what I am trying to accomplish can be done easier and/or in different way.

Thank you in advance!

You are lookin for the objectdump method, but it seems it’s not available for Rhino on mac yet.
Try this answer:

Thank you, Jackshaftoe for replying. I guess I am trying first to understand - rhino commands are they scripts or are they compiled programs? if they are scripts, then they must be ‘living’ somewhere and so, I could take a look on the code and figure out (or maybe even modify) them. if they are compiled code, then, I guess, not much I can do.

second thing I am trying to understand ( and unfortunately, McNeel’s tech support is failed/refused to answer this simple question: there is a command ‘what’ (at least on Mac it is called like this). What is the signature of this command? I am trying to find out, what arguments I could pass to it, so, it could produce text file of the model WITHOUT spitting on me GUI where I have to either click ‘Save’ or ‘Done’? Does anybody know the answer to these questions, please???

Thank you!

Hi @slavamas,

Rhino commands are compiled. Thus, the source code is not viewable

Also, I am not sure what you mean by “the signature of this command?” Commands don’t have “arguments” like you’d find in a function provided by some programming language.

However, command can be scripted. For example, if you run -What (notice the hyphen character), you’ll see a command line interface, rather than a dialog box. Thus, the What command can be scripted by a Python script.

Does this help?

– Dale

Dale, Thank you very much for responding to this. I wish Rhino could have more detailed help for all the commands, so, I ( and believe others) would NOT need to ask tons of questions like mine here on the forum.

  1. well… some commands are designed to accept arguments. ‘What’ command is not an exception - it just accept it in GUI of Rhino environment… right? :wink:
    Please elaborate here a bit more. so, if I insert ‘-what’ into python script how do I pass filename to be generated, bypassing this dialog in Rhino?
    As soon I read your reply I tried to do what you have suggested and got GUI where I supposed to choose either file, clipboard or dialog.
    to be precise, I realized that before ‘-what’ I will need to use ‘SelCrv’, then ‘-what’.
    Only the question is how to ‘explain’ ‘what’ command to save its output to filename specified.

Thank you!

Oh, sorry, Dale - I did not explain ‘signature’. I used signature word, presuming command up to certain degree, can be treated as a function. hence - signature.


Hi @slavamas,

Here is an example of scripting the What command and saving the contents to a text file.

This can all be done in a Python script too.

_-What _File "C:\Users\Dale\Desktop\curve.txt"

– Dale

Dale, You made my day!

Thank you!