Tekla Structures Open API
Agenda
    §   What is the API
    §   Key areas of the API
    §   Examples of tools utilizing the key areas
    §   How can you utilize the API
    §   Strategy to start
    §   What are hardware and software needs
2            Tekla Open API: Overview & Getting Started
    What is the Tekla API?
3         Tekla Open API: Overview & Getting Started
    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.
4           Tekla Open API: Overview & Getting Started
    What is the Tekla Open API?
5        Tekla Open API: Overview & Getting Started
    Where is the Tekla Open API?
    § Included inside your Tekla Structures installation
6           Tekla Open API: Overview & Getting Started
    Who is using the Tekla Open API?
7        Tekla Open API: Overview & Getting Started
    Tekla Headquarters API Usage
8        Tekla Open API: Overview & Getting Started
    Tekla USA API Usage
    §   Auto Task Suite                                     §   Cover Dimension
    §   Detail Manager                                      §   Component Variables
    §   Construction Sequencer                              §   Drawing Break Line
    §   Bar Checker                                         §   Drawing Match Line
    §   Layout Point Applicator
                                                            §   Solid2Plates
    §   Concrete Tools
    §   Reference Model Importer                            §   Compare Objects
    §   Curved Stanchions                                   §   Copy Uda
    §   Hyperlink Manager                                   §   Uda List
    §   Workflow Manager                                    §   Anchor Rod tools
    §   Find Number                                         §   Base Plate Applicator
    §   Label Tool                                          §   Combine Part Marks
    §   Handrail Dimensioning                               §   Combine Rebar Marks
    §   Beam Marks                                          §   Crane Console
                                                            §   Data Exchanger
                                                            §   Plan Level Marks
9              Tekla Open API: Overview & Getting Started
     What is in Tekla Open API?
10         Tekla Open API: Overview & Getting Started
     Tekla Open API
     § Macro API
                                                            Macro
        Record and play commands and dialog                  API
        actions
     § Model API
        Create and modify model objects and       Model      Tekla     Drawing
        info                                       API    Structures     API
     § Drawing API
        Create and modify drawings and drawing
                                                            Plug-in
        objects                                               API
     § Plug-in API
        Create intelligent objects in the model
11    10/9/2017
12   Tekla Open API: Overview & Getting Started
     Tekla Open API - Macros                                                  Macro
                                                                               API
                                                                    Model      Tekla     Drawing
                                                                     API    Structures     API
     § Macro API                                                              Plug-in
                                                                                API
          – Record menu commands and dialog actions
          – Playback recorded macros
          – Edit and enhance recorded macros (C#)
                  § Combine with model and drawing API
          – Add macros to user menus, toolbars, shortcuts
                  (modeling & drawing editor macros are separate)
13    10/9/2017
     This is what the Model Macro Looks Like
     § Record a macro from the Advanced Features option in the
       Applications & components catalog.
     § Select the macro, right-click, select Edit in the context menu.
14   10/9/2017
     This is what the Drawing Macro Looks Like
     § Record a macro from the Advanced Features option in the
       Applications & components catalog.
     § Select the macro, right-click, select Edit in the context menu.
15   10/9/2017
     Macros Example “Swap Handles”
16        Tekla Open API: Overview & Getting Started
     Model API
17        Tekla Open API: Overview & Getting Started
     Tekla Open API - Model
                                                                        Macro
                                                                         API
     § Model API                                              Model
                                                               API
                                                                         Tekla
                                                                      Structures
                                                                                   Drawing
                                                                                     API
          – Connect to a running Tekla Structures model
          – Create, modify, and delete model objects                    Plug-in
                                                                          API
              § Read and write object attributes
              § Read and write user defined attributes
              § Get report properties for objects
          – Interact with the user
              § Get currently selected objects
              § Prompt user to pick objects and locations
              § Select and highlight objects for the user
          – Access catalogs (material, bolt, profile, etc.)
          – Create and manipulate model views
18    10/9/2017
     Structure of the Model API
19         Tekla Open API: Overview & Getting Started
                                                                             Macro
     Model API – Sample program
                                                                              API
     using System;
     using Tekla.Structures.Model;                                 Model      Tekla     Drawing
                                                                    API    Structures     API
     using Tekla.Structures.Geometry3d;
     namespace ConsoleApplication1
     {
         class Program                                                       Plug-in
                                                                               API
         {
             static void Main(string[] args)
             {
                 Model myModel = new Model();
                 Beam myBeam = new Beam();
                 myBeam.StartPoint = new Point( 0.0, 0.0, 0.0);
                 myBeam.EndPoint = new Point( 1000.0, 0.0, 0.0);
                 myBeam.Profile.ProfileString = "L45*45*9";
                 myBeam.Insert();
                 myModel.CommitChanges();
             }
         }
     }
20               10/9/2017
     RFI Manager
     § Manage RFI’s and link them with the model.
       – Link to IFC reference model objects as well as native objects
       – Colorize model based of RFI status
       – Automatically check for overdue status
       – Publish to HTML or FTP site or zip up and email
21           Tekla Open API: Overview & Getting Started
     Construction Sequencer
     § Define erection order
     § Create reports and animations
22          Tekla Open API: Overview & Getting Started
     Data Exchanger
23        Tekla Open API: Overview & Getting Started
     Compare Objects
     § Deep object comparison
     § Compare and highlight
24          Tekla Open API: Overview & Getting Started
25   Tekla Open API: Overview & Getting Started
     Tekla Open API – Plug-in
     § Plug-in API
          – Can create intelligent objects.
              § Connections and details.
              § Stairs, floor bays, handrails, and more.
          – Automatically loaded at startup.
              § Found in the component catalog.
          – Plugins can be associated to input.
              § Automatically adapt to changes in input objects.
          – Provides Tekla Structures UI.
              § Same INP as custom components.
              § Units, translations, access to catalog.
          – Plug-ins for drawings.
26   10/9/2017
     Tekla Open API - Drawing
     § Drawing API
          – Access the drawing list.
          – Create, modify and delete.
                 § GA drawings and views in any drawing.
                 § Dimensions, text and other basic objects.
          – Interact with the user.
                 § Get currently selected drawing objects.
                 § Prompt user to pick objects and locations.
                 § Select and highlight objects for the user.
          – Access model objects from the drawing.
                 § Select the parts found in a drawing in the model.
27   10/9/2017
     How a Plug-in is Structured
     § New Plug-in/connection started
        – Constructor method runs
        – Input prompted from user
            § Applied values taken from dialog
            § Plug-in Run() when input complete
        – Both the StructuresData and the Input are stored to the
          model database
28           Tekla Open API: Overview & Getting Started
     Plug-in API examples
29        Tekla Open API: Overview & Getting Started
     Plug-in API examples
30        Tekla Open API: Overview & Getting Started
31   Tekla Open API: Overview & Getting Started
     Common Use Cases
     § Drawing API
        – Access the drawing list.
        – Create, modify and delete.
            § GA drawings and views in any drawing.
            § Dimensions, text and other basic objects.
        – Interact with the user.
            § Get currently selected drawing objects.
            § Prompt user to pick objects and locations.
            § Select and highlight objects for the user.
        – Access model objects from the drawing.
            § Select the parts found in a drawing in the model.
32           Tekla Open API: Overview & Getting Started
     Drawing API examples
33        Tekla Open API: Overview & Getting Started
     Drawing API examples
34        Tekla Open API: Overview & Getting Started
     Drawing Plug-in API examples
35        Tekla Open API: Overview & Getting Started
     Drawing Plug-in API examples
36        Tekla Open API: Overview & Getting Started
     Plan to Utilize the API
37         Tekla Open API: Overview & Getting Started
     Why Utilize the Tekla Open API
38         Tekla Open API: Overview & Getting Started
     Strategy Overview
39        Tekla Open API: Overview & Getting Started
     Tekla Open API - Required Skills
     § Basic understanding of Tekla Structures
           – Model creation basics.
           – Part creation, alignment, and operations.
           – Understanding of Tekla Structures objects.
     § Understanding/Experience with .NET/COM
       programming language
           – C#, VB.NET, J# etc.
           – English documentation.
40    10/9/2017
     Hardware and Software Needs
     §   Tekla Structures
     §   Windows 7, 8.1, 10
     §   .NET Framework 4.5
     §   Visual Studio 2015 Professional
     §   Pick a Language (Suggest C#)
     §   Tutorial Material
         – Videos, YouTube
         – Books
     § Download Startup Package from warehouse
         – Search “Open API”
41            Tekla Open API: Overview & Getting Started
     Hardware and Software Needs (Long Term)
     § For debugging and more efficient long term development
       Visual Studio Professional Edition is recommended
     § Packaging software: Windows Installer, Installshield,
       InstallAware, Advanced Installer, ...
        – Create MSI or exe installers
        – Easy to deploy (unattended and silent)
        – Version control
     § Source Code Management System
        – E.g. Git, Stash, Seapine SCM
        – Code history, branch management, automatic builds
42           Tekla Open API: Overview & Getting Started
     Set Goals for Long and Short Terms
     § Support from management
     § Realize short term investment and benefits versus the
       bigger, long term goals that can be reached
     § Get support structure for testing, training, and releasing
     § Review existing process, asking what can be improved as
       you go, often workflows can be improved rather than add
       more automation to existing process
     § Make sure to involve peers in documentation and review
       process
     § Document and agree on stages for development
43           Tekla Open API: Overview & Getting Started
     Target Specific Areas For Development
     § Work with peers and identify key bottle neck areas in
       current process where software automation can help in
       productivity.
        –   In some cases this can be simple macros to automate a set of tasks...
        –   Direct export to ERP solution or in-house database?
        –   Drawing dimensioning tools?
        –   Process management tools?
     § Document what you want to accomplish on paper, include
       peer review discussing risks and rewards.
     § Check to be sure there is not already an existing solution on
       extranet.
44            Tekla Open API: Overview & Getting Started
     Create Basic Documentation
     §   Why do this?
          –   Current problem / need / gap: More accurate and faster
              field layout on slab boundaries
          –   How does it solve or partially address the pain?: Quicker
              way to place layout points for slab edges and openings
     §   For whom do we do this?
          –   Applicable customer: Segments – Concrete Contractors,
              SPGC
          –   User types or roles: Survey guys, Field Engineers
                                                     ▪   Slab Plug-in – applies layout points along grid boundaries
                                                               ▪   Set settings in plug-in UI
                                                               ▪   Pick Slab
                                                               ▪   Apply points along slab perimeter and openings
                                                               ▪   Options:
                                                                      ▪ Top and bottom
                                                                      ▪ Target spacing
                                                                      ▪ Always a point at a corner
45                Tekla Open API: Overview & Getting Started
     Setup
     § Incorporate good coding techniques
     § Use good MsBuild structure for version control
     § Adopt a source code management system
     § Reuse code in company toolkits
     § Involve users in development through communication and
       suggestion channels
     § Keep track of feature requests and bugs from users
46           Tekla Open API: Overview & Getting Started
     Thank You
47        Tekla User Days 2015