621x
002291
2021-02-04

[EN] FAQ 004927 | How can I apply a temperature load to a surface using the COM interface ...

Question:
How can I apply a temperature load to a surface using the COM interface?

Answer:
A temperature load is a surface load type, and is therefore applied like all other surface loads. To do this, it is necessary first to get the interface to the model, then to the loads, and then to the special load case:

Sub surface_temp_load_test()

' get interface from the opened model and lock the licence/program
Dim iModel As RFEM5.IModel3
Set iModel = GetObject(, "RFEM5.Model")
iModel.GetApplication.LockLicense

On Error GoTo e

Dim iModelData As RFEM5.IModelData2
Set iModelData = iModel.GetModelData

Dim iLoa As RFEM5.iLoads
Set iLoa = iModel.GetLoads

Dim iLc As RFEM5.ILoadCase
Set iLc = iLoa.GetLoadCase(1, AtNo)

Dim surfLoad As RFEM5.SurfaceLoad

surfLoad.no = 1
surfLoad.Type = TemperatureType
surfLoad.Distribution = UniformType
surfLoad.SurfaceList = "1"
surfLoad.Magnitude1 = 10
surfLoad.Magnitude4 = 40

iLc.PrepareModification
iLc.SetSurfaceLoad surfLoad
iLc.FinishModification

e:  If Err.Number 0 Then MsgBox Err.description, , Err.Source

Set iModelData = Nothing
iModel.GetApplication.UnlockLicense
Set iModel = Nothing

End Sub

For a constant temperature load, the parameters Magnitude1 and Magnitude4 are used, where Tc is Magnitude1 and dT is Magnitude4. If a variable load is applied, Magnitude2 and Magnitude3 are used for the other corner points for Tc, and Magnitude5 and Magnitude6 for dT.



;