876x
004869
14.12.2020

Dotaz

Jak mohu načíst výslednici řezu pomocí rozhraní COM?


Odpověď:

Stejně jako všechny ostatní výsledky lze i výslednice řezu načíst pomocí IModel3 > ICalculation2 > IResults2. Rozhraní k výsledkům poskytuje funkce GetResultant, která při zadání čísla řezu a typu průběhu výsledků vrátí strukturu ResultantForce. Tato konstrukce zahrnuje mimo jiné síly a momenty jako vektor:

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

    On Error GoTo e

    '   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 Resultant
    Dim section_resultant As ResultantForce
section_resultant = iRes.GetResultant(1, AtNo, ConstantDistributionOnElements)

e:
If Err.Number <> 0 Then
    MsgBox Err.Number & " " & Err.description
End If

If Not iApp Is Nothing Then
    iApp.UnlockLicense
End If

End Sub