731x
004975
2021-04-08

Question

How can I change the calculation parameters of a load case using the COM interface?


Answer:

The calculation parameters of a load case cannot be set initially, when creating it, but only afterwards, using the interface of the existing load case. To get the interface of a load case, you have to get the interfaces 'IModel' and 'ILoads' first:


Sub test_analysis_parameters()

Dim iApp As RFEM5.Application
Set iApp = GetObject(, "RFEM5.Application")

iApp.LockLicense

Dim iMod As RFEM5.IModel3
Set iMod = iApp.GetActiveModel

On Error GoTo e

'   get interface of loads
Dim iLds As RFEM5.iLoads
Set iLds = iMod.GetLoads

'   get interface of load case
Dim iLc As RFEM5.ILoadCase
Set iLc = iLds.GetLoadCase(1, AtNo)

'   get analysis parameters
Dim param_analy As RFEM5.AnalysisParameters
param_analy = iLc.GetAnalysisParameters

'   change analysis parameters
param_analy.Method = Postcritical
param_analy.ModifyLoadingByFactor = True
param_analy.LoadingFactor = 1.5
'   ...

'   set new analysis parameters
iLds.PrepareModification
iLc.SetAnalysisParameters param_analy
iLds.FinishModification

e:

If Err.Number <> 0 Then MsgBox Err.description, vbCritical, Err.Source

iMod.GetApplication.UnlockLicense
Set iMod = Nothing

End Sub

Use 'ILoads.GetLoadcase' to get the interface for a specific load case. This interface provides the functions 'GetAnalysisParameters' and 'SetAnalysisparameters' that you can then use to read out and write the parameters.

The same procedure also applies for load combinations.