Odpověď:
Obecné nastavení sítě konečných prvků je možné změnit pomocí rozhraní IFeMeshSettings. Toto rozhraní se nachází pod IModel > IModelData > ICalculation. Na Obrázku 01 je vidět, které prvky lze měnit/zobrazovat.
Zde je příklad kódu, kde je požadovaná délka konečných prvků nastavena na 100 mm. Dále se aktivuje dělení prutů se stejnou velikostí prvku a minimální dělení se nastaví na 3 prvky:
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
Podprogram je také doplněný podprogramem pro záchyt chyby (On Error GoTo e) a stejně jako v případě úpravy jiných prvků je zde zapotřebí blok Prepare-/FinishModification. Blok se zde vytvoří pomocí rozhraní IFeMeshSettings.