I am trying to run a python script with a Rhino button, and I want to make this available to lots of people. My plan was to store the python scripts and toolbar in a git repository, with instructions for people to clone the folder to their Documents folder.
Hi @Dancergraham, thanks for the two ideas. I dont know if im misunderstanding the suggestion or perhaps I’ve not been clear on my goal. Im trying to run my python script with a button, so it is just the macro language that is available in the buttons I believe. Therefore I dont think I can import etc. ?
Creating the Rhino Commands may be a better road to go down. I’ll need to edit all my scripts and the toolbar, but it looks like it may be a good solution. Thanks for pointing this out, looks like its probably what I should have started with in the first place.
It’s possible but a little convoluted and i didn’t get my head around it fully previously I’ve now got it working…
I put the sample file ‘HelloPython.py’ in a folder called ‘test’ in my home directory. I then put the following line in a button: ! -_RunPythonScript "import os;import imp;homepath = os.path.expanduser('~');my_path=r'test\HelloPython.py';imp.load_source('HelloPython', os.path.join(homepath,my_path))"
This runs the HelloPython file
Ah yes, I see. Run a python script that runs a python script. Nice idea. Thanks
Thanks for the help.
I’ve been trying to get the plugin’s to work as per your suggestion. But getting a bit stuck at it as Im getting an ‘unexpected error’ in the Install Wizard.
So I may revert back to this plan.
A little off thread, but to close out the plugin side of things.
Can I have multiple commands in one plugin? I would guess yes, but this isnt clear from the instructions.
Is the title the name of the command or the plugin? Again im guessing the plugin, but if so, the example is a little confusing. And can I make the title whatever I want or does it need to be the same as before? Trying to figure out if one of these things is maybe giving me my error.