0x
004585
04.08.2020

Distribution d’une charge linéique à l’aide de RF-COM

Comment lire la distribution de charge d’une charge linéique à partir d’une liste déroulante dans RF-COM ?


Réponse:

La distribution de charge d’une charge linéique est définie par l’attribut « Distribution ». L’attribut « Distribution » est de type « LoadDistributionType » et les entrées de la liste de la liste déroulante sont de type « String », la conversion de type est donc requise. La fonction « GetLoadDistributionType » convertit une entrée de liste de type String en LoadDistributionType.

'--------------------------------------------------------------------------------------------------
Function GetLoadDistributionType(sType As String) As LoadDistributionType
'--------------------------------------------------------------------------------------------------
    
    If sType = "Concentrated2x2QType" Then
      GetLoadDistributionType = Concentrated2x2QType
    ElseIf sType = "Concentrated2xQType" Then
      GetLoadDistributionType = Concentrated2xQType
    ElseIf sType = "ConcentratedNxQType" Then
      GetLoadDistributionType = ConcentratedNxQType
    ElseIf sType = "ConcentratedType" Then
      GetLoadDistributionType = ConcentratedType
    ElseIf sType = "ConcentratedUserDefinedType" Then
      GetLoadDistributionType = "ConcentratedUserDefinedType"
    ElseIf sType = "LinearType" Then
      GetLoadDistributionType = LinearType
    ElseIf sType = "LinearXType" Then
      GetLoadDistributionType = LinearXType
    ElseIf sType = "LinearYType" Then
      GetLoadDistributionType = LinearYType
    ElseIf sType = "LinearZType" Then
      GetLoadDistributionType = LinearZType
    ElseIf sType = "ParabolicType" Then
      GetLoadDistributionType = ParabolicType
    ElseIf sType = "RadialType" Then
      GetLoadDistributionType = RadialType
    ElseIf sType = "TaperedType" Then
      GetLoadDistributionType = TaperedType
    ElseIf sType = "TrapezoidalType" Then
      GetLoadDistributionType = TrapezoidalType
    ElseIf sType = "UniformType" Then
      GetLoadDistributionType = UniformType
    ElseIf sType = "VaryingType" Then
      GetLoadDistributionType = VaryingType
    End If

End Function

La procédure « SetLineLoad » crée une charge linéique sur la ligne 1. La distribution des charges est lue dans la liste déroulante « LoadDistribution » de la feuille de calcul Excel « LineLoad ».

'--------------------------------------------------------------------------------------------------
Sub SetLineLoads()
'--------------------------------------------------------------------------------------------------
Dim model As RFEM5.model
Dim load As RFEM5.ILoadCase
Dim data(0) As RFEM5.LineLoad
    'Get interface for model
    Set model = GetObject(, "RFEM5.Model")
    
    'Block COM licence and program access
    model.GetApplication.LockLicense
    On Error GoTo e
   'Get interface for loads
    Set load = model.GetLoads.GetLoadCase(0, AtIndex)
    'Set parameters for lineload
    data(0).No = 1
    data(0).LineList = "1"
    data(0).Type = ForceType
    'Load Distribution from combo box
    data(0).Distribution = GetLoadDistributionType(Worksheets("LineLoad").DropDowns("LoadDistribution").List(Worksheets("LineLoad").DropDowns("LoadDistribution").ListIndex))
    data(0).Direction = LocalZType
    data(0).DistanceA = 11
    data(0).DistanceB = 22
    data(0).RelativeDistances = True
    data(0).Magnitude1 = 4000
    data(0).Magnitude2 = 5000
    data(0).Magnitude3 = 6000
    data(0).OverTotalLength = False
    data(0).Comment = "line load 1"
    'Transfer lineload
    load.PrepareModification
    load.SetLineLoads data
    load.FinishModification
    
e:  If Err.Number <> 0 Then MsgBox Err.Description, , Err.Source
    Set load = Nothing
    'COM licence is unlocked, program access possible again
    model.GetApplication.UnlockLicense
    Set model = Nothing


End Sub

Auteur

Sonja travaille dans le Product Engineering et apporte également son soutien au Customer Support. Elle se concentre sur RSECTION ainsi que sur les constructions en acier et en aluminium, où elle met ses connaissances à profit de manière ciblée.

Téléchargements


;