MultiTekla is like a multi-tool, but for Tekla. It utilizes the internal API of Tekla Structures to access and manipulate models in a headless mode.
MultiTekla is in alpha and may contain bugs and missing features. APIs, commands and plugins can be subject to change in any subsequent commit.
Make sure .NET 8.0 and .NET Framework 4.8 are intsalled.
- clone MultiTekla repository using git
- cd in directory with cloned project
- Run
dotnet restore
- Run
dotnet build -f net48 -c Debug --no-restore
Build output would be in src/MultiTekla.CLI/bin/Debug/net48
.
Since my main PC is on Linux, my development workflow includes the development and testing of commands that are not related to Tekla Structures binaries on Linux, so the project is a multi-target for .NET 8 and .NET Framework 4.8.
Testing of commands accessing Tekla Structures binaries is performed on Windows 10 in virtual machine.
MultiTekla has a number of built-in plugins, and this number is gradually increasing.
./MultiTekla.CLI headless perf "my-big-model"
./MultiTekla.CLI model create "test-model" -s "fast-server"
./MultiTekla.CLI model run macro "my-empty-model" -r "my-macro"
./MultiTekla.CLI export ifc2x3 "my-model" -o ".\IFC\my-model.ifc"
-
Create project for your plugin:
dotnet new classlib -f net48 --langVersion Latest -o src/<YOUR PLUGIN NAME>
-
Add a reference to the library with contracts
dotnet add src/<YOUR PLUGIN NAME> reference path/to/MultiTekla.Contracts.csproj
-
Add a reference to the Tekla Structures NuGet (for example, Tekla.Structures.Model version 2022.0.10715)
dotnet add src/<YOUR PLUGIN NAME> package Tekla.Structures.Model -v 2022.0.10715
-
Create a plugin class and inherit it from PluginBase
public class TestPlugin : PluginBase { protected override void Run() => new TSM.Model().GetConnectionStatus(); }
-
Create a command class and inherit it from CommandBase
[Command("test", Description ="just a test")] public sealed class TestCommand : CommandBase<TestPlugin> { [CommandParameter(0, Name = "MODEL NAME")] public override string? ModelName { get; init; } [CommandOption("config", 'c', Description = "Config for headless run")] public override string ConfigName { get; init; } = "default"; public override bool IsHeadlessMode { get; init; } = true; protected override ValueTask Execute(IConsole console, TestPlugin plugin) { plugin.RunPlugin(); return default; } }
For more detailed documentation on commands, see the CliFx repository.
-
Build your project
dotnet build -c Debug -f net48
-
Copy result
<YOUR PLUGIN NAME>.dll
toplugins
folder of MultiTekla.CLI -
Run
MultiTekla.CLI -h
and make sure that your plugin is discovered and displayed in the help section