You are on page 1of 25

of TeklaPad

• Interacting with
Tekla Database

 No Experience Required…
Content

Introduction
Basic Concepts
Advanced Concepts
Beyond this Tutorial

2
Introduction (1/7)
The first tab of TeklaPad is for interacting with database of Tekla Structures via
C# and API power. It’ll works in all versions of Tekla Structures without need to
any additional configuration and without need to Visual Studio. Just select
objects from Tekla model (or drawing) and run your query (or command) to get
the result…

3
Introduction (2/7)
Generally, You can use it for:
1- Getting “console” output (using as a simple learning tool)  Console

4
Introduction (3/7)
2- Sending data to Tekla Model / Drawing  Command

You see the “Dark” Theme in this example 5


Introduction (4/7)
3- Getting data from Tekla Model / Drawing  Query

You see the “Simplified UI” in this example 6


Introduction (5/7)
You can also filter resultant data and/or get total values…

7
Introduction (6/7)
After running queries or commands, You’ll get syntax errors (if any) in the
output area :

8
Introduction (7/7)
Finally, you can easily export the result in different formats…

9
Basic Concepts (1/8) : Database
“Database” is a predefined variable which is responsible for storing the current
user selection in Tekla model:

10
Basic Concepts (2/8) : DrawingDatabase
“DrawingDatabase” is a predefined variable which is responsible for storing
the current user selection in Tekla drawing:

11
Basic Concepts (3/8) : Query Body
C# query syntax (LINQ) is very similar to SQL (Structured Query Language).
The LINQ (Language Integrated Query) syntax starts with from keyword and
-most of the times- ends with select keyword.
Conditions are defined by where keyword and field (column) names are
defined with let keyword:

12
Basic Concepts (4/8) : Query Structure
In general, creating a query with LINQ syntax contains three basic steps:

1- Defining the original data source


(Database / DrawingDatabase/…). This step
is done by using "from" keyword (each row of
table represents a Tekla object ).

2- Filtering on rows and choosing only some


rows by putting some conditions on row types
and row properties. (Will be discussed more
on the next page…)

3- Filtering on columns and choose only


some defined columns and selecting the
new table from original data table. This
step is typically done by using "select"
and "new" keywords.
13
Basic Concepts (5/8) : Row Filters
Let's take a closer look at the second step…There are two levels of filtering:
2a- "Type" filtering level: This is usually done by using “OfType<T>” method.

2b- "Property" filtering level: Choosing rows by row properties. This is usually
done by using "where" keyword in LINQ syntax

(2a) (2b)

Database
Filtering on database rows (by “Type” and “Prop.”)
14
Basic Concepts (6/8) : Query Steps…

Now let's see these 3-steps in a simple practical example:


1- Defining data source.
2- Filtering on rows (by “Type” and “Property”).
3- Filtering on columns (and selecting new data).

select new
(2)

(3)
15
Basic Concepts (7/8) : Road Map…

16
Basic Concepts (8/8) : Query VS Method syntax
LINQ comes in two syntactical flavors: The “Query” and the “Method” syntax.
Here is a side-by-side comparison and as you can see, The results are similar:

17
Advanced Concepts (1/5) : Scope…
TeklaPad works on "Method" scope in its first tab. So, you can specify the final
result (for showing in data table) with “return” statement (as the method output).
So, you just have to write the main part of your code (query / command) and all
other configurations (Classes, References, Namesapces,...) will be handled
automatically by TeklaPad:

18
Advanced Concepts (2/5) : Manage
Once the connection established, The common libraries (and
default namespaces) will be used automatically. But it's also
possible to add/remove additional libraries (or namespaces)
to extend capabilities:

19
Advanced Concepts (3/5) : Extended API
When you use the first tab of TeklaPad, It acts as an additional layer over standard API,
So it contains some extended features (xAPI) which are not available in original API of
Tekla Structures. For example, "GetTeklaReport" or "GetTeklaPullOut“ or “GetIfcData”
or… functions are not available in original API, whereas they're accessible in first tab of
TeklaPad to make workflow more efficient….

Using xAPI features is not mandatory.


User Manual
You can use pure Tekla API as well.

OK. Now let’s explore some xAPI highlights…


20
Advanced Concepts (4/5) : xAPI Highlights…
• “GetTeklaPullOut”
Returns pull-out picture for numbered rebars:

• “ReadFromDXF”
Converts the DXF entity (or entities) to native Tekla objects:

21
Advanced Concepts (5/5) : xAPI Highlights…
• “IsLike”
Performs pattern matching that also supports wildcards (e.g. * and ? )

• will find everything with 2 characters in front of a ’4’ like w14, w24, HF4
{Target}.IsLike("??4")

• will find any text prefixed with b/


{Target}.IsLike("b/*")

• will find texts 0-9 prefixed with b/


{Target}.IsLike("b/#")

• will find texts 1,2,3 prefixed with b/


{Target}.IsLike("b/1, b/2, b/3")

AND MANY MORE….

Refer to: User Manual > Tab-1> C# basics > Extended API
22
Beyond this Tutorial (1/2)
This Tutorial has not tried to tell you everything. It has rather tried to give you
grounding in the basic concepts and enough exposure to real examples for you
to now take yourself forward…

• Find more about hints, tips and features via [INTRO]

23
Beyond this Tutorial (2/2)
• There is also an online library that contains many examples...

• YouTube Playlist:

24
Thanks for Watching!
 Available on Tekla Warehouse

25

You might also like