Script Execution
Running a script in Paracore is designed to be a safe, predictable, and informative process. Paracore handles the complex tasks of dependency resolution, compilation, and Revit transaction management, allowing you to focus on the results.
How to Run a Script
- Select: Choose a script from the Script Gallery.
- Configure: Adjust the values in the Parameters tab of the Script Inspector.
- Validate: Ensure there are no red validation warnings (e.g., missing required fields).
- Run: Click the Run Script button in the footer of the Inspector.
The Execution Lifecycle
When you click "Run", Paracore performs the following steps in sequence:
- UI Sync: The current parameter values are gathered from the UI.
- Project Check: Paracore validates the project structure, ensuring the
Scripts/folder exists and contains exactly one valid entry point. - Compilation: The CoreScript Engine discovers and compiles all
.csfiles originating from theScripts/folder using the Roslyn compiler. - Handshake: The compiled byte-code is sent to the Paracore Revit Addin inside Revit via the Paracore Local Backend (Sidecar) mediator.
- Revit Execution: The code runs within the Revit API context. If a
Transactblock is used, a Revit Transaction is automatically started and committed. - Reporting: Output and status are streamed back to the Paracore Desktop App.
Monitoring Results
After execution, the Inspector provides several ways to review the outcome:
- Success/Failure Indicators: A green checkmark (✅) or red cross (❌) appears next to the Run button.
- Console Output: Every execution displays its standard output followed by a final status message.
- Success Message:
✅ Code executed successfully | [Day], [Date] | [Time] - Failure Message: If a script fails, the errors and the final status line are displayed in Red:
[ERROR] Filename.cs(line, col): error CSXXXX: ...❌ Script failed to [compile/execute] | [Day], [Date] | [Time]
Handling Errors
If a script fails, use the Console tab to identify the root cause.
- Compiler Errors: Syntax issues (e.g., a misspelled class name like
Referenc). - Runtime Exceptions: Revit API errors (e.g., trying to modify an element that is no longer valid).
- AI Fix: When a failure occurs, use the Explain & Fix button to automatically analyze and resolve the issue.
Next: Deepen your knowledge with the Scripting Reference.