How can I open and close RFEM/RSTAB in the background via the COM interface?

Answer

By initializing a variable of the Application (interface) type with "new", RFEM/RSTAB is started in the background. With this variable, you can also create a new model using the "CreateModel" method, or close the program using the "Close" command.

The following example shows how to start RSTAB, create a model with a node in the program, and close the program:


Sub RSTAB_open_close()

Dim filename As String
filename = Application.ActiveSheet.Cells(7, 3)

'   start rfem
Dim iApp As RSTAB8.Application
Set iApp = New RSTAB8.Application

iApp.LockLicense
iApp.Show

On Error GoTo E

    '   create model
    Dim iMod As RSTAB8.IModel2
    Set iMod = iApp.CreateModel(filename)
    
    '   add data to model
    Dim nd As RSTAB8.Node
    nd.no = 10
    nd.X = 1
    nd.Y = 2
    nd.Z = 3
    
    Dim iModdata As RSTAB8.iModelData
    Set iModdata = iMod.GetModelData
    
    iModdata.PrepareModification
    iModdata.SetNode nd
    iModdata.FinishModification
    
    iMod.Save filename


E:  If Err.Number <> 0 Then MsgBox Err.description, , Err.Source
    
    Set iModdata = Nothing
    Set iMod = Nothing
    iApp.UnlockLicense
    iApp.Close
    Set iApp = Nothing
    
End Sub


The "iApp.Show" command is optional. This allows for displaying the program normally, not in the background.

Under Downloads, you can find an Excel macro with the subroutines for RFEM and RSTAB.

Please note that the folder, where the file is created, must exist.

Keywords

COM Background Close Show Application

Downloads

Contact us

Did you find your question?
If not, contact us via our free e-mail, chat, or forum support, or send us your question via the online form.

+49 9673 9203 0

info@dlubal.com

RFEM Main Program
RFEM 5.xx

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
RSTAB Main Program
RSTAB 8.xx

Main Program

The structural engineering software for design of frame, beam and truss structures, performing linear and nonlinear calculations of internal forces, deformations, and support reactions

Price of First License
2,550.00 USD
RFEM Other
RF-COM 5.xx

Add-on Module

Programmable interface (API) based on the COM technology

Price of First License
580.00 USD
RSTAB Other
RS-COM 8.xx

Add-on Module

Programmable interface (API) based on the COM technology

Price of First License
580.00 USD