Practical Applications using Python and RFEM 6 | 2D Truss Generator

Technical Article on the Topic Structural Analysis Using Dlubal Software

  • Knowledge Base

Technical Article

The recently introduced WebServices gives users the ability to communicate with RFEM 6 using a programming language of choice. This feature is enriched with our High Level Functions (HLF) Library. The libraries are available for Python, JavaScript and C#. This article looks at a practical use-case of programming a 2D Truss Generator with Python. "Learning by doing" as the saying goes.

Overview

In this article, a 2D Truss Generator will be presented. The 2D Truss Generator was written in Python and utilizes powerful Python Libraries such as PyQt and Numpy in combination with the RFEM HLF. The end result is a GUI, which allows for a flexible truss generation.

Learning the Basics

This article will only highlight portions of code unique to its application in developing the 2D Truss Generator. The basics of Programming with RFEM 6 and Python can be found in our short 6-part video series under the following link:

E-Learning Videos | Programming with RFEM 6 and Python

Following Along

The code for this example can be found in the aforementioned HLF Library (RFEM_Python_Client/Examples/TrussGenerator_2D). The code is provided as open-source and hopefully provides users with inspiration for their own projects. Details to working with the RFEM HLF (e.g. cloning the repository) are explained in the above-linked video series.

Specific Portions of the Code

Try and Except

As mentioned, this example uses many different libraries in conjunction with the RFEM HLF (e.g. Numpy and PyQt5). Should users not have a specific library installed, an "import" command will throw an error. To overcome this potential issue, try and except blocks are used. The "import" falls under the try block and should this fail, the code goes into the except block which will prompt the user to install the required libraries using pip.

Building the GUI using PyQt5

PQt5 is a library aimed at the creation of GUIs. A large proportion of the code is comprised up of the definitions and statements required by PyQt5 for building the 2D Truss Generator GUI.

Documentation for using PyQt5 can be found under their link:

PyQt5 Reference Guide

A plethora of tutorials can also be found on YouTube.

Truss Definition

Using the RFEM HLFs, a truss can be rapidly defined. For support on programming a truss, follow the sixth video of the aforementioned video series.

Programming with RFEM 6 and Python | 006 Example | Planar Truss

Variables initialized in the PyQt5 definitions are here also integrated as arguments for the RFEM truss definitions. This creates interoperability between the two libraries.

A series of try, except, and if statements are deployed to validate information provided in the GUI.

Final Remarks

The above article seeks to give a brief overview of how a parametric 2D Truss Generator GUI was created. Should extra information be required kindly use the comments section on this article and we will happily respond.

Author

Björn Steinhagen, B.Sc.

Björn Steinhagen, B.Sc.

Product Engineering

Mr. Steinhagen supports the development and quality assurance of the Dlubal programs.

Keywords

Python Webservice GUI Programming

Links

Write Comment...

Write Comment...

  • Views 314x
  • Updated 11/22/2022

Contact Us

Contact Dlubal

Do you have further questions or need advice? Contact us via phone, email, chat, or forum, or search the FAQ page, available 24/7.

(267) 702-2815

[email protected]

Online Training | English

Eurocode 5 | Timber Structures According to DIN EN 1995-1-1

Online Training 12/08/2022 9:00 AM - 1:00 PM CET

Online Training | English

RFEM 6 | Students | Introduction to Reinforced Concrete Design

Online Training 12/12/2022 4:00 PM - 5:00 PM CET

Stress Analysis of Surfaces and Members in RFEM 6

Stress Analysis of Surfaces and Members in RFEM 6

Webinar 12/15/2022 2:00 PM - 3:00 PM CET

New Features in RFEM 6 and RSTAB 9

New Features in RFEM 6 und RSTAB 9

Webinar 12/21/2022 2:00 PM - 3:00 PM CET

Online Training | English

RFEM 6 | Basics

Online Training 01/19/2023 9:00 AM - 1:00 PM CET

Modeling and Design of CLT Panels in RFEM 6

Modeling and Design of CLT Panels in RFEM 6

Webinar 01/19/2023 2:00 PM - 3:00 PM CET

Online Training | English

Eurocode 2 | Concrete Structures According to DIN EN 1992-1-1

Online Training 01/26/2023 9:00 AM - 1:00 PM CET

Online Training | English

Eurocode 3 | Steel Structures According to DIN EN 1993-1-1

Online Training 03/02/2023 9:00 AM - 1:00 PM CET

Online Training | English

Eurocode 5 | Timber Structures According to DIN EN 1995-1-1

Online Training 03/16/2023 9:00 AM - 1:00 PM CET

Online Training | English

RFEM 6 | Dynamic Analysis and Seismic Design According to EC 8

Online Training 03/30/2023 9:00 AM - 1:00 PM CEST

Geotechnical Analysis with Construction Stages in RFEM 6

Geotechnical Analysis with Construction Stages in RFEM 6

Webinar 12/01/2022 2:00 PM - 3:00 PM CET

Online Training | English

RFEM 6 | Students | Introduction to Timber Design

Online Training 11/25/2022 4:00 PM - 5:00 PM CET

Online Training | English

RFEM 6 | Dynamic Analysis and Seismic Design According to EC 8

Online Training 11/23/2022 9:00 AM - 1:00 PM CET

Online Training | English

RFEM 6 | Students | Introduction to Reinforced Concrete Design

Online Training 11/21/2022 4:00 PM - 5:00 PM CET

Online Training | English

Eurocode 3 | Steel Structures According to DIN EN 1993-1-1

Online Training 11/17/2022 9:00 AM - 1:00 PM CET

RFEM 6
Hall with Arched Roof

Main Program

The structural analysis program RFEM 6 is the basis of a modular software system. The main program RFEM 6 is used to define structures, materials, and loads of planar and spatial structural systems consisting of plates, walls, shells, and members. The program can also design combined structures as well as solid and contact elements.

Price of First License
4,450.00 EUR