Introduction ETABS API

 

This document illustrates how to connect to ETABS 2016 using the CSi Application Programming Interface (API) from a variety of clients.

The API is defined in the form of a .NET 4 dynamic link library, and is implemented by ETABS 2016. It can be accessed from .NET 4 and COM based clients.

Please note that ETABS 2016 must be installed both on the API client development machine, and on the client end-user’s machine.

Plugins can be developed to make use of the ETABS API from inside the program.

No license is required to use the API for plugin development, beyond having a valid license for ETABS. However, technical support for developing with the API is not included. For qualified users and third-party developers who would like technical support to help them build solutions and integrations with ETABS using the ETABS API, Computers and Structures, Inc. has created a subscription-based service, CSI Developer Network (CSIDN) (see http://www.csiamerica.com/support/csidn ). Developers must subscribe to CSIDN to be eligible for technical support for the ETABS API.

Plugins can be developed in a .NET compatible language (e.g. Visual Basic 2012, Visual C#, etc.) as a .NET DLL, or by using any language capable of creating a COM server compiled as a DLL. An example plugin project can be found at: https://wiki.csiamerica.com/display/kb/Sample+Plugin+1

The plugin must reference the ETABS2016 API library (either ETABS2016.DLL or ETABS2016.TLB ), which must be registered on the developer’s and the user’s systems. This registration takes place during the installation of ETABS. The ETABS2016.DLL is compiled as AnyCPU, hence it can be referenced by both 32bit and 64bit plugin projects.

Please note that COM plugins must be registered for COM on the user’s system, before they can be used in ETABS. This will require that the ETABS2016.DLL be present in the directory where the COM plugin is being registered. It is the plugin developer’s responsibility to instruct users how to install the plugin. Plugins should be installed only after ETABS has been installed. COM Plugin developers should consider that registering assemblies usually requires administrative permissions, which many users may not have.

Plugins compiled as 32bit will only work with 32bit ETABS, and likewise for 64bit.

For these reasons, we recommend that developers create .NET plugins that are compiled as “AnyCPU”. This will allow your plugin to be called from both 32bit and 64bit ETABS, and will not require registration.

Please make sure your plugin is stable, handles errors well, and does not cause any unintended changes to the user’s model.

We will attempt to maintain a stable interface in ETABS, however, that cannot be guaranteed, and updates to your plugin may be required for future versions of ETABS.

In your plugin, all functionality must be implemented in a class called cPlugin.

Class cPlugin must contain a subroutine cPlugin.Main that has two reference arguments of types ETABS2016.cSapModel and ETABS2016.cPluginCallback: VB Copy

Public Sub Main(ByRef SapModel As ETABS2016.cSapModel, ByRef ISapPlugin As ETABS2016.cPluginCallback)

Class cPlugin must also contain a function cPlugin.Info that has one reference argument of type String, and returns a Long (32-bit signed integer). The return value should be zero if successful. The string argument should be filled in by the function, and may be plain text or rich text. If this function is found and returns zero, the string will be displayed when the user first adds the plugin to ETABS. You can use this string to tell the user the purpose and author of the plugin. This is in addition to any information you may provide when the user executes the plugin. VB Copy

Public Function Info(ByRef Text As String) As Integer

ETABS2016.cPluginCallback contains a Finish subroutine that is to be called immediately before the plugin closes (e.g., if the plugin has a single main window, at the end of the close event of that form). It expects an error flag (0 meaning no errors) to let ETABS know if the operation was successful or not. ETABS will wait indefinitely for ETABS2016.cPluginCallback.Finish to be called, so the plugin programmer must make sure that it is called when the plugin completes. VB Copy

ETABS2016.cPluginCallback.Finish(ByVal iVal As Integer)

It is OK for cPlugin.Main to return before the actual work is completed (e.g., return after displaying a form where the functionality implemented in the plugin can be accessed through different command buttons). However, it is imperative to remember to call ETABS2016.cPluginCallback.Finish to return the control back to ETABS when the plugin is ready to close.

If you want to provide multiple functionality in your plugin, you can provide options for the user when subroutine Main is called. Options for the user to obtain information about the product, developer, technical support, and help should be provided. Support for your plugin will not be provided by Computers and Structures, Inc.

As currently implemented, the cPlugin object will be destroyed between invocations from the ETABS Tools menu command that calls it, so data cannot be saved. Adding Plugins

Adding a COM Plugin

To add a COM plugin to the Tools menu in ETABS, users will select “Add/Show Plugins” from the Tools menu. In the External Plugin Data form, they will type the name of the COM server DLL in the “Plugin Name” field.

Please note that ETABS will look for the plugin by Type Library name (usually the name of the plugin project), which you define when developing your COM server DLL. We suggest using a unique name such as ETABSPlugIn_xxx_yyy, where xxx is your (company) name, and yyy is the name to distinguish the plugin from other plugins that you develop, e.g. ETABSPlugIn_OmniCorp_Robo1.

The “Plugin Name” must exactly match the COM server DLL name. However, the plugin will appear under the Tools menu under the “Menu Text” name. That can be whatever the user likes, but it should be different for each plugin added.

The “Plugin Path” field should be left blank for COM plugins.

The “Status” field indicates whether the plugin was successfully located in the registry.

Adding a .NET Plugin

The process for adding a .NET plugin is much simpler. In the External Plugin Data form, the user should simply browse for and select the plugin .NET DLL. The rest of the fields will be automatically populated. It is still recommended that .NET plugins be given unique names.

This entry was posted in ETABS API. Bookmark the permalink.

Leave a Reply