Question :
Comment créer un appui nodal avec un diagramme de non-linéarité via l’interface COM ?
Réponse :
La macro VBA suivante permet de créer un appui nodal avec un diagramme de non-linéarité. Le code source est disponible au bas de cet article dans les Téléchargements.
'--------------------------------------------------------------------------------------------------
Sub SetNSupports()
'--------------------------------------------------------------------------------------------------
Dim model As RFEM5.model
Dim data As IModelData
Dim support(0) As RFEM5.NodalSupport
Dim ISup As RFEM5.INodalSupport
Dim ISupDia As RFEM5.INonlinearityDiagram
Dim nlDiag As NonlinearityDiagram
Dim zone(2, 1) As Double
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).SupportNonlinearityX = WorkingDiagramType
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 ISupDia = ISup.GetNonlinearity(AlongAxisX)
zone(0, 0) = 0
zone(0, 1) = 0
zone(1, 0) = 1
zone(1, 1) = 2
zone(2, 0) = 3
zone(2, 1) = 4
nlDiag.PositiveZoneType = DiagramAfterLastStepType.StopDiagramType
nlDiag.PositiveZone = zone
nlDiag.Symmetric = True
data.PrepareModification
ISupDia.SetData nlDiag
data.FinishModification
e: If Err.Number 0 Then MsgBox Err.Description, , Err.Source
Set data = Nothing
model.GetApplication.UnlockLicense
Set model = Nothing
End Sub