Tekla plugins
Usage tracking for Tekla Structures plugins and their dialogs, on top of Plugboard.Tracking.Core. Set up Plugboard.Tracking.Core first (config file, C# 9); this package adds run and dialog tracking through one static class, TeklaTracking.
Model and drawing plugins
Section titled “Model and drawing plugins”Keep PluginBase (or DrawingPluginBase) and put Run’s body into TeklaTracking.Run:
using Plugboard.Tracking.Tekla;
[Plugin("Rebar Exporter")][PluginUserInterface("RebarExporter.MainForm")]public class RebarExporter : PluginBase{ private readonly StructuresData _data;
public RebarExporter(StructuresData data) { _data = data; }
public override List<InputDefinition> DefineInput() { ... }
public override bool Run(List<InputDefinition> Input) => TeklaTracking.Run(this, Input, () => { ... // the plugin's work, as before return true; });}The plugin and its dialog must inherit Tekla’s own base classes directly. Tekla reads the plugin DLL without loading it, and only recognises:
- a plugin whose base class is
PluginBaseorDrawingPluginBase; - a dialog whose base class is
PluginFormBaseorPluginWindowBase.
It can’t follow a base class kept in another DLL, so a plugin or dialog with one isn’t loaded, and Tekla shows no error.
Each run sends:
| Event | Default | Data |
|---|---|---|
plugin_run_started |
off | inputCount, pluginData |
plugin_run_completed |
on | durationMs, success, inputCount, exceptionType and exceptionMessage when the run threw, pluginData |
success is false when the work returns false or throws. Exceptions are re-thrown unchanged after they were tracked, so Tekla behaves as before. Tracking never makes a run fail.
{ "durationMs": 1250, "success": true, "inputCount": 1, "pluginData": { "Profile": "HEA300", "Material": "S355", "Offset": 50 }}Plugin data
Section titled “Plugin data”With "pluginData": { "enabled": true } in plugboard-tracking.json, run events include what the user entered in the plugin dialog. That’s the fields of the plugin’s data class marked with [StructuresField], by field name. It’s off by default.
- Finding the data: the data object is found automatically. It’s the first field (or auto-property) of the plugin holding an object with
[StructuresField]fields.- When the data lives elsewhere, pass it:
TeklaTracking.Run(this, Input, () => ..., pluginData: _settings). - An object without
[StructuresField]fields is sent with its public properties and fields.
- When the data lives elsewhere, pass it:
- Choosing fields:
includeFields/excludeFieldschoose fields by name, e.g."excludeFields": ["Password", "Comment"]. - Empty values: Tekla’s “no value” for int and double fields is sent as
null. - Size limit: fields that don’t fit in
maxSizeBytes(default 16 KB) are left out, andpluginDataTruncated: trueis added. - Errors: if reading the data fails, the run is tracked without it and the error is logged.
Plugin dialogs
Section titled “Plugin dialogs”Call TeklaTracking.TrackDialog(this) in the dialog’s constructor. It works the same for a WinForms PluginFormBase and a WPF PluginWindowBase. It sends:
form_opened;form_closed(off by default);button_clickedfor the dialog’s buttons, including Tekla’s OK / Apply / Modify / Get / On/Off / Cancel buttons.
public partial class MainForm : PluginFormBase // or MainWindow : PluginWindowBase{ public MainForm() { InitializeComponent(); TeklaTracking.TrackDialog(this); }}WPF dialogs are usually tracked even without the call, as long as the plugin references WPF and its assembly is set up. The call makes sure of it.
Only clicks are recorded, never what is typed into the dialog. See Forms, windows and buttons.
Custom events
Section titled “Custom events”From anywhere in the plugin:
PlugboardTracker.Track("export_done", new { files = 12, format = "IFC" });Tekla versions
Section titled “Tekla versions”One package works with Tekla Structures 2021 and every later version:
- API version: it’s compiled against the Tekla 2021 Open API and only uses members that exist in every later version. CI also compiles it against the newest Tekla API.
- Dependencies: its Tekla dependencies are compile-only, with an open range (
>= 2021.0.0), and no Tekla assemblies are copied to the plugin’s output. The plugin’s own Tekla package references, e.g.Tekla.Structures.Plugins2025, take precedence. - At run time: Tekla redirects older Open API versions to its own (
oldVersion="0.0.0.0-<current>"inTeklaStructures.exe.config). So the samePlugboard.Tracking.Tekla.dllloads in every Tekla version the plugin runs in.