Exercise outline
We want to load our ivory coast model or our harlingen model using a mdu file.
Import a model from a mdu file
Start by creating a new script in the toolbox scripting folder (see Toolbox overview for details), and double click it to open the scripting editor and add the following code :
#region Import libs # DeltaShell libs from DeltaShell.Plugins.FMSuite.FlowFM import WaterFlowFMModel #endregion rootPath = "D:\\scripting\\" # create fm model using mdu file fmModel = WaterFlowFMModel(rootPath + "mdu_ivoorkust\\ivk.mdu") #"harlingen\\har.mdu" for harlingen)
In the first statements we import the WaterFlowFMModel from the DeltaShell code ( in module (namespace) DeltaShell.Plugins.FMSuite.FlowFM ), and add the #region - #endregion comments to mark this block of code as a collapsable region. After we run this code the editor will now know about WaterFlowFMModel and you can use it in your scripts.
#region Import libs # DeltaShell libs from DeltaShell.Plugins.FMSuite.FlowFM import WaterFlowFMModel #endregion
With the following code we create a new WaterFlowFMModel object using the path to the mdu file :
rootPath = "D:\\scripting\\" # create fm model using mdu file fmModel = WaterFlowFMModel(rootPath + "mdu_ivoorkust\\ivk.mdu") #"harlingen\\har.mdu" for harlingen)