Professional Documents
Culture Documents
ABC of TeklaPad (Interacting With Tekla Database)
ABC of TeklaPad (Interacting With Tekla Database)
• 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
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:
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…
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….
• “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")
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…
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