https://github.com/sey56/rscripting
Instant C# scripting in Revit via Roslyn and VS Code โ built for speed and simplicity.
https://github.com/sey56/rscripting
automation bim csharp revit revit-addins revit-api roslyn scripting
Last synced: 11 months ago
JSON representation
Instant C# scripting in Revit via Roslyn and VS Code โ built for speed and simplicity.
- Host: GitHub
- URL: https://github.com/sey56/rscripting
- Owner: Sey56
- License: mit
- Created: 2025-07-03T11:06:40.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-10T15:25:35.000Z (11 months ago)
- Last Synced: 2025-07-10T17:06:30.149Z (11 months ago)
- Topics: automation, bim, csharp, revit, revit-addins, revit-api, roslyn, scripting
- Language: C#
- Homepage:
- Size: 4.72 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
# ๐๏ธ RScripting
**Streamlined C# scripting for Revit โ built on Roslyn, the Revit API, and VS Code**
RScripting (short for Revit Scripting) is a minimal developer environment for writing and running Revit automation scripts โ directly from **VS Code**.
It executes top-level C# scripts instantly inside Revit using Roslyn โ no builds, no packaging, no Visual Studio required.
At its core is `RScript`, the native Revit add-in that acts as the runtime engine. In Revit, it appears as a toggle button labeled **"RScriptServer"**, controlling the script execution server.
Scripts are written in plain `.cs` files using standard C# syntax and powered by the Revit API. To simplify access, RScripting injects a few global variables such as `Doc`, `UIApp`, and `Transact`, making it fast to prototype without boilerplate.
The engine works with:
- `rscript-bridge` โ a lightweight .NET console tool that forwards scripts from VS Code to Revit
- `rscript-extension` โ a VS Code extension that scaffolds a scripting workspace with IntelliSense, diagnostics, and command palette integration
Together, these form the RScripting stack โ a fast, readable, and build-free automation pipeline for developers working with Revit.
---
## ๐ Highlights
- โก **Instant execution** via Roslyn scripting
- ๐ง **Full IntelliSense** + Revit API access (through VS Code)
- ๐ **Live feedback** in VS Code's output panel
- ๐ง **Minimal setup** โ no DLL clutter or builds
- ๐ **Portable `.cs` workspace** โ easy to version & share
- ๐ฅ๏ธ **Lightweight in-Revit toggle** โ no embedded UI, just `RScriptServer` control
---
## โ๏ธ Getting Started
> **Close both Revit and VS Code before installation**
### 1๏ธโฃ Clone & Build
Use Git Bash (comes with [Git for Windows](https://git-scm.com)):
```bash
git clone https://github.com/Sey56/RScripting.git
cd RScripting
./build.sh
```
Sets up:
- โ
Revit Add-In
- โ
IPC Bridge
- โ
VS Code Extension
---
### 2๏ธโฃ Create Your Scripting Workspace
Create a folder anywhere with any name:
```bash
mkdir TestWorkspace
cd TestWorkspace
code .
```
---
### 3๏ธโฃ Initialize Workspace in VS Code
Run:
```
Ctrl + Shift + P โ RScript: Initialize Workspace
```
Click **Restore** in the toaster notification.
Adds:
- `Scripts/` folder with starter scripts
- IntelliSense stubs (`Doc`, `UIDoc`, `UIApp`, `Print`, `Transact`)
- Preconfigured `.csproj`
- `.vscode/tasks.json` for automation
---
### 4๏ธโฃ Launch Revit & Start the Server
- Open your Revit project
- Go to **Add-Ins โ RScript Server**
- Toggle the server ON
---
### 5๏ธโฃ Send Script to Revit
Back in VS Code, run:
```
Ctrl + Shift + P โ RScript: Send To Revit
```
Or press:
```
Ctrl + Alt + R
```
---
### โ
See Results
- **VS Code Output Tab** โ Channel: `RScript`
```
[PRINT 14:30:05] Creating wall centered at origin...
[PRINT 14:30:05] Wall created.
```

**Figure**: Wall placed along the X-axis at the origin, with crossing grids for spatial reference.
- **Local Logs** for diagnostics in local user's home directory:
- `CodeEditorError.txt`
- `RScriptBridgeLog.txt`
- `CodeRunnerDebug.txt`
---
## ๐ ๏ธ Build Options
RScripting uses a single, streamlined build method:
### ๐ง Build with Git Bash (Required)
```bash
./build.sh
```
- Runs in **Git Bash** (comes with [Git for Windows](https://git-scm.com))
- Installs:
- โ
Revit Add-In
- โ
IPC Bridge
- โ
VS Code Extension
- Fast and reliable โ no need for Visual Studio or manual copying
---
### ๐จโ๐ป Development Mode (Preserve bin & obj)
```bash
./build.sh --dev
```
- Keeps `bin` and `obj` folders after build (useful for debugging in Visual Studio)
- Skips cleanup step to support incremental development
- Ideal for contributors maintaining RScripting locally
> ๐ก `build.sh` must be run in Git Bash. Other terminals like Command Prompt or PowerShell are not supported.
---
## ๐ป Requirements
| Component | Version |
|----------------------|--------------|
| Windows | 10 or 11 |
| Revit | 2025 |
| .NET SDK | 8.0+ |
| Node.js + npm | Latest LTS |
| Visual Studio Code | Latest |
| Git + Git Bash | Required |
---
## ๐ Tutorials
- [Getting Started โ](docs/getting-started.md)
- [Hello Revit โ](docs/hello-revit.md)
---
## ๐ License
MIT โ free for personal and commercial use
---
## ๐ค Author
**Seyoum Hagos** โ Architect ยท Developer ยท Workflow Designer
_Built in collaboration with Copilot and DeepSeek_