FEMtools Script and API

Why Scripting?

Most mature and powerful applications today provide some level of scripting. This is because no matter how much functionality an application provides, and no matter how many options, there are always situations where users find themselves constrained by what developers chose to include. It can be very expensive to extend an application's functionality between releases, and to provide bug fixes and customization in fast and flexible manner.

Scripting allows users to create their own solutions and customizations based on the core functionality provided by the application.

What is FEMtools Script?

FEMtools Script is a rapid scripting language that is a standard part of FEMtools Framework and was first introduced in version 2.0. Its main purpose is to provide a means to customize or extend the software. Using FEMtools Script, a user can write a script to do just about any imaginable task.

At the heart of FEMtools Script is MathBasic, a proprietary scripting engine developed by Dynamic Design Solutions. The language syntax is derived from the Basic programming language, so a user does not need to learn another programming language than he probably already knows. MathBasic provides extensions of the Basic programming language to make it more suitable for mathematical programming.

FEMtools API

The FEMtools API is a library of functions that can be used from a script written in FEMtools Script to access the FEMtools database (FEA data, test data) or pilot external CAE or test tools.

Together with the support for math programming provided by FEMtools Script this provides all the tools to develop entire applications on top of the FEMtools environment. New ideas or specific needs can be quickly translated into working scripts. You will be writing and running scripts within hours.

Advantages of using FEMtools Script

FEMtools Script and the API provide all the power that one needs to develop entire applications on top of the FEMtools environment. With functions that provide access to the FEMtools internal database, support for math programming, and reusing components like data interfaces, graphics viewer, solvers etc, a script programmer can very quickly translate his ideas into working scripts.

Further advantages of using FEMtools Script are:

  • Faster development - Programming of new functionality is done outside the core FEMtools source code. No complete builds of the entire FEMtools program are required to use new additions. Script programmers can focus on their own source code only and on the interaction with the FEMtools database.
  • Solid code - The programming language and API provide a layer between the raw FEMtools database and applications. This reduces the risk of corrupting the database.
  • Development through partnerships - By using a common development platform and by working outside of the FEMtools source code, it becomes easier to develop new functions in collaboration with partners or subcontractors.
  • Easy to use and learn - If you already know Basic, Visual Basic or Visual Basic for Applications, FEMtools Script will be very familiar.

Specifications

FEMtools Script is an extension of the Basic programming language to make it more suitable for mathematical programming. It is a lighter language than Visual Basic because only functions are included that are useful for development of FEMtools related applications. This eliminates all unnecessary overhead. The main features of FEMtools Script are summarized hereafter:

  • Compiled byte-code execution for fast execution.
  • Integrated script editor and developer menu - FEMtools scripts can be edited and run from an integrated editor window, with color-coding of commands, functions, statements, etc. This facilitates development and debugging of scripts. Scripts can be compiled and run directly from the editor.
  • Mathematical programming - Advanced functions for mathematical programming (array operators, complex numbers, sparse matrices, regular expressions, set manipulation,...)
  • Functions for integrating with third party tools (interfacing with Matlab & Excel, launching and controlling subprocesses).
  • Functions for launching and controlling external tools.
  • Function for OLE automation.
  • User interface programming (graphical picking, dialog boxes,...).
  • Script encoding for protecting intellectual property or source code integrity.
  • Tools for error checking and debugging.
  • Detailed reference and programmer's manuals.

Support of sparse matrices

Many finite element-based applications involve the use of sparse matrices i.e. banded and sparsely populated matrices. The memory requirements of programs can therefore be significantly reduced by storing only the non-zero elements of these matrices and perform matrix operations directly on the sparse matrix. FEMtools includes the functions to define, delete and work with sparse matrices.

Support of regular expressions

To facilitate string and table parsing, several functions like Match, Replace, Search, and Split are available with support for complex regular expressions.

Functions for OLE automation

FEMtools Script programmers can take advantage of the power of OLE automation to extend the capabilities of an application on Microsoft Windows platforms. There are many potential applications for using OLE automation servers. Just imagine how you could integrate with, for example, Microsoft Office applications to use Word as a report writer, use PowerPoint to make presentations of you results or use Excel to post-process FEMtools tables as spreadsheets.

You can also extend the math programming functions of FEMtools Script by making use of the extensive library of math and graphics functions that are provided by general purpose programming environments like MATLAB and its many specialized toolboxes. By exploiting the MATLAB object model you can use all MATLAB functions from within FEMtools Script programs.

There is a growing number of  finite element programs that have been rewritten for the Windows operating system and support an object model. Data interfaces between FEMtools and these FEA solvers could be based on OLE automation.

By using OLE automation, you can seamlessly integrate external tools with your FEMtools Script programs without the user knowing that you are actually using for example Microsoft Word or MATLAB. This possibility holds a tremendous potential to increase the power, efficiency, speed and user-friendliness of your applications.

Availability

FEMtools Script is available on all platforms on which FEMtools is supported (64-bit Windows and Linux OS). Applications written in FEMtools Script are platform-independent and require a FEMtools 2.0 (or later) license to run the scripts.

Applications

Although the possibilities are endless, some typical applications of FEMtools Script are in development of:

  • Analysis plug-ins
  • Analysis customization and extensions
  • Pre- and postprocessing (FE and test data)
  • Data and analysis flow control (e.g. using external solvers)
  • Wizards
  • Data filters (e.g. test data)
  • Data interfaces
  • User interface and command language customization

Some Examples of Script-Based Applications

Examples of current FEMtools tools that were developed using FEMtools Script are:

  • Drivers for FE solvers
  • Pre- and postprocessor for SOL 200 analysis in Nastran
  • Interface with the FEMAP Neutral Format
  • Structural Dynamics Modification
  • A test data postprocessing program that imports data coming from a laser scanning device
  • Eigenvector orthogonality (FEA-FEA, FEA-Test and Test-Test) using reduced system matrices
  • MAC contribution analysis
  • Sensitivity matrix condition analysis
  • Material identification of composite plates using vibration analysis
  • Pretest analysis tools
  • A test data filter and averaging algorithm used to process noisy data