scrollbar |
---|
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 :
Code Block | ||
---|---|---|
| ||
h2. Import a model from a mdu file Start by creating a new script in the toolbox scripting folder (see [TOOLS:Toolbox overview] for details), and double click it to open the scripting editor and add the following code : {code:title=Adding imports and loading model|linenumbers=true|language=python} #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) {code} \\ In the first statements we import the WaterFlowFMModel from the DeltaShell code ( in module (namespace) |
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.
Code Block | ||||
---|---|---|---|---|
| =
| |||
}
#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 :
Code Block | ||
---|---|---|
| ||
{code} \\ With the following code we create a new WaterFlowFMModel object using the path to the mdu file : {code:|language=python} rootPath = "D:\\scripting\\" # create fm model using mdu file fmModel = WaterFlowFMModel(rootPath + "mdu_ivoorkust\\ivk.mdu") #"harlingen\\har.mdu" for harlingen) {code} \\ \\ |
scrollbar |
---|