PowerShell Script Tester
The PowerShell Script Test feature allows users to quickly test PowerShell scripts without having to run the feature which they desire the script to run. As an example, if a script was added to a length parameter to verify that the value is greater than 25 and if not, hide the parameter so it would not be displayed in the eVolve Properties Browser. A user would have to implement the script and then run the eVolve Properties Browser to test the script. However, if there is an issue with the script, troubleshooting now becomes painful as each time changes to the script are tested, the user must re-open eVolve Properties Browser. Instead, the script can be added and easily tested with the PowerShell Script Test feature.
To test a script
- From the eVolve ribbon, click the Utilities panel menu, and click PowerShell Script Test.
TIP: bind the PowerShellScript Test command to a keyboard shortcut to launch faster. - From the PowerShell Script window, add the desired script to the script editor and click OK.
- From the drawing area, click the desired element. The results are displayed in a popup window.
Overview of the PowerShell Script window
Script Editor
The script editor allows users to add and modify PowerShell scripts.
NOTE: If "^abort^" is returned, the parameter(s) responsible for the abort return will stop processing on all remaining elements in the query. This feature could help optimize and/or troubleshoot queries, prevent infinite loops, and hide parameters so as to not display them in the eVolve Properties Browser.
PowerShell Global Functions
Provides "built-in" functions that can be called from any PowerShell script executed through eVolve tools.
- User Defined Functions - Custom PowerShell functions that are loaded before the execution of any PowerShell scripts. Use this to build a library of commonly utilized functions.
- System Functions - Built-in PowerShell functions that are loaded by the system before the execution of any PowerShell scripts. These can be called in any PowerShell script.
Revit Context Passed to PowerShell
- $eVolveFromParameter - returns the value of the configured parameter as a string.
NOTE: From Data Profiles, the return value is dependent on the Use Display Value checkbox, when unchecked the internal Revit value is returned. - $eVolveElement - the Revit element which triggered the current rule. This PowerShell parameter can be used to perform additional queries of Revit parameters pertaining to the triggering element.
- $eVolveRevitVersion - returns the current Revit version.
- $eVolveVersion - returns the current eVolve version.
- [System.Windows.Forms.MessageBox]::Show("Value=" + $value) - used to display a popup dialog in the script. This function may prove useful when troubleshooting a script. Simply replace the $value with the desired parameter. As an example, the following would display any value in an element's Comments field within the popup dialog:
$comments = $eVolveElement.LookupParameter("Comments").AsValueString()
[System.Windows.Forms.MessageBox]::Show("Value=" + $comments)
Data Tables
- Configure
- Select Data Table window - allows information to be pulled from the selected Data Tables. See the link below.
IMPORTANT: including Data Tables will affect performance, only select necessary tables to minimize the impact.
NOTE: if the name of the data table and/or column names are changed within the Data Tables, then the selections from the Select Data Tables window and possible to the script may be required.
- Select Data Table window - allows information to be pulled from the selected Data Tables. See the link below.
Optional Context
- Configure
- Additional Context PowerShell: Project Data Profiles window
- $eVolveContainedElements - provides an array of all elements contained within $eVolveElement when it is one of the following, otherwise (null) or empty is returned:
- Assemblies
- Model Groups
- $eVolveNestedElements - provides an array of all nested elements within $eVolveElement. If there are none, (null) or empty is returned.
- $eVolveConnectedElements - provides an array of all elements that are physically connected(immediate neighbors) to $eVolveElement. If there are none, (null) or empty is returned.
- $eVolveLinkedModels - provides an array of all linked models (category RVT Links) that are currently loaded in the document. If there are none, (null) or empty is returned.
- $eVolveRunElements - provides an array of all elements within the run of which $eVolveElement is a part. The available elements are determined by the defined options. If there are none, (null) or empty is returned.
- Run Traversal Element Criteria (Embedded Filter) - used to define the categories and optional conditions that run elements are filtered against.
- Traverse branches checkbox - when enabled, all elements from any downstream branches that are connected and extending from the main run are returned.
- $eVolveContainedElements - provides an array of all elements contained within $eVolveElement when it is one of the following, otherwise (null) or empty is returned:
- Additional Context PowerShell: Project Data Profiles window