How to make an RFEM model with Python and VIKTOR


Share on facebook
Share on linkedin
Share on twitter
Share on whatsapp
Share on reddit


During my years as a structural (finite element) engineer, working for several different companies, I got to work with various structural software packages, including ABAQUS, ANSYS, NASTRAN, RFEM, SCIA, etc. Having experienced the effort and time needed to create finite element models, I became an advocate of automating this (labor-intense and often boring) process whenever possible, an opinion that is widely shared among our clients.
Download the white paper and get inspired
Learn about the trends on digital transformation and how to take the next step.

On request of one of our clients, VIKTOR has developed an integration with RFEM as one of its digital building blocks, to make creating models and executing RFEM from within your VIKTOR web application easy and quickly. RFEM is a widely used software program developed by Dlubal for the 3D finite element analysis (FEA) of engineering structures. It is used by civil engineering companies around the world. By parameterizing the concerning structure(s), automating the generation of the models, and integrating the analysis and post-processing of results within one single app, a significant increase in efficiency is achieved.

RFEM model created in VIKTOR

Creating the RFEM model with a few lines of Python code

Creating RFEM models using the VIKTOR SDK is done by witing object-oriented Python code. No knowledge of RFEM’s C# API is required. All the relevant building blocks can be found in the module viktor.external.rfem, of which the starting point is the RFEMModel, making it easy to implement for developers with basic Python knowledge and effortlessly integrates with all other parts of the SDK.

Python code showing how a (dummy) RFEM model is built-up in VIKTOR

Finally, an RFEM input file (.rfx) can be generated by calling `model.get_rfx_file()`, that can then be downloaded (so that it can be manually loaded in RFEM) or sent for analysis to VIKTOR’s RFEM worker.

Running the analysis in the VIKTOR web application

With VIKTOR you can perform an RFEM analysis from within your web application, without having to open the interface manually. This makes the analysis easily integratable into a fully automated design process. The analysis can be performed using the RFEMAnalysis class, by specifying the input file (.rfx) and a set of actions. This could be an input file generate with get_rfx_file (see above), or one obtained some other way, as long as RFEM deems it valid:

The worker can perform a series of actions that can be chosen by the developer from a fixed set (this set might be extended by VIKTOR in the future, depending on the demand). For example, a typical energy optimization analysis can be performed on a selected set of load cases, by:

Executing the analysis invokes the input file to be sent to a designated (virtual) machine that executes the job (on a so-called ‘worker’), using the local RFEM software and license. After execution, the model with results (.rfx) and/or the requested results per load case can be retrieved in numerical form for further processing (e.g. for plotting graphs and tables in the app’s interface).

A User-friendly interface

Python code and FEM packages can be intimidating for some people. VIKTOR provides the opportunity to create user-friendly web-based applications and run RFEM in the background. In this way, you can make your domain knowledge available to other persons while keeping your intellectual property save.

For example, think in a product configurator that enables sales representatives to design and price a product independently, but between the safe boundaries you have determined as an engineer.

Here you can see the same RFEM model in a VIKTOR application. The person using it does not to have any knowledge of RFEM of Python, nor a licence installed. It is everywhere available and from any device.


VIKTOR’s RFEM binding makes it even easier to generate, analyse and post-process your RFEM models in an automated way, using the software you are familiar with. A VIKTOR worker provides a connection between the web application and the software, such that RFEM can be executed from within the browser. After the analysis, the results are returned and can be visualised on top of the model visualisation. This means that the manual tasks of constructing a RFEM model in the interface, analysing the model and assessing the results can all be done with a simple button click from within the VIKTOR interface!

Written by: Bas van der Hulst


Share on facebook
Share on linkedin
Share on twitter
Share on whatsapp
Share on reddit

Follow us on LinkedIn and stay updated