You are on page 1of 15

Tekla Open API

Introduction to the Tekla Open API

Christopher Keyack Solutions Team Manager

Agenda
Define the Tekla Open API
What you need to get started
How to get to the API
Where to go to get help
Tekla Extensions
Record a simple macro
Questions and answers

[Date]

What is the Tekla Open API?


API = Application Programming Interface.
Customization of Tekla Structures without having to
change the core.
Utilizing Industry standard Microsoft .NET technology.
Creates a competitive advantage at lower cost.

[Date]

What is the Tekla Open API?

(*.cs)

Create, Modify, Delete,


Extract Information,
Set User Attributes,
Navigate, Call Macros.

Recorded scripts calling commands in the


Tekla Structures interface for Model and
Drawings. (C#, API Library can be used here)

(*.exe)
Tools that connect and interact with Tekla Structures

(*.dll)
[Date]

Parametric, run inside Tekla Structures, fast.

What do you need?


Tekla Structures
Windows XP, Vista, or 7
.NET Framework 4.0
Visual Studio 2010 Express (Free)
Pick a Language (Suggest C#)
Tutorial Material
Videos, Youtube
Books

Download Startup Package from


extranet.
Product>Open API

[Date]

Where is the API?


Included inside your Tekla Structures Installation
Tools>Macros

C:\Program Files\Tekla Structures\


17.0\nt\bin\plugins

Tekla.Structures.dll
Tekla.Structures.Model.dll
Tekla.Structures.Drawing.dll
XS_MACRO_DIRECTORY
C:\ProgramData\Tekla
Structures\17.0\environments
\usimp\us_common\macros\
modeling or
drawings

Tekla.Structures.Dialog

Tekla.Structures.Catalogs

Tekla.Structures.Datatype

Tekla.Structures.Analysis

Tekla.Structures.Plugins
[Date]

Where to go to get Help


Tekla Extranet Discussion Forums is the primary channel

[Date]

Tekla Extensions
Download, Rate, and Comment on the Tekla Extranet

[Date]

Lets Record a Model Macro


Save away an object representation
status that you typically use.
Tools>Macros.
Type in a macro name like
Color_ThisStatus.
Press Record.
Load Object Representation dialog
box, your saved settings, then modify.
Cancel the object rep dialog box.
Press Stop on the Macro Dialog box.
Run will run the macro you recorded.
[Date]

This is what the Model Macro Looks Like


Select the macro, and press the Edit button in the
Tools>Macros dialog box.

10

Lets Record a Drawing Macro


Select a Part Mark in Drawing.
Tools>Macros.
Type in a macro name like Add CTRD
Suffix.
Press Record.
Open part mark properties.
Add text field of (CTRD) to Elements
in Part Mark dialog.
Press Modify, then Cancel on the Part
Mark Dialog.
Press Stop on the Macro Dialog box.
[Date]

Run will run the macro you recorded.

11

This is what the Drawing Macro Looks Like


Select the macro, and press the Edit button in the
Tools>Macros dialog box.

12

Make a Toolbar Icon for your Macro


Bitmap with same name in
same directory where *.cs
macro file is.
XS_MACRO_DIRECTORY
C:\ProgramData\Tekla
Structures\17.0\environment
s\usimp\us_common\macros\
modeling or drawings

Note: to create drawing


macro toolbars, the
toolbar has to be
created in the model so
the macros and bitmaps
need to be in both the
modeling and drawings
folder.

Size should be 16x16 pixels

If you use large icons, then


also create a bitmap with
macro name_big.bmp
Size should be 24x24 pixels

Tools>Customize
Create a user defined
toolbar, add your macros.

Note: May need to reopen Tekla Structures to see icons

13

Hints and Tips with Macros


Cant record picking points, parts, or locations on the screen.
Record Macros by activating commands primarily from the menu structure or
toolbars not the right click menu in the model.
Have objects selected first if going to modify or do something to them.
Select Filtered objects using Edit>Select All Objects in the Model.
Use System.Windows.Forms.MessageBox.Show(Your Text); to pause your
macro and wait for a user to do something.
Recorded macro lines cant be directly used inside external application code.
Macro can be called inside of a Tekla External Application but not inside plugins
Tekla.Structures.Model.Operations.Operation.RunMacro(MacroName.cs); use
the *.Operation.IsMacroRunning(); Method to check if a macro has completed.
Tekla API Library code that you use in External applications can be used inside
of macros.

14

Thank You
Questions and Answers

15

You might also like