Les paramètres généraux du maillage EF peuvent être modifiés à l'aide de l'interface IFeMeshSettings. Cette interface se trouve sous IModel > IModelData > ICalculation. La Figure 01 montre quels éléments peuvent être modifiés/affichés.
Voici un exemple de code où la longueur visée des éléments EF est définie sur 100 mm. De plus, la division des barres avec la même taille d'élément est activée et la division minimale est définie sur 3 éléments :
Sub mesh_params()
Dim iApp As RFEM5.Application
' get interface for model dataDim iModel As RFEM5.modelSet iModel = GetObject(, "RFEM5.Model")
On Error GoTo e
If Not iModel Is Nothing Then ' get interface for application and lock licence Set iApp = iModel.GetApplication() iApp.LockLicense ' get interface for model dat Dim iModdata As RFEM5.IModelData2 Set iModdata = iModel.GetModelData ' get interface for calculation Dim iCalc As RFEM5.ICalculation2 Set iCalc = iModel.GetCalculation() ' get interface for mesh settings Dim iMeshSet As RFEM5.IFeMeshSettings Set iMeshSet = iCalc.GetFeMeshSettings ' get general mesh settings Dim meshGen As RFEM5.FeMeshGeneralSettings meshGen = iMeshSet.GetGeneral meshGen.ElementLength = 0.1 ' set new general mesh settings iModdata.PrepareModification iMeshSet.SetGeneral meshGen iModdata.FinishModification ' get mesh member settings Dim meshMem As RFEM5.FeMeshMembersSettings meshMem = iMeshSet.GetMembers meshMem.DivideStraightMembers = True meshMem.ElementLength = 0.1 meshMem.MinStraightMemberDivisions = 3 ' set new mesh member settings iModdata.PrepareModification iMeshSet.SetMembers meshMem iModdata.FinishModification iApp.UnlockLicenseEnd If
e: If Err.Number <> 0 Then MsgBox Err.description, , Err.Source End If iApp.UnlockLicense Set iApp = Nothing Set iModel = Nothing
End Sub
Le sous-programme est également complété par une routine d'interception d'erreurs (On Error GoTo e) et le bloc Prepare-/FinishModification est requis comme dans le cas de la modification d'autres éléments. Le bloc est ici créé via l'interface IFeMeshSettings.