Tekla - "open" api

How to Debug a Tekla Plugin Without Restarting Visual Studio (Tekla Open API Tutorial)

To my surprise, debugging is not a trivial exercise. Please watch the video to guide you on where to click etc.

Source code – github repository of the tekla beam plugin.

You need to follow the instructions listed here: https://developer.tekla.com/tekla-structures/documentation/debug-plugin-without-restarting-tekla-structures with the following notes and amendments:

  1. Add “set XS_PLUGIN_DEVELOPER_MODE=true” to the teklastructures.ini file and open Tekla Structures. – Trimble Documentation

In order to add the flag above, you need to locate the ‘teklastructures.ini’ file: on my PC: it is here: `D:\Program Files\Tekla Structures\2019.1\nt\bin` (refer to the above URL) – it might be in the C: drive on your computer.

Post Build Events

For more information on post build events: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2022

As you can see they are basically .bat files. Which means you can use “MS-DOS Batch File Language” or batch commands in there. The MSFT documentation suggests you can also use PowerShell (https://learn.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.4) script commands.

Here is the post build event I used:

The Tekla documentation is confused about where to paste the DLL – in some cases they say the ‘plugins’ folder, but in others, it is the ‘extensions’ folder. Yet elsewhere, different Tekla versions have different places where you can paste it. In my case, I have focused on the “extensions” directory.

Warning: If you paste it into multiple locations, you may find that you cannot hit break points! The above link suggests the files should be copied into the .environments/common/extensions folder. I am taking that to mean, in actuality: the `Environments/common/extensions` folder. I am not pasting it into the `plugins` folder, but have opted for the `extensions` folder.

If you want to use the plugins folder, follow these instructions: The dll containing the plug-in has to be copied into: \<Tekla Structures installation folder>\<version>\nt\bin\plugins. A sub-folder could also be created to store the dll. In my case, the plugin files are located here: D:\Program Files\Tekla Structures\2019.1\nt\bin\plugins\TestWPFBeamPlugin

Setting up a macro:

Run the UI macro (Reloadplugins.cs) in the Applications & Components catalog on the side pane. We must set it up. In my system, the location is at the following:

D:\Program Files\Tekla Structures\2019.1\Environments\common\macros

Go there and copy the code noted in the above git gist. You can add an image if you wish to.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *