Skip to content

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.

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 PluginBase or DrawingPluginBase;
  • a dialog whose base class is PluginFormBase or PluginWindowBase.

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 }
}

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.
  • Choosing fields: includeFields / excludeFields choose 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, and pluginDataTruncated: true is added.
  • Errors: if reading the data fails, the run is tracked without it and the error is logged.

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_clicked for 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.

From anywhere in the plugin:

PlugboardTracker.Track("export_done", new { files = 12, format = "IFC" });

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.Plugins 2025, take precedence.
  • At run time: Tekla redirects older Open API versions to its own (oldVersion="0.0.0.0-<current>" in TeklaStructures.exe.config). So the same Plugboard.Tracking.Tekla.dll loads in every Tekla version the plugin runs in.