Tekla Open API skill: why AI invents API that doesn’t exist

Ask an AI for code that runs when the Tekla model is saved, and you might get events.ModelSaved += OnModelSave;. It reads well. It doesn’t compile. The event is called ModelSave.

That one is harmless, because the compiler catches it. The guesses that compile are the expensive ones, and both kinds come from the same place.

The AI writes the name a .NET library would have

A language model writes the most likely next word. Most .NET events are named in the past tense: Saved, Loaded, Changed. So when the model doesn’t know Tekla’s name, it writes the one a typical library would use. Plausible. Wrong.

Tekla makes it worse in two ways. There’s far less public Tekla code to learn from than general .NET code. And the code that does exist spans fifteen years of versions: the single TeklaOpenAPI package that was replaced in 2021, the GAC that disappeared in 2024, members that only exist from 2026. A forum snippet rarely says which version it was written for, so the model mixes them freely.

It compiles in the agent’s head, not in Visual Studio

The first defence isn’t knowledge. It’s the build. Let the agent compile against the NuGet packages of the Tekla you run, and an invented name becomes an error it can read itself:

var events = new Events();
// events.ModelSaved += OnModelSave;   // CS1061: 'Events' does not contain a definition for 'ModelSaved'
events.ModelSave += OnModelSave;       // the real name, 2024 to 2026
events.Register();                     // forget this and the handler never fires. No error either.

Without the build, the agent can’t tell its guess from the API. With the build but without a reference, its fix is another guess: ModelSaving, OnModelSaved, a timer that polls the model. And look at the last line. Leave out Register() and everything still compiles. Nothing happens on save, and nothing tells you why.

The guesses that compile cost more

A compiler checks names and types. It doesn’t check meaning. GetReportProperty answers in millimetres, and everyone reading the result thinks in metres:

double area = 0, volume = 0;
part.GetReportProperty("AREA", ref area);       // mm²: a 6 m wall panel, 3600*160, reads 46,272,000
part.GetReportProperty("VOLUME", ref volume);   // mm³: the same panel reads 3,455,999,999.9999995

Both lines compile. Both return true. One number is a billion times bigger than anyone reading m³ expects, and it lands in a pour volume or a take-off, not in an error list. Read WEIGHT into a string and you get false, which compiles too. GetReportProperty has more of these.

A skill is the reference the agent reads before it writes

An agent skill is a folder of plain text files. The agent loads it when the task matches the skill’s description, here anything that mentions Tekla. Mine looks like this:

tekla-open-api/
  SKILL.md                                 which file to read for which task
  references/error-index.md                error text or symptom → cause and fix
  references/report-properties-catalog.md  every property name, its type and its unit
  references/events.md                     the real event names, and Register()
  documentation/                           Tekla's API reference, one file per type
  samples/                                 drop-in helpers, compiled on every version

The point isn’t that the agent knows more. The point is that it looks the name up instead of predicting it. The CS1061 above sends it to the events reference, and it comes back with ModelSave, not with another guess. VOLUME comes back with its unit written next to it.

The rules in a skill are code too, so I test them like code. Every snippet in it, over 400 of them, is compiled exactly as printed against the Tekla 2024, 2025 and 2026 packages before each release. A wrong rule in your notes gets copied once. A wrong rule in an AI agent’s instructions gets copied every time it writes code.

What a skill can’t fix

It isn’t magic, and it doesn’t turn the agent into a Tekla developer.

  • Your firm’s names. It knows the API, not your UDA names or which property your production planning reads.
  • Anything outside its references. Ask about an area it doesn’t cover and the agent is back to guessing from the forum mix.
  • Meaning. It can tell you VOLUME is mm³. It can’t tell you whether your take-off needs VOLUME_NET or VOLUME_GROSS.
  • Your model. The agent’s tests run on clean examples. A real model still needs a person who looks at the result.

Telling a guess from the API

  1. Build against the NuGet packages of the Tekla you run, and let the agent read the errors.
  2. Look names up in a reference, never in the chat history.
  3. Check the bool every Get… returns. false isn’t 0.
  4. For a property you haven’t used before, print the raw value once and check its unit.
  5. Compare one number with Tekla’s own report before you trust the rest.

The skill comes in the box. Every course buyer gets the Tekla Open API skill, watermarked to them, and every update to it. The course teaches the habits around it: brief the agent, let it build, read what it wrote, and check one number against Tekla’s own report before you trust the rest. The free Foundations lesson shows why a curated skill stops the guessing.

Tekla Open API Course: build real Tekla tools with an AI agent →

Related: AI agent for Tekla Open API: why a chatbot isn’t enough · GetReportProperty: types, units and the silent false · Tekla UDAs from C#: why GetUserProperty returns false

Tags

Greg Olszewski

Greg Olszewski builds Tekla Open API tools: Grasshopper Tekla Drawing Link, Smart Select, Tekla Lookup. Ten years of C# on Tekla Structures, day job in precast. Now he teaches engineers to build their own.

About Greg ›

COURSE

Build your own Tekla tools

Learn the Tekla Open API in C#, from your first plug-in to tools your team actually uses.

See the course ›