Nastran or Samcef with Python, Ruby, VBA, C#, excel...

A Library distributed under LGPL license that allows you to automate the post-processing of Nastran and Samcef  finite element results

FeResPost library System requirements Documentation Downloads Install Mailing list Examples Videos License

FeResPost library description

FeResPost library

FeResPost is a  library that allows you to read Nastran and Samcef finite element models and results, and to automate post-processing operations.
Depending on the programming language being used (Ruby, Python, VBA, C#, C++...), FeResPost allows to program a wide variety of programs ranging from small scripts to large programs containing user-defined Classes and Modules, and allow to perform complex operations.
(The scripting capability of FeResPost can be very useful to automate simple tasks as automating the creation of connections, modifying element properties, creating temperature or force fields...)

Structural analysis

The structure analysis of complex structures often leads to repetitive tasks. This is related to :
This explains why engineers involved in structural analysis are often also programmers. The need for automation leads them to use spreadsheets, use third party programs to accelerate the justification, or write its own post-processing programs. FeResPost can help in the development of these small programs!

How can FeResPost help?

The main purpose of the program is to download and manipulate Result entities in order to calculate margins of safety. Possible operations that can be performed on ``Result'' objects are, for example :
So far, these results can be read from Nastran XDB or OP2 files, or from Samcef DES/FAC files. The corresponding finite element models can also be important from Nastran Bulk BDF files, or Samcef Bacon DAT files.
The groups of elements and nodes can be read from Samcef DAT or Patran session files. Manipulation of these Groups, by addition, substraction, intersection, associations are possible.
FeResPost allows the simultaneous manipulation of several models by defining several NastranDb  and SamcefDb objects, and different Nastran and Samcef models can be manipulated simultaneously.
FeResPost also allows the calculation of composite structure by providing severeal classes for the Classical Laminate Analysis (CLA). Among other things, the CLA classes of FeResPost allow to :
The CLA classes can be used separately from the finite element results, but also used together with  finite element results. This allows for example to:

Who should use FeResPost?

The purpose of FeResPost is to automate post-processing operations by programming scripts. This means that FeResPost users must be ready to program his (or her) scripts. Fortunately, several programming languages and environments allow to use FeResPost (Ruby, Python, VBA, C#, C++...).

Some of the examples may give users the feeling that FeResPost provide tools that allow to perform complex operations without programming. It is sometimes true (excel examples). However, the user should keep in mind that those are just examples, and that there is a benefit in understanding how they work. In the case of excel examples, this means that the reading of documentation, the analysis of VBA code, and the testing of code and worksheet modifications will allow significant improved of what is provided.

Those who are not interested or alergic to programming should either "sub-contract" the programming work to their methodology service, or choose Nastran interactive pre- and post-processor (Patran, Femap, Hyperworks, NX...)

FeResPost library Classes and Modules

The library provides an access to 7 classes and 2 module allowing the manipulation of FE entities and results. The 7 classes are :
The ``Post'' module gives access to several additional functions.
Four classes used to perform Classical Laminate Analysis calculations are also provided:
The CLA classes are interfaced with the rest of FeResPost and allow to post-process very efficiently composite finite element Results.
The program is mainly written in C++, and different wrappings are proposed around the C++ code (Ruby, Python, COM and .NET). This solution ensures that the program is easy to manage and that the program remains efficient because costly operations are done at C++ level (compiled language efficiency).
FeResPost requirements and other programs

System requirements and other programs


    So far, Results of Nastran and Samcef solvers can be post-processed:



Operating systems and programming languages

The library is distributed as a ruby extension (LINUX and Windows), as a COM component (Windows only) and as a .NET assembly (Windows only).  In order to use FeResPost you need to install first one of the corresponding programming languages :
The programming language in which all those operations are programmed is object oriented and allows the development of very sophisticated and large post-processing programs, or very small tools, according to the wishes of the programmer.

Other resources

Besides the installation of the programming language you wish to use, a few other programs may help you to develop scripts using FeResPost. The examples distributed on this web site and discussed in the User Manual sometimes assume that thos programs have been installed on your computer. For example:
FeResPost library description

FeResPost Documentation

The manual presents the different classes defined in FeResPost library, with the associated properties and methods. It also illustrates the use of different FeResPost objects with examples. An online version of the manual is available here. FeResPost User Manual is also available in PDF format. The manual can then be downloaded via the Downloads section. Latest version of the PDF manual is downloadable here.

FeResPost downloads

FeResPost Downloads

Latest version is version 4.5.7 !

This page allows you to select the files that you want to download:

FeResPost downloads

Installation of FeResPost

We explain here how FeResPost binaries must be configured to be used on Windows or Linux OS. It is also possible to compile FeResPost from the source. (See FeResPost User Manual.)

Binaries download

Binaries (sources compiled into shared libraries) can be downloaded from FeResPost Downloads page. Just be careful to download the archive that suits your purpose:
  • Choose the version you are interested in (or "thid party contributions", "latest developments"...).
  • Select a "linux" archive if you work on Linux OS, and a "win32" or "win64" archive if you work on Windows OS. If you are using another type of OS, you will have to recompile FeResPost from sources. (See Appendix X.A of FeResPost User Manual for more information.)
  • Select also the right version amount the 32 bits or 64 bits archives. Note that your OS is probably 64 bits. Then, the choice between 32 bits or 64 bits binaries will depend on your installation of ruby, python or of the program with which you use the COM component. For example, many Microsoft Office distributions are still 32 bits, and the 32 bits COM component should then be used.
Because the submission of a new official issue of FeResPost is time consuming, one often publishes "un-official" distributions of the current version including small bug-fixes. Therefore, we suggest FeResPost users to regularly check the Latest Developments for latest sources or binaries on the Downloads page.

More information on FeResPost download is given in the Downloads page and in Appendix X.A of
FeResPost User Manual.

Extraction and configuration

The content of the archive(s) you have downloaded must be extracted in a suitable location. (You choose this location.) Then, the configuration depends on the kind of extension, component or assembly you are using.

We give below a few examples on how you can make it work, but we do not pretend to be exhaustive. The reader is referred to the documentation of the various languages to find an installation procedure that best suits your needs.

Python and Ruby extensions

There is not much to do to access FeResPost extensions from Ruby or Python. You just have to specify the path to the directory that contains the extension you are using:
  • With Ruby it can be done by specifying the path with "-I" command line. For example:
ruby -I../../../SRC/OUTPUTS/RUBY/RUBY_18 printGroups.rb

The path to directory can also be defined by setting or modifying RUBYLIB environment variable. Then, the "-I" option must no longer be used:
ruby printGroups.rb
      1. With Python by copying the "FeResPost.pyd" file in your site-packages directory. (You can also copy the library in your python script directory.) 

You can obtain the user-site packages directory by typing the command:

    python -m --user-site
  1. The path to directory can also be defined by setting or modifying PYTHONPATH environment variable:
After this you simply run a python script as follows:
For Ruby and FeResPost extensions, you must also be careful and use the directory that contains binaries that match the version of the Ruby or Python executable you are using:
  • For Ruby,  RUBY_18 directory corresponds to versions 1.8.* of Ruby, RUBY_19 to versions 1.9.* or Ruby, etc.
  • For Python,  PYTHON_26 directory corresponds to versions 2.6.* of Python, PYTHON_27 to versions 2.7.* or Python, etc.

COM component

The servers must be registered before use. For that purpose, a program called “modifyRegistry.exe” is distributed with FeResPost library.This program is to be found in "OUTPUTS/VOM/bin" directory. It is used to add keys to the Windows register:
  • The component can be registered for the current user only, or for all the users. In the second case, the registration program should be used on an account that has administrator privileges.
  • The registration program allows to register the component as well as to unregister it. If you decide to uninstall FeResPost COM component, you should unregister it before removing FeResPost files.
  • You need to register only the "FeResPost.dll" library and the "FeResPost.tlb" type library file so that the selection of files to register should look as follows:
COM registration program and selected files to register
  • When you are ready, you simply click on "Start Registering COM Component" button.
To unregister the component, you do exactly the same ecept that you click on "Start Unregistering COM Component" button at the end.

Note that to use the COM component, you still need to access it from the aprticular environment from which you are using FeResPost COM component. For example, in excel, you use the COM component in VBA language, and you must refer to the COM component via VBA editor. More information on the different ways to do this is provided in the COM examples of FeResPost User Manual, and in a few COM examples provided in this web site.

.NET assembly

The .NET assembly can be registered by copying the corresponding FeResPost.dll library in the Global Assembly Cache (GAC). On my computer it is simply done by dropping of “FeResPost.dll” into “C:/Windows/assembly” directory. Note however that you need Administrators' privilige to perform this operation.

You can also use an assembly without registration. Then, the assembly must be located in the same directory as the one containing the executable. (That is generally what I do when I test a new version of FeResPost.)

FeResPost downloads

FeResPost mailing list

You can visit or subscribe to FeResPost Google group :

Subscribe to FeResPost Group

E-mail :

Visit this group

If you have a question to ask, a bug to report, we would appreciate that you do it via FeResPost google group, so that others can benefit of your remarks as well.
FeResPost library description


We propose below a few small scripts illustrating the use of FeResPost to automate operations on finite element models, groups, results...

The examples listed below are only a small subset of the examples distributed with FeResPost. FeResPost examples .
These examples are described and commented in FeResPost Reference Manual that gives more more technical information than what we provide in the linked pages below. As the examples are presented in a sequence that increases the complexity of post-processing operations, the manual that described them should be considered as a tutorial, and we strongly advise new users to spend some time reviewing, testing and modifying these example to familiarize with FeResPost.

Examples with Ruby

Ruby script for reading Nastran BDF file 

Ruby script for access to Nastran Results read from HDF5 file. 

Examples with Python

Python script for reading Nastran BDF file
Python script for the manipulation of Groups

Python script for the extraction of results from Nastran XDB file

Python script for the extraction of information from Nastran XDB file

Python scripts showing how Results can be extracted from OP2, XDB or HDF files

Examples with COM component

The examples presented here are using FeResPost COM component:
  • This limits the applicability of the examples to Windows platforms. As far as we know, the COM component cannot be used on UNIX/LINUX platforms.
  • On the other hand, the COM component can be used with various languages that support COM. For example: Ruby, Python, Perl, VBA, C++, C,...
FeRespost is distributed with examples of scripts using COM component and written in different languages (Ruby, Pyhton, C++, VBA). We think however, that VBA is particularly interesting for it allows you to access FeResPost from excel. We present below examples of FeResPost being used from excel:

Classical Laminate Analysis in excel using FeResPost COM component

Extraction of Nastran XDB file results into axcel using FeResPost COM component

Post-processing a large selection of load cases on an entire structure with excel using FeResPost COM component.

Examples with C#

A C# program using FeResPost .NET assembly and that reads stresses from Nastran OP2 file

FeResPost license

FeResPost Videos

FeResPost installation

FeResPost COM component registration :


FeResPost with excel

Reading dynamic results and displaying curves as a function of frequency :


FeResPost license

FeResPost license

FeResPost is distributed as a LGPL resource. This means that it is free, and that you can modify and re-distribute it gratis as long as you comply with ther therms of the LGPL license. (These are given in an Appendix of the User Manual.)

The LGPL license (Lesser General Public License) is similar to GPL license (General Public License) but is less restrictive and more adapated to software distributed as libraries and allows proprietary software to link their code to a library distributed under LGPL. The "L" of LGPL is sometimes considered to correspond to "Library".

We give below a few examples of what you may do or may not do with FeResPost:
The information given above correspond to my understanding of the LGPL license. As I am no lawyer, I can only recommend users to refer to the text of the LGPL license, and find more information from a lawyer competent in this area.
The text of LGPL license is given in an appendix of FeResPost Reference Manual.

File:LGPLv3 Logo.svg

by Renaud Sizaire