Dumb question: Running rhino commands with arguments

rhino
command

#1

Ok I’ve got a dumb question: I want to run a rhino command, for example Rebuild, with the arguments/options set to specific values. Is there a way to do this completely by typing in the command? ie. I could run the command Rebuild(Point Count = 15, Degree=3) or create a similar custom alias for that?


(John Brock) #2

Start the command with a dash or hyphen character, "-Rebuild"
The dash is how you start what we call the “scripted” version of the command, that only takes command line input with no dialogs.

http://docs.mcneel.com/rhino/mac/help/en-us/index.htm#information/rhinoscripting.htm


#3

Alright but how do I modify the options of that? When I run ‘-Rebuild’ I still get this window
instead of this window

I’m confused about the functional difference between the two.

Ideally I’d like to run the command, something like -Rebuild(Point Count=15, Degree=3) and have the command execute with those settings. Is that possible?


#4

On the Windows side you would do this as -Rebuild Pause PointCount=15 Degree=3 Enter , you can then assign that to an alias or button. Not sure how well this translates to Mac Rhino however.

Some things on macro creation:
https://docs.mcneel.com/rhino/5/help/en-us/information/rhinoscripting.htm
https://wiki.mcneel.com/rhino/basicmacros

Hope that helps,
Sam


#5

That did the trick, thanks!


(John Brock) #6

@gent
When you start ANY “scriptable” command like “-Rebuild”, all of the dialog options are available on the command line.There is a letter underlined for each option. Typing that letter invokes the option.
So running a command that way are paying attention to what you have to type to do what you want are the key strokes that go in a macro.

The link I sent and the links Sam included have the additional detail you need to become at writing your own macros.

Not a dumb question, but apparently my answer was too sparse o’clues.


(Bradley A Jackson) #7

I would like to create my own aliased macros that I can pass parameters into but haven’t seen how yet.

Any pointers?


#8

The link that Sam posted above should explain how to do the basics, if that is not enough, please post a specific problem you are having creating a macro…

–Mitch


(Bradley A Jackson) #9

I have a simple macro called Sphere. I would like to call the macro with an argument that gets plugged into the radius of the SphereShell command each time it is run. For instance if I wanted radius to be 45 I would enter

SphereShell 45

I created an Alias called SphereShell with this in it.

Echo
_Box 70,70 -70,-70 " " Enter
SelLast Enter
convertextrusion Enter
Pause
Setobjectname box Enter
_Sphere 0,0,0 This is where the argument would get plugged in Enter
sellast
setobjectname inner Enter
sellast
Offsetsrf .2 Enter
sellast
setobjectname outer Enter
_-SelNone
Pause
-_Selname outer Enter
booleandifference -_selname box Enter
-_Selname outer Enter
booleandifference -_selname inner Enter
_-ChangeLayer Layer1 enter


#10

No, this will unfortunately not be possible with a macro. For this you would need a simple script to ask for user input - it would go something like this:

SphereShell
"Outer diameter?" <user input/Enter>
"Offset thickness?" <user input/Enter>

Here is a quickie python script that does this, just for illustration purposes…

CreateHemisphereShell2.py (998 Bytes)