FAQ 004688 | How can I modify the FE mesh settings via the COM interface?

Easily learn how to work with the Dlubal Software programs

  • Dlubal Software | Videos


First Steps with RFEM

First steps

We provide hints and tips to help you get started with the basic program RFEM.



Thomas Günthel

Please accept Marketing Cookies to watch this video.


How can I modify the FE mesh settings via the COM interface?


The general FE mesh settings can be modified using the IFeMeshSettings interface. This interface is located under IModel > IModelData > ICalculation. Figure 01 shows which elements can be modified / displayed.

Here is a code example where the target length of the FE elements is set to 100 mm. Furthermore, the division of the members with the same element size is activated and the minimum division is set to 3 elements:

Sub mesh_params()

Dim iApp As RFEM5.Application

'   get interface for model data
Dim iModel As RFEM5.model
Set iModel = GetObject(, "RFEM5.Model")

On Error GoTo e

If Not iModel Is Nothing Then
    '   get interface for application and lock licence
    Set iApp = iModel.GetApplication()
    '   get interface for model dat
    Dim iModdata As RFEM5.IModelData2
    Set iModdata = iModel.GetModelData
    '   get interface for calculation
    Dim iCalc As RFEM5.ICalculation2
    Set iCalc = iModel.GetCalculation()
    '   get interface for mesh settings
    Dim iMeshSet As RFEM5.IFeMeshSettings
    Set iMeshSet = iCalc.GetFeMeshSettings
    '   get general mesh settings
    Dim meshGen As RFEM5.FeMeshGeneralSettings
    meshGen = iMeshSet.GetGeneral
    meshGen.ElementLength = 0.1
    '   set new general mesh settings
    iMeshSet.SetGeneral meshGen
    '   get mesh member settings
    Dim meshMem As RFEM5.FeMeshMembersSettings
    meshMem = iMeshSet.GetMembers
    meshMem.DivideStraightMembers = True
    meshMem.ElementLength = 0.1
    meshMem.MinStraightMemberDivisions = 3
    '   set new mesh member settings
    iMeshSet.SetMembers meshMem
End If

e:  If Err.Number <> 0 Then
    MsgBox Err.description, , Err.Source
    End If
    Set iApp = Nothing
    Set iModel = Nothing

End Sub

The subroutine is also completed by an error interceptio routine (On Error GoTo e) and the Prepare-/FinishModification block is required as in the case of modifying other elements. Here, the block is created via the IFeMeshSettings interface.


Dlubal FAQ COM FE mesh Mesh Frequently Asked Question FAQ about Dlubal Question and Answer about Dlubal


Write Comment...

Write Comment...

  • Views 152x
  • Updated 11/06/2020

Contact us

Do you have any questions about our products or need advice on selecting the products needed for your projects?
Contact us via our free e-mail, chat, or forum support or find various suggested solutions and useful tips on our FAQ page.

(267) 702-2815