Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
developer:macroscriptsetup [2019/08/29]
mitch_heynick [Running scripts from aliases or toolbar buttons]
developer:macroscriptsetup [2019/08/29] (current)
mitch_heynick
Line 1: Line 1:
-=====Integrating macros and scripts into your workspace=====+======Integrating macros and scripts into your workspace======
  
-Macros and scripts can be run in several ways inside Rhino. ​ The best way to integrate them into your workflow will depend on your preferred way of working as well as which platform you are on - the Rhino for Windows and Rhino for Mac environments are somewhat different. +>//Macros and scripts can be run in several ways inside Rhino. ​ The best way to integrate them into your workflow will depend on your preferred way of working as well as which platform you are on - the Rhino for Windows and Rhino for Mac environments are somewhat different.// 
----- + 
-> We'll cover installing ​**Macros** first, as they'​re somewhat simpler to get up and running.+=====Macros===== 
 +>//We'll cover installing Macros first, as they'​re somewhat simpler to get up and running.//
  
 ===Using the macro editor to work out new macros=== ===Using the macro editor to work out new macros===
Line 30: Line 31:
  
  
-=====Organizing and running scripts=====+=====Scripts=====
 Scripts are actually small computer programs that can access Rhino core functions and thus allow you to do a much wider array of operations than macros. ​ While creating scripts does require some knowledge of programming and  Rhino, running them does not - you can find many already out there on the 'net and the Rhino forum. Scripts are actually small computer programs that can access Rhino core functions and thus allow you to do a much wider array of operations than macros. ​ While creating scripts does require some knowledge of programming and  Rhino, running them does not - you can find many already out there on the 'net and the Rhino forum.
  
 >//For one-time or occasional use, you can simply save a script somewhere on your computer and then call it from inside Rhino using the **RunPythonScript** command (.py Python scripts, both platforms) or the **Runscript** command (.rvb Rhinoscripts,​ Windows only) and then browsing to the script file and Open.  However, if you are going to use the script more often, ​ you will be better off setting it up to run with a button or alias, see below.// >//For one-time or occasional use, you can simply save a script somewhere on your computer and then call it from inside Rhino using the **RunPythonScript** command (.py Python scripts, both platforms) or the **Runscript** command (.rvb Rhinoscripts,​ Windows only) and then browsing to the script file and Open.  However, if you are going to use the script more often, ​ you will be better off setting it up to run with a button or alias, see below.//
 +
 +====Organizing your script collection====
  
 ===Storing your scripts in a specific location=== ===Storing your scripts in a specific location===
Line 49: Line 52:
 You can navigate to the ~Library folder by holding down the Alt key and pulling down the "​Go"​ menu in the Finder, then navigating along the path above. ​ //Note: you can only run Python scripts on Mac (.py extension), Rhinoscripts (.rvb) will not run.// You can navigate to the ~Library folder by holding down the Alt key and pulling down the "​Go"​ menu in the Finder, then navigating along the path above. ​ //Note: you can only run Python scripts on Mac (.py extension), Rhinoscripts (.rvb) will not run.//
  
-===Helping Rhino find the scripts===+===Helping Rhino find your stored ​scripts===
 **On Mac**, this is easy - the work has already been done for you - Mac Rhino already knows where the scripts folder is, so scripts located in that folder can be run very simply. **On Mac**, this is easy - the work has already been done for you - Mac Rhino already knows where the scripts folder is, so scripts located in that folder can be run very simply.
  
Line 57: Line 60:
 **For Python scripts**, first open the script editor using the **EditPythonScript** command, then go to Tools>​Options and enter the path to the scripts folder in //Module Search Paths//. **For Python scripts**, first open the script editor using the **EditPythonScript** command, then go to Tools>​Options and enter the path to the scripts folder in //Module Search Paths//.
  
->//Note that no matter where scripts are stored on your computer, they can always be run if you provide the **full path** to the script in your alias or button. ​ The above procedure simply allows you to call scripts **without** having to specify the full path. Plus, you will always know where to find them!//+>//Note that no matter where scripts are stored on your computer, they can always be run if you provide the **full path** to the script in your alias or button. ​ The above procedure simply allows you to call scripts **without** having to specify the full path. Plus, you will always know where to find them!// ​\\
  
 +\\ 
  
 ====Running scripts from aliases or toolbar buttons==== ====Running scripts from aliases or toolbar buttons====
  
 **For aliases**, create them as described above in the first section... ​ \\  **For aliases**, create them as described above in the first section... ​ \\ 
-Either simply ​with the filename if you have set a search path:+Simply ​with the filename if you have set a search path - or you are on Mac and the scripts are in the default scripts folder:
  
 {{:​developer:​aliasscriptlink.png?​400|}} {{:​developer:​aliasscriptlink.png?​400|}}
Line 72: Line 76:
  
 //(shown above: Windows)// //(shown above: Windows)//
 +
 +>//**Do not forget to enclose the file name/path in quotes!** \\ 
 +If there are spaces in it and no quotes, the script will not be found!//
  
 **For toolbar buttons** if you have created them: \\  **For toolbar buttons** if you have created them: \\ 
Line 90: Line 97:
  
  
-Editing in progress ​29.08.19 - msh+Last edit 29.08.19 - msh
  
  
developer/macroscriptsetup.txt · Last modified: 2019/08/29 by mitch_heynick