Back to Home

Renga API and AI Agents for BIM

The article describes the integration of AI agents with Renga API via COM for BIM task automation. It covers comparison with Revit, Python library py_renga, agent pipeline, and STDL family generation. Code examples and key advantages are provided.

AI Agents Master Renga API: COM and Python
Advertisement 728x90

Integrating AI Agents with Renga API for BIM Process Automation

Renga API uses a COM architecture, allowing AI agents to control the application externally without compiling plugins. Unlike Revit API, which loads code into an AppDomain, Renga supports external calls via the ProgID "Renga.Application.1". This simplifies integration with Python scripts and agents, providing access to models, objects, and geometry.

The py_renga library provides core modules for COM interaction and skills for agents. Its structure includes local documentation from RengaCOMAPI.tlb, object reflection, and ready-made functions for opening projects and creating elements.

Comparing Renga API and Revit API

| Aspect | Renga API | Revit API |

Google AdInline article slot

|--------|-----------|-----------|

| Core Technology | COM (external interface) | .NET (AppDomain) |

| Deployment | DLL or Python scripts | DLL only |

Google AdInline article slot

| Languages | C++, C#, Python | C#, Python (via wrappers) |

Renga's COM approach allows launching the application and managing it as an external process. Python is natively supported through the type library, without additional tools. SDK v2.46 includes C++ headers, .NET assemblies, examples in three languages, and a tlb file for interop.

For AI agents, key scenarios involve external automation via ROT and interface reflection. The agent analyzes object dumps, matches them with documentation, and generates scripts.

Google AdInline article slot

Connecting to Renga via Python

Minimal code to launch and work with a model:

import comtypes.client

PROG_ID = "Renga.Application.1"
app = comtypes.client.CreateObject(PROG_ID)
app.Visible = True

result = app.CreateProject()
if result != 0:
    raise RuntimeError(f"CreateProject failed with code {result}")

project = app.Project
model = project.Model
objects = model.GetObjects()
print(f"Objects count: {objects.Count}")

for index in range(objects.Count):
    obj = objects.GetByIndex(index)
    print(getattr(obj, "Name", None))

This script creates a project, extracts a collection of objects and their properties. For agents, dump_object(com_object: Any) -> Dict[str, Any] is implemented, returning interfaces, properties, methods with types and values.

AI Agent Workflow Pipeline

The agent follows a cycle:

  • Retrieves a skills catalog via get_skills_catalog().
  • Applies a ready-made skill or dumps an object.
  • Analyzes the dump, searching for interfaces in RengaAPI_Docs.
  • Generates and tests a script.
  • Iteratively fixes errors until success.

Implemented skills include:

  • Connecting/disconnecting the application;
  • Opening/saving projects;
  • Reading/writing object parameters;
  • Creating/deleting elements;
  • Dumping geometry and reflection.

Examples: the agent generates walls from text, calculates volumes/areas, and creates parametric objects.

RengaSTDL: Code-Based Family Generation

RengaSTDL is an SDK using Lua + JSON for parametric templates (.rst). The agent generates a Lua script with geometry, a JSON specification, and compiles it via RstBuilder.exe.

Process:

  • Prompt with requirements (dimensions, parameters).
  • AI writes Lua code and JSON.
  • Compilation into .rst.
  • Import into Renga.

Example: a chair with parameterized height/width, generated from a description. Lua allows computed geometry without a graphical editor, lowering the barrier for prototypes.

Documentation and examples in RengaSTDL_Docs/ are integrated into the library for reflection.

Key Takeaways

  • COM interfaces enable external control without compilation, ideal for AI agents.
  • Python skills with dumping and reflection accelerate API learning.
  • STDL with Lua allows generating families from requirements without manual coding.
  • Agent pipeline: analysis → generation → test → iteration reduces plugin development time.
  • Open-source py_renga repository with AGENTS.md for quick start.

— Editorial Team

Advertisement 728x90

Read Next