Advertisement

Showing posts with label Application Development. Show all posts
Showing posts with label Application Development. Show all posts

Wednesday, October 7, 2026

OkPy Review: Create Fully Functional Revit Add-ins with Zero Coding, with Examples!

Recently we posted about OkPy and its parent, the Orkestra add-in. I've been using OkPy for several days and have created a few add-ins with it, with zero coding. (I haven't even so much as looked at code.) Here I'll detail my add-ins and the prompts I used to create them. It's a good cross section, from a simple scripting task to a model scanner to interactive element selection, with some snazzy dialog box design and Excel interoperability thrown in for good measure.

A little about my programming background: I have about 30 years of development experience, though it has been almost exclusively with Bentley products, especially MicroStation (I know, boo, hiss!), and primarily with Visual Basic. A few months ago, I tried to create a Revit add-in the traditional way, with C#, but you need to configure Visual Studio to work with Revit and I couldn't find a modern reference for how to do that, so I didn't even get out of the starting block.

First, let's cover an add-in I named Hammer Sync. I wanted a tool that would sync, reload selected links, and sync again. Something I could kickoff and walk away from. This process is handy before exporting CAD files to make sure everything's up to date.

I used the following prompt to create the add-in:

Create a new project named Hammer Sync. In a dialog box, list "Synchronize Now", then all the Revit links in the active file in alphabetical order, and "Synchronize Now" again. To the left of each list item, place an icon appropriate for the task, synchronize for each Synchronize Now and reload for each link. To the far left of each list item, place a checkbox. At the bottom left of the dialog, place "Check None" and "Check All" buttons. If all checkboxes are ticked, lock the Check All button. If some checkboxes are unticked, unlock the Check All button. If no checkboxes are ticked, lock the Check None button. If some checkboxes are ticked, unlock the Check None button. If the user clicks Check None, untick all the checkboxes. If the user clicks Check All, tick all the checkboxes. To the right of the list, place an image of a steaming cup of coffee. At the bottom right of the dialog, place "Apply" and "Cancel" buttons. When the user clicks Apply, if the first Synchronize Now list item is checked, synchronize the model. Then, reload each link that is checked in list order. Finally, if the second Synchronize Now is checked, synchronize the model again. To the right of the list, when a list item is being processed, show a clock icon. When a list item is done processing, display a checkmark.

Now, to be fair, it took me four prompts to get this all included, which was fortuitous because that's the number of free prompts OkPy gives you per day. But my first prompt did the lion's share of the work. The others were just interface tweaks.

Let's see how OkPy works...

You open the OkPy agent through the Orkestra tab:


Monday, October 5, 2026

OkPy: An AI-Assisted Python Development Environment for Revit

Executive Overview

OkPy is an automation-development environment and AI-assisted tool builder that runs inside Autodesk Revit through the Orkestra add-in. It is designed to let AEC professionals create working Revit utilities—including their user interfaces and back-end logic—without building and packaging a conventional compiled add-in from scratch. Users can write tools directly, ask the OkPy Agent to generate them from plain-language requirements, test them against a Revit model, save them as portable OkPy files, and deploy approved tools locally or through Orkestra.

OkPy is broader than a fixed collection of commands. It combines three related offerings: a development environment for custom automation; an AI Agent that generates and revises tools; and a public library of ready-made Revit utilities. Orkestra supplies the host integration, ribbon access, tool distribution, analytics, permissions, and enterprise deployment layer. This makes OkPy most comparable to a low-code development platform, scripting environment, and AI coding assistant combined—not to a single-purpose Revit plug-in.

The product's key promise is to shorten the path from an automation idea to a repeatable, deployable Revit command. Its key risk is equally important: generated or user-written code can modify live project data at scale. Successful adoption therefore depends on testing, code review, release control, model backups, and clear separation between experimental and production tools.

Product Architecture

OkPy Editor

The full editor is aimed at tool creators. It combines a code editor, automatically generated input controls, a debugging console, result handling, and tool metadata in one environment. Current Revit documentation begins new tools in C#, while OkPy's broader documentation and history also describe Python and CPython-based development. Existing scripts may therefore require interpreter-specific review when moving between Revit generations.

OkPy Agent

The Agent provides a simplified conversational workflow. A user describes the Revit task, desired controls, and output; the Agent asks clarifying questions when needed, drafts the code and interface, and presents the result for testing. Published examples include a modeless Door Summary dashboard and a grid-renumbering utility. The generated result is a deterministic tool that can be saved and rerun, rather than a one-time chat response.

Orkestra Integration

OkPy ships with Orkestra and opens from the Orkestra ribbon tab in Revit. Orkestra can organize OkPy, Dynamo, and Grasshopper automations, place approved commands on Revit ribbons through Quick Access, distribute content across a firm, manage environments, and provide analytics. Local OkPy creation can be used independently, while organization-wide cloud deployment and management depend on Orkestra services and plan entitlements.

Tuesday, July 20, 2021

Catching up with pyRevit — Now on Version 4.8.8

The last time we posted about pyRevit was regarding version 4.6.18 on March 11, 2019. Since then, Ehsan Iran-Nejad has continued to be very active with this extremely useful tool, and has published numerous releases since then, including two major dot releases. Here I'll try to encapsulate some of the changes Ehsan has made over the past couple of years plus...

In version 4.6.20 published on May 12, 2019, the following tools were added:

  • Create Parallel Section
  • Match Property
  • Cycle family types
  • Family type and param maker

In version 4.6.21, published on May 19, 2019, CPython was officially brought to pyRevit. The Compare Elements tool was also added.

Friday, July 19, 2019

BILT NA 2019 – Boost Your BIM's Harry Mattison is Granting Revit API Wishes!

Monday, March 11, 2019

Free and Open Source pyRevit v4.6.18 (CLI v0.9.6)

Yesterday, Ehsan Iran-Nejad released a new version of his popular pyRevit.

According to his blog post, the Make Pattern tool now includes Rotation and Mirroring options. 😯

Convert Line Styles has also been updated, including an improved interface with more options.

For all the details, click over to the pyRevit blog »

Saturday, March 2, 2019

Using Forge to Check Version of Revit Files Hosted in the Cloud

From the Autodesk Forge website:

Check the version of a Revit file hosted on the cloud

By Augusto Goncalves
February 21, 2019

With Design Automation for Revit we can select which engine to use, 2018 or 2019. And it's important to choose the correct one in order to avoid opening with an older version or saving with a newer version, e.g. if you have a 2018 file and open and save with 2019 engine.

Jeremy Tammik did an interesting blog post about it, in summary reading the file information that is encoded inside the bytes. This approach still valid, but if the file is on the cloud, we don't want to download it (it may be too big). But we don't need, actually, just need the first few KBs.

The following code sample downloads a few KBs, then if it finds "Autodesk", it created a dictionary with the values.

private async Task<Dictionary<string, string>> GetInfo(string storageLocation, string accessToken)
{
    // this only works for Revit files
    if (storageLocation.IndexOf(".rvt") == -1) return null;

    // prepare to download the file...
    WebClient webClient = new System.Net.WebClient();
    webClient.Headers.Add("Authorization", "Bearer " + accessToken);
    System.IO.Stream stream = webClient.OpenRead(storageLocation);
    byte[] buffer = new byte[ 10 * 1024]; // 10kb
    int res = 0;
    int count = 0;
    do
    {
        if (count++ > 10) return null; // should be right on the begining of the file... 

        // get 10kb of data..
        res = await stream.ReadAsync(buffer, 0, 10 * 1024);
        string rawString = System.Text.Encoding.BigEndianUnicode.GetString(buffer);

        // does it have "Autodesk" on it?
        if (!rawString.Contains("Autodesk")) continue;
        var fileInfoData = rawString.Split(new string[] { "\0", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

        // let's build a Dictionary from this data
        Dictionary<string, string> values = new Dictionary<string, string>();
        foreach (var info in fileInfoData)
            if (info.Contains(":"))
                values.Add(info.Split(":")[0], info.Split(":")[1]);

        return values; // stop downloading the file...
    } while (res != 0);

    // found nothing!
    return null;
}

Sunday, February 17, 2019

Backfill – Free and Open Source pyRevit Versions 4.6.13, 4.6.14, and 4.6.15

From the pyRevit blog:

pyRevit 4.6.15

Feb 8, 2019

pyRevit 4.6.15 is out. Download the installer from here

A few issues have been fixed including “Make Pattern” broken compatibility with Revit 2014.

The “Find and Select Entities without Tags” tool is updated as well to include more categories.

pyRevit 4.6.14

Feb 2, 2019

pyRevit 4.6.14 is out. Download the installer from here

There is a new tool courtesy of Robbo1234

Match Paint can match the surface paints between geometries.

Free and Open Source pyRevit v4.7.0 Beta – Now Supports CPython

From the pyRevit blog:

pyRevit 4.7.0-beta (Finally CPython!!!)

Feb 16, 2019

pyRevit 4.7.0-beta is out. Download the installer from here

A new version of the pyRevit CLI (v0.12.0.0) is included as usual.

New Features

Watch the video below for an introduction to the new features.


Thursday, February 14, 2019

Design Automation Sample – Debug Revit Plugin Locally

From the Forge website:

Design Automation - Debug Revit plugin locally

By Augusto Goncalves
January 29, 2019


Follow @augustomaia

DesignAutomationBridge is used by Design Automation for Revit to trigger the DesignAutomationReady event and used on the plugin to capture this event. It can also be used to emulate the environment and debug plugins locally. This video demonstrates how it can be done. This video uses the Learn Forge sample with 1 input file, 1 input JSON and 1 output, but the same approach can be used for different input/output specs.

Wednesday, February 13, 2019

Design Automation Sample – Check Models With Revit and Create BIM 360 Issues

From the Forge website:

Design Automation - Check models with Revit and create BIM 360 Issues

By Augusto Goncalves
January 31, 2019


Follow @augustomaia

This is a multi-API sample, which makes it super-interesting. And, if you remember right, it was presented at Forge DevCon 2018 Las Vegas keynote! The feature goal is to perform some basic check on BIM 360 files, if it finds anything, create an Issue.

Thursday, February 7, 2019

Design Automation Sample – Revit Project / Family / Template Upgrader

From the Autodesk Forge website:

By Zhong Wu
February 3, 2019


Follow @JohnOnSoftware

We used to have a Revit Desktop plugin to upgrade local Revit project/family/template to the latest version, but since we are now moving to the cloud, especially BIM360 is used more and more widely, a tool which can upgrade cloud based Revit project/family/template without a Revit desktop plugin would be very helpful, that's the Design Automation for Revit API does, and this sample does.

Wednesday, February 6, 2019

Preparing an Add-in for Forge's Design Automation for Revit

From The Building Coder:

Preparing a Revit Add-in for Design Automation

By Jeremy Tammik
February 05, 2019

Today I discuss the next step in my IfcSpaceZoneBoundaries project.

This step deals with a completely different aspect than the previous discussions: how to prepare a Revit add-in for use in the DA4R or Design Automation for Revit environment, which entered public beta just last week.

I spent a considerable part of last weekend getting the DA4R version ready for testing, and figuring out how to best handle it in the VS solution:

Context, Add-In Functionality and History

First, let's reiterate and update description of the architecture and data flow.

The add-in functionality that we wish to make use of in the DA4R environment consists in opening a Revit file, extracting the room and zone data stored in it and saving that to CSV.

The Revit document is actually an  .ifc.RVT  file created by the IFC linking-in process, currently executed on the desktop.



Read more on the The Building Coder website »

IfcSpaceZoneBoundaries – Retrieve Spaces and Zones and Their Boundaries From Linked IFC Files

From GitHub:

IfcSpaceZoneBoundaries

Revit C# .NET add-in to retrieve IFC spaces and zones and their boundaries.

Once tested and running, this add-in will be re-implemented as a Forge Design Automation for Revit app for use in the final workflow described below.

As described by The Building Coder discussing how to retrieve linked  IfcZone  elements using Python, IFC rooms and zones are represented by  DirectShape  elements equipped with custom shared parameters. These elements are generated when an IFC file is linked into a Revit project, however not when it is imported.

IfcSpaceZoneBoundaries retrieves the IFC rooms and zone elements generated by linking in an IFC file and exports a CSV file listing them, their relationships and boundaries as described below.

Room and Zone Properties

Room properties:
  • IfcExportAs = IfcSpace.INTERNAL
  • IfcGUID = 2QZ$T4_uPCWPddxgtStT47
  • IfcName = CHA
  • IfcPresentationLayer = M-AREA-____-OTLN
  • IfcPropertySetList = "Pset_SpaceCommon";"BI_Parameters";"BaseQuantities"
  • IfcZone = APT0102

AEC Hackathon 6.1 - Silicon Valley – Feb 22-24

From the AEC Hackathon website:

AEC HACKATHON 6.1 - SILICON VALLEY

FEBRUARY 22-24, 2019


SCHEDULE

Friday
18:00 – Doors open / Mixer (open to the public)
19:00 – Hackathon Kickoff
19:15 – Lightning Rounds & Team formations
22:00 – Adjourn

Monday, January 28, 2019

Introducing Design Automation Tutorial: AutoCAD, Inventor & Revit Engines

From the Autodesk Forge blog:

By Augusto Goncalves and Madhukar Moogala

January 28, 2019

Design Automation v3 went to Public Beta last month with AutoCAD, Inventor and 3dsMax, today also including Revit engine.

Now we're glad to include it on the Learn Forge tutorial, available in .NET. Everything with 5 steps under Modify your models section:
  1. Create a server
  2. Basic app UI
  3. Prepare a plugin
  4. Define an activity
  5. Execute workitem


Design Automation for Revit - Public Beta is Here

From the Autodesk Forge blog:

By Mikako Harada and Augusto Goncalves

January 28, 2019

The long-awaited Design Automation for Revit (aka Revit IO) has finally arrived!


Today we’re announcing the availability of Design Automation for Revit as a pubic beta. Using Design Automation, you can create, edit, and extract data from Revit models without a local Revit install. Because Design Automation is a cloud service, you can use it to create cloud-native applications that work with Revit data. Examples of ways you can use this API include: creating models automatically by entering parameters, validating specified design criteria and generating reports, and automatically modifying the model. It is also possible to extract model data not accessible with the Forge Model Derivative API.

Sunday, January 20, 2019

pyRevit v4.6.12 & CLI 0.6.0

From GitHub:

pyRevit 4.6.12 (CLI 0.6.0)

Jan 19, 2019

pyRevit 4.6.12 is out. Download the installer from here

  • Merged pyRevitLabs into pyRevit repo under dev
  • Resolved #478 #482
  • Added import schedule from CSV tool
  • Tested compatibility with Revit 2019.2

As always, each new pyRevit version also includes the pyRevit CLI [Command Line Interface] updates which for this release is CLI v0.6.0. Installer is provided on the same path.



There's more information available on GitHub.

Friday, January 11, 2019

Open Source CrossPlatform Repo – Develop for Revit/Dynamo & Rhino/Grasshopper from a Single Code Base

From GitHub:

CrossPlatform

This repo hosts the sample code written for the BiLT EUR 2018 Cross-platform development : from Revit/Dynamo to Rhino/Grasshopper and the web hands-on labs. The lab was accompanied by a lenghty handout that is available on the BiLT website for registered people.

Purpose

Be a reference, source of inspiration & education for others.

What is it

It's a sample of how to build cross-product libraries for AEC apps, with a focus on
  • re-using as much code as possible
  • demonstrating some SOLID principles in action
  • supporting as many apps as possible

Sunday, January 6, 2019

Backfill – pyRevit Versions 4.5, 4.6.5, 4.6.7, & 4.6.8

Earlier this week we posted about pyRevit version 4.6.9 Beta. We also mentioned that we hadn't posted about pyRevit previously since version 4.4.

Presented here for your convenience are the release videos and notes for the versions released between 4.4 and 4.6.9 Beta.

From the pyRevit blog:

pyRevit 4.5 Road Map

Oct 21, 2017



Saturday, January 5, 2019

Using the Revit API to Retrieve Rebars Attached to a Structural Element

From the The Building Coder website:

Retrieve Rebars Attached to Structural Element

Question: How can I get all associated rebars which attach to a structural element such as a column by picking that?

Answer: Jeremy initially suggested workarounds making use of filtered element collectors. Unfortunately, that was not very helpful in this case.

Happily, Einar Raknes came to the rescue pointing out the real solution for this:

You can use the  RebarHostData  class and the  GetRebarsInHost  method to retrieve all rebars associated with a rebar host.

To make sure you pick a valid Rebar Host; you can optionally create a selection filter for it like this:

  public class RebarHostSelectionFilter : ISelectionFilter
  {
    public bool AllowElement( Element e )
    {
      return null != RebarHostData
        .GetRebarHostData( e );
    }

    public bool AllowReference( Reference r, XYZ p )
    {
      return false;
    }
  }