449x
001524
2020-07-07

[EN] FAQ 004484 | How can I display the stresses of a surface via RF‑COM?

Question:
How can I display the stresses of a surface via RF‑COM?

Answer:
The stresses of a surface can be displayed via the COM interface. First, you need the interface for the model (IModel) and then the interface for the calculation (ICalculation2). Using this interface, you can get the interface for the results (IResults2):

Sub stresses_surfaces_example()
Dim iApp As RFEM5.Application
Dim iModel As RFEM5.model
Set iModel = GetObject(, "RFEM5.Model")

On Error GoTo E

If Not iModel Is Nothing Then
    '   get interface from model
    Set iApp = iModel.GetApplication
    iApp.LockLicense

    '   get interface from calculation
    Dim iCalc As RFEM5.ICalculation2
    Set iCalc = iModel.GetCalculation

    '   get interface from results from loadcase 1
    Dim iRes As RFEM5.IResults2
    Set iRes = iCalc.GetResultsInFeNodes(LoadCaseType, 1)

    '   get equivalent stresses
    Dim str_equ() As RFEM5.SurfaceEquivalentStresses
    str_equ = iRes.GetSurfaceEquivalentStresses(1, AtNo, VonMisesHypothesis)

End If

E:
If Err.Number 0 Then
    MsgBox Err.Number & " " & Err.description
End If

If Not iApp Is Nothing Then
    iApp.UnlockLicense
End If

The GetSurfaceEquivalentStresses function requires the specification of the calculation hypothesis. In this case, the results of the von Mises stress are displayed. Please note that the COM interface uses SI units so the stress is transferred in N/m².



;