Hello,
can anybody explain me the RunCommand() action in rhino.python? I searched all over the web to find an working example, but most install explanations linked to the old rhino.pythonforum (like this).
Sven
Hello,
can anybody explain me the RunCommand() action in rhino.python? I searched all over the web to find an working example, but most install explanations linked to the old rhino.pythonforum (like this).
Sven
What are you trying to do? To run a Rhino command you would either use rhinoscriptsyntax rs.Command, or RhinoCommon Rhino.RhinoApp.RunScript(commandString, echo)âŚ
âMitch
Hi Mitch,
this RunCommand() think should register a command for my written script to Rhino. So i can use the script like an regular Rhino command.
there some special thinks i found out so far:
__commandname__ = ["your command"]
variable in your code (name of py file without _cmd.py)RunCommand(is_interactive)
functionOK, I wasnât sure what you wanted - unfortunately I canât help you because I donât know much about how that stuff works, I probably shouldâŚ
âMitch
Hi Sven - what I do is make my script in the normal way, without making it a command and sort the script out, get it working, then I start a new script as a command- I enter the relevant info to set it up, then, transfer the code into this new script, with some minor change that the base function that runs the script, typically
def test():
blah blah
test()
the âblah blahâ you copy and paste into the command script:
def RunCommand( is_interactive ):
blah blah
Other functions in the test script can be moved over above the def RunCommand( is_interactive ): part.
Steve or others probably has more info or better processes, but that has been working for me.
-Pascal
When you get the little dialog to enter the command name, what do you give it as a plug-in?
Thx, --Mitch
Hi Mitch- you can put whatever name for the plug-in that makes sense. Once you add one, or more, these show up in the drop down- so in other words you can use this to add commands to existing plug-ins. But you can over-type if you want to make a new command and plug-in.
-Pascal
Yep, this is all correct information that Pascal is presenting. We never really got the python âplug-inâ concept to full maturity which is why things seems a bit vague and very little documentation exists.
Hi,
thanks that helped me a lot
-Sven
So, if I got this straight, I create some sort of plug-in name like MyMostExcellentPythonCommands and then I can add as many command scripts as I want to that plug-in?
Thx,
âMitch
Thatâs the goal. Again, this hasnât really gotten as mature as it needs to in order to be really useful.