Question :
Comment créer un appui nodal avec une « Activité partielle » non-linéaire via l'interface COM ?
Réponse :
La macro VBA suivante montre la création d'un appui nodal avec l'« Activité partielle » non linéaire. Le code source est disponible au bas de cet article dans la section Téléchargements.
Option Explicit
'---------------------------------------------------------------------
Sub SetNSupports()
'---------------------------------------------------------------------
Dim model As RFEM5.model
Dim data As IModelData
Dim support(0) As RFEM5.NodalSupport
Dim ISup As RFEM5.INodalSupport
Dim ISupPA As RFEM5.IPartialActivity
Dim nlPA As PartialActivity
- Set model = GetObject(, "RFEM5.Model")
- model.GetApplication.LockLicense
- On Error GoTo e
- Set data = model.GetModelData
- support(0).No = 1
- support(0).NodeList = "1"
- support(0).SupportConstantX = -1
- support(0).SupportNonlinearityX = PartialActivityNLType
- support(0).SupportConstantY = -1
- support(0).SupportConstantZ = -1
- support(0).RestraintConstantX = -1
- support(0).RestraintConstantY = -1
- support(0).RestraintConstantZ = -1
- data.PrepareModification
- data.SetNodalSupports support
- data.FinishModification
- Set ISup = data.GetNodalSupport(1, AtNo)
- Set ISupPA = ISup.GetNonlinearity(AlongAxisX)
- nlPA.PositiveZone = CompleteActivityType
- nlPA.PositiveSlippage = 0.005
- nlPA.NegativeZone = FailureActivityType
- data.PrepareModification
- ISupPA.SetData nlPA
- data.FinishModification
e: If Err.Number 0 Then MsgBox Err.Description, , Err.Source
- Set data = Nothing
- model.GetApplication.UnlockLicense
- Set model = Nothing
End Sub