Skip to main content

Lesson 03 - Setting Up Your Coding Workspace

Set up your coding studio. Install Python, VS Code, pyRevit, or Grasshopper to automate AEC workflows. This is the professional foundation for any architectural BIM scripting.

Introduction

Before writing any code, you need a stable environment. One place to learn Python logic. Another place to automate Revit or Rhino.

This lesson walks you through installing the core tools and connecting them to your design software.

By the end, you'll have everything ready to write your first Python script.


Lesson Overview

This section contains a general overview of topics you will learn in this lesson.

  • Install Python 3.x on your system
  • Install Visual Studio Code as your code editor
  • Add the Python extension to VS Code
  • Connect Python to Revit via pyRevit
  • Connect Python to Rhino via GhPython
  • Verify your setup is working

Part A: The Core Tools

These are the industry-standard tools required to write and test Python code independently of any BIM software.

Install Python 3.x (The Interpreter)

Python is the "engine" that translates your text commands into machine instructions.

Download: Python.org

Select the latest stable 3.x version.

Critical: During installation, check the box labelled "Add Python to PATH"

(This lets VS Code find Python automatically. Without it, you'll troubleshoot for 30 minutes.)

Visual Studio Code (VS Code) is a lightweight but powerful code editor. Unlike a basic text editor, it provides syntax highlighting, error detection, and debugging tools.

Download: code.visualstudio.com

Why VS Code?

It's the professional standard. Syntax highlighting. Error detection. Debugging tools. Manages folders and version control.

You'll outgrow Notepad in a week. Start here.

Install the Python Extension for VS Code

VS Code needs a specific plugin to "understand" Python logic and provide intelligent suggestions.

  1. Open VS Code
  2. Navigate to the Extensions view (icon with four squares on the left sidebar)
  3. Search for "Python" (published by Microsoft)
  4. Click Install

Part B: Integrating with AEC Software

Once the core engine is ready, connect it to your primary design tools.

Route 1: Revit (pyRevit)

Revit does not support "raw" Python scripts out of the box in a user-friendly way. pyRevit acts as the bridge.

Installation: Download pyRevit

Function: It allows you to create custom ribbon buttons that execute Python scripts. It bypasses the need for the Revit SDK or complex C# compilation.

Route 2: Rhino (GhPython)

Rhino has deep, native integration with Python through Grasshopper.

Access: Open Grasshopper and locate the Python Script component.

Function: This component allows you to use Python to generate geometry, move points, or analyse surfaces using the RhinoCommon library.


Assignment

  1. Install Python 3.x on your computer (make sure you check "Add Python to PATH")
  2. Install Visual Studio Code
  3. Install the Microsoft Python Extension in VS Code
  4. If you use Revit: Install pyRevit
  5. If you use Rhino: Open Grasshopper and locate the Python Script component
  6. Verify your setup:
    • Open VS Code
    • Create a new file called test.py
    • Type: print("Setup complete")
    • Click the Run button (▶) in the top-right corner
    • You should see: Setup complete in the terminal

Knowledge Check

The following questions are an opportunity to reflect on key topics in this lesson.


Additional Resources

This section contains helpful links to related content. It isn't required, so consider it supplemental.

Updated on Mar 27, 2026