992x
004951
2021-02-22

问题

如何通过 COM 接口读出杆件的全局或局部变形?


回复:

杆件的变形可以通过例如功能“GetMemberDeformations()”读取。 该函数需要一个编号、杆件计算方法的类型(杆件编号/列表中的编号)以及使用的坐标系。 可以选择使用局部坐标系、主轴坐标系还是全局坐标系:

子 test_results_member_axis()

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

iApp.LockLicense

Dim iMod As RFEM5.IModel3
设置 iMod = iApp.GetActiveModel


出错时转到 e

'get 计算接口
Dim iCalc As RFEM5.ICalculation2
设置 iCalc = iMod.GetCalculation

'结果获取接口
将 iRes 变暗为 RFEM5.IResults2
设置 iRes = iCalc.GetResultsInFeNodes(LoadCaseType, 1)

' 获取局部坐标系下的变形
Dim memDefs_L() As RFEM5.MemberDeformations
memDefs_L = iRes.GetMemberDeformations(1, AtNo, LocalMemberAxes)

' 获取全局坐标系中的变形
Dim memDefs_G() As RFEM5.MemberDeformations
memDefs_G = iRes.GetMemberDeformations(1, AtNo, GlobalAxes)

' 获取主坐标系中的变形
Dim memDefs_P() As RFEM5.MemberDeformations
memDefs_P = iRes.GetMemberDeformations(1, AtNo, LocalPrincipalAxes)


e:

如果 Err.Number <> 0 那么 MsgBox Err.description, vbCritical, Err.Source

iMod.GetApplication.UnlockLicense
设置 iMod = 无

末端接头


小程序读出杆件轴和主轴 (memDefs_P) 的局部变形 (memDefs_L) 以及杆件轴 (memDefs_G) 的全局变形。