COM Interface in VBA | 2.2 Creating a Member

Technical Article on the Topic Structural Analysis Using Dlubal Software

  • Knowledge Base

Technical Article

Part 2.1 of the article series about the COM interface described creating and modifying elements on an example of a member. In the third part, these core elements are used again to create nodal supports, loads, load combinations, and result combinations. Thus, the model created in the second part will be extended. Therefore, the elements explained in Part 1 and Part 2.1 are not described again.

Image 01 - System
Dim iApp As RFEM5.Application
Set iApp = GetObject(, "RFEM5.Application")
Then, the error handler is started and the license is locked:
' Error Handler
On Error GoTo e

' COM license and program access is locked.

We recommend starting the handler before locking the license; otherwise, RFEM remains locked in case of an error and can only be closed using Task Manager. Since the interface is now ready to be applied, you can get the interface for the model:

' Get interface for first model.
Dim iModel As RFEM5.model
If iApp.GetModelCount > 0 Then
Set iModel = iApp.GetModel(0)
Err.Raise vbObjectError, "LoadModel()", "iApp.GetModelCount < 1"
End If

For better error handling, you can check whether the model is actually available (GetModelCount, in this case) before retrieving the model. Even in the case of other interfaces, such as the interface for load cases or loads, you can indicate errors in a better way.

Create Nodal Supports

A single‑span beam should be created, and, because the member is along the x‑axis, the x,y,z translation and the rotation around the x- and z‑axis have to be locked on Node 1 as well. The support on Node 2 is similar to the first one up to the free translation in the x‑direction. Before creating the nodal supports, it is still necessary to retrieve the interface for the model data. When defining the support, you should make sure that in the case of degrees of freedom, a number greater than or equal to 0 is equalized with the release by using a spring constant. Here, the SI units are also used; that is, N/m or N/rad:

' Get interface for model data.
Dim iModelData As RFEM5.iModelData
Set iModelData = iModel.GetModelData()

' Create nodal supports.
Dim nodsups(0 To 1) As RFEM5.NodalSupport
nodsups(0).No = 1
nodsups(0).nodeList = "1"
nodsups(0).RestraintConstantX = -1
nodsups(0).RestraintConstantY = 0#
nodsups(0).RestraintConstantZ = -1
nodsups(0).SupportConstantX = -1
nodsups(0).SupportConstantY = -1
nodsups(0).SupportConstantZ = -1

nodsups(1).No = 2
nodsups(1).nodeList = "2"
nodsups(1).RestraintConstantX = -1
nodsups(1).RestraintConstantY = 0#
nodsups(1).RestraintConstantZ = -1
nodsups(1).SupportConstantX = 0#
nodsups(1).SupportConstantY = -1
nodsups(1).SupportConstantZ = -1

If any problems occur, they may be caused by the wrong data type. If double is required, the integer entry may cause errors. Thus, it is necessary to add a hash key after the integer value, so that it is used as a double value.

Of course, the nodal support must then be transferred to the editing mode again (PrepareModification / FinishModification):

' Transfer nodal supports.
iModelData.SetNodalSupports nodsups

Create Load Cases

In order to create loads, you have to define load cases first, exactly as in RFEM. When programming, the load cases are created and transferred first, and only afterwards can the loads be transferred by using the interfaces of the load cases. First, we create the load cases:

' Get interface for loads.
Dim iLoads As RFEM5.iLoads
Set iLoads = iModel.GetLoads

' Create load cases.
Dim loadcases(0 To 2) As RFEM5.LoadCase

loadcases(0).Loading.No = 1
loadcases(0).SelfWeight = True
loadcases(0).ToSolve = True
loadcases(0).SelfWeightFactor.X = 0
loadcases(0).SelfWeightFactor.Y = 0
loadcases(0).SelfWeightFactor.Z = 1
loadcases(0).ActionCategory = Permanent

There are three load cases to be created: self‑weight, snow, and imposed load. In the COM programming, all identifiers are in English. Therefore, Permanent is used for ActionCategory in the case of the self‑weight load case. For the SelfWeightFactor property, you can set the direction and the self‑weight value. However, these apply only if the self‑weight property is set to True. Furthermore, ToSolve must also be set to True in order to include the load case in the calculation and to assign a number to the load case (.Loading.No). The other two load cases are defined more easily, as there is no self‑weight:

loadcases(1).Loading.No = 2
loadcases(1).SelfWeight = False
loadcases(1).ToSolve = True
loadcases(1).ActionCategory = ShowHLowerThan1000

loadcases(2).Loading.No = 3
loadcases(2).SelfWeight = False
loadcases(2).ToSolve = True
loadcases(2).ActionCategory = ImposedCategoryA

' Transfer load cases.
iLoads.SetLoadCases loadcases

The ShowHLowerThan1000 category is used for snow below an altitude of 1,000 m above sea level, and ImposedCategoryA is used for the imposed load of Category A. Then, the load cases can be transferred to RFEM. However, the ILoads interface is used for this instead of the IModelData interface, as the model data is no longer concerned; rather, the load data is.

Create Load and Result Combinations

When creating either load or result combinations, there are only a few differences. The reason for this is that the calculation method and other settings can only be applied after creating the load combination via the corresponding interface. The definition is carried out as in RFEM. For this, you can use the identifier LC (Load Case). The different decimal separators and the uppercase and lowercase letters do not play a role, and both are accepted:

' Create load combinations.
Dim loadcombs(0 To 0) As RFEM5.LoadCombination

loadcombs(0).Loading.No = 1
loadcombs(0).ToSolve = True
loadcombs(0).Definition = "1.35*lc1 + 1.5*lc2 + 1.05*lc3"

' Transfer load combinations.
iLoads.SetLoadCombinations loadcombs

' Create result combinations.
Dim rescombs(0 To 0) As RFEM5.ResultCombination

rescombs(0).Loading.No = 1
rescombs(0).Definition = "1.35*lc1 + 0.75*lc2 + 1.5*lc3"

' Transfer result combinations.
iLoads.SetResultCombinations rescombs

Creating Loads

As mentioned above, the loads will now be transferred using the interfaces for load cases. In our example, no additional loads are created in Load Case 1; in Load Case 2, a trapezoidal distributed load is applied; and Load Case 3 applies a constant linear load and a nodal load. Here is the procedure for Load Case 2:

' Create loads.
' Load Case 2.
Dim iLoadCase As RFEM5.iLoadCase

Set iLoadCase = iLoads.GetLoadCase(2, AtNo)
Since we know the load case number, it can be used with AtNo when retrieving the interface:
' Create member loads.
Dim memLoads() As RFEM5.MemberLoad
ReDim memLoads(0 To 0)

In this case, the array is not dimensioned at the initialization, but afterwards, because memLoads should be used again for Load Case 3. This has the advantage that the content is reset to the default values when using ReDim again. Under ObjectList, you can select the members for loading, separated by commas or connected with hyphens. In addition to both load values for the load start (Magnitude1) and the load end (Magnitude2), the trapezoidal load requires the specification of distances for the load start (DistanceA) and end (DistanceB). The RelativeDistances property determines whether absolute (False) data in m or relative (True) data of 0‑1 will be used:

memLoads(0).No = 1
memLoads(0).ObjectList = "1"
memLoads(0).Distribution = TrapezoidalType
memLoads(0).Magnitude1 = 6000#
memLoads(0).Magnitude2 = 4000#
memLoads(0).RelativeDistances = False
memLoads(0).DistanceA = 0.2
memLoads(0).DistanceB = 0.9

' Transfer member loads.
iLoadCase.SetMemberLoads memLoads
When transferring the loads, the correct interface must be set; in this case, the ILoadCase interface. The loads of Load Case 3 are defined similarly as follows:
' Create nodal loads.
Dim nodalLoads(0 To 0) As NodalLoad
nodalLoads(0).No = 1
nodalLoads(0).nodeList = "2"
nodalLoads(0).Component.Force.X = -15000
nodalLoads(0).Component.Force.Y = 0
nodalLoads(0).Component.Force.Z = 0
nodalLoads(0).Component.Moment.X = 0
nodalLoads(0).Component.Moment.Y = 0
nodalLoads(0).Component.Moment.Z = 0

' Transfer nodal loads.
iLoadCase.SetNodalLoads nodalLoads

' Create member loads.
ReDim memLoads(0 To 0)
memLoads(0).No = 1
memLoads(0).ObjectList = "1"
memLoads(0).Distribution = UniformType
memLoads(0).Magnitude1 = 5000#

' Transfer member loads.
iLoadCase.SetMemberLoads memLoads
When closing the program, the error handler routine is completed and the license is unlocked:
e: If Err.Number <> 0 Then MsgBox Err.Description, , Err.Source

' COM license is unlocked, program access is possible again.

Summary and Overview

The procedures shown in this article are based on the two previous articles. As already mentioned, the structure is similar for all elements. The mentioned exception of nonlinear member releases or nodal supports will be explained in the next article.


Dipl.-Ing. Thomas Günthel

Dipl.-Ing. Thomas Günthel

Customer Support

Mr. Günthel provides technical support for our customers.



Write Comment...

Write Comment...

  • Views 1002x
  • Updated 19 August 2021

Contact Us

Contact Dlubal

Do you have further questions or need advice? Contact us via phone, email, or chat or find suggested solutions and useful tips on our FAQ page available 24/7.

+49 9673 9203 0

Event Invitation

NCSEA Structural Engineering Summit

Conference 15 February 2022 - 16 February 2022

Event Invitation

2022 NASCC: The Steel Conference

Conference 23 March 2022 - 25 March 2022

Event Invitation

International Mass Timber Conference

Conference 12 April 2022 - 14 April 2022

Event Invitation

Structures Congress 2022

Conference 21 April 2022 - 22 April 2022

Glass Design with Dlubal Software

Glass Design with Dlubal Software

Webinar 8 June 2021 2:00 PM - 2:45 PM

Blast Time History Analysis in RFEM

Blast Time History Analysis in RFEM

Webinar 13 May 2021 2:00 PM - 3:00 PM EST

Timber Structures | Part 2: Design

Timber Beam and Surface Structures | Part 2: Design

Webinar 11 May 2021 2:00 PM - 3:00 PM

Plate and Shell Buckling Utilizing Dlubal Software

Plate and Shell Buckling Utilizing Dlubal Software

Webinar 30 March 2021 2:00 PM - 2:45 PM

CSA S16: 19 Steel Design in RFEM

CSA S16:19 Steel Design in RFEM

Webinar 10 March 2021 2:00 PM - 3:00 PM EST

The Most Common User Errors With RFEM and RSTAB

The Most Common User Errors With RFEM and RSTAB

Webinar 4 February 2021 2:00 PM - 3:00 PM CET

ADM 2020 Member Design in RFEM

ADM 2020 Member Design in RFEM

Webinar 19 January 2021 2:00 PM - 3:00 PM EST

Dlubal Info Day

Dlubal Info Day Online | 15 December 2020

Webinar 15 December 2020 9:00 AM - 4:00 PM CET

Stability Design in Steel Construction with RFEM and RSTAB

Stability Design in Steel Construction with RFEM and RSTAB

Webinar 1 December 2020 2:00 PM - 2:45 PM CET

FEM - Troubleshooting and Optimisation in RFEM

FEA Troubleshooting and Optimization in RFEM

Webinar 11 November 2020 2:00 PM - 3:00 PM EST

Soil-Structure Interaction in RFEM

Soil-Structure Interaction in RFEM

Webinar 27 October 2020 2:00 PM - 2:45 PM CET

NBC 2015 Modal Response Spectrum Analysis in RFEM

Webinar 30 September 2020 2:00 PM - 3:00 PM EST

Documenting Results in the RFEM Printout Report

Documenting Results in the RFEM Printout Report

Webinar 25 August 2020 2:00 PM - 2:45 PM

ACI 318-19 Concrete Design in RFEM

Webinar 20 August 2020 2:00 PM - 3:00 PM EST

How to Be More Productive Using RFEM

How to Be More Productive Using RFEM

Webinar 7 July 2020 3:00 PM - 4:00 PM


Main Program

Structural engineering software for finite element analysis (FEA) of planar and spatial structural systems consisting of plates, walls, shells, members (beams), solids, and contact elements

Price of First License
3,540.00 USD
RF-COM/RS-COM Add-on Module for RFEM/RSTAB

Add-on Module

Programmable interface (API) based on COM technology

Price of First License
580.00 USD