Practical Applications Using Python and RFEM 6 | 2D Truss Generator
Using the power of RFEM 6 beyond the Graphical User Interface (GUI) and controlling/automating the model and design process is a considerable advantage. However, the power of programming with RFEM 6 goes beyond mere automatic control. Users can combine the RFEM 6 HLF Library with other popular HLF Libraries to develop custom Applications.
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:
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 on working with the RFEM HLF (for example, cloning the repository) are explained in the video series linked above.
Specific Portions of the Code
Try and Except
As mentioned, this example uses many different libraries in conjunction with the RFEM HLF (for example, 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 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:
A plethora of tutorials can also be found on YouTube.
Using the RFEM HLFs, a truss can be defined rapidly. For support on programming a truss, follow the sixth video in the aforementioned video series.
Variables initialized in the PyQt5 definitions are also integrated here 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.
The above article seeks to give a brief overview of how a parametric 2D Truss Generator GUI was created. Should extra information be required, please use the comments section on this article and we will be happy to respond.
Björn Steinhagen, B.Sc.
Mr. Steinhagen supports the development and quality assurance of the Dlubal programs.
- PyQt5 Reference Guide
- Programming with RFEM 6 and Python | 006 Example | Planar Truss
- E-Learning Videos | Programming with RFEM 6 and Python
Do you have any further questions or need advice? Contact us via phone, email, chat or forum or search the FAQ page, available 24/7.
RF-/PLATE-BUCKLING Add-on Module for RFEM/RSTAB | Plate Buckling Analysis for Plates with or Without Stiffeners According to 1993-1-5
RF-/STEEL Fatigue Members Add-on Module for RFEM/RSTAB | Fatigue Design of Members According to EN 1993-1-9
RF-IMP/RSIMP Add-on Module for RFEM/RSTAB | Generation of Equivalent Geometric Imperfections and Pre-Deformed Initial Structures
RF-/JOINTS Steel - Tower Add-on Module for RFEM/RSTAB | Hinged Connections of Lattice Towers According to EC 3
RF-/TOWER Effective Lengths Add-on Module for RFEM/RSTAB | Determination of Effective Lengths for Lattice Towers
RF-/JOINTS Steel - Column Base Add-on Module for RFEM/RSTAB | Hinged and Restrained Column Bases According to EC 3
RF-/STEEL BS Add-on Module for RFEM/RSTAB | Design of Steel Members According to BS 5950 or BS EN 1993-1-1
- The load distribution on my members looks different when using the Load Transfer surface vs. the Load Wizards. What is the reason?
- My beam has a continuous lateral support and therefore lateral torsional buckling (LTB) is not a concern. How do I define the effective length?
- I received an error message “Surface of incompatible type... (Surface in upper plane of building story must be of ‘Load transfer’ type)” when running the calculation. What is the reason?
- How can I efficiently define line hinges on several surfaces?
- How do I include the overstrength factor(s) Ωo in the ASCE 7 load combinations?
- How do I include the overstrength factor(s), Ωo in the ASCE 7 load combinations?
- How do I include the redundancy factor(s) ρ in the ASCE 7 load combinations?
- My live load is less than or equal to 100 psf. How do I consider the reduced load factor in the ASCE 7 load combinations?
- I do not see the seismic load cases in my generated ASCE 7 load combinations (COs). How do I add them?
- How do I create an imperfection based on a mode shape in RFEM 6?
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.