Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The fist thing we have to do is declare where the model is located :

Code Block
languagepy
titleDeclare paths
rootPath = r"D:\Workshop\data"
model213Path = rootPath + r"\SW_max.lit\2"

 

Then we want to import the model using the Deltashell Sobek 2 importer. For this we will need to use a library called "Sobek2Functions" in the "Libraries" folder of the toolbox. This is done by adding the following line (and running it).

Code Block
languagepy
titleImport Sobek2Functions library
from Libraries.Sobek2Functions import *

 This will make all the functions (because of the *) in the Sobek2Functions library available for use. All these functions will now also appear in the code completion dialog (when you use ctrl + space).

 

In this library we have a function called "ImportSobek2Model" which we will use to import the existing model.

Code Block
languagepy
titleImport Sobek 2.13 model
hydroModel = ImportSobek2Model(model213Path + r"\NETWORK.TP",useRR=False, useFLOW=True, useRTC=False, useWAQ=False)

After running this line the model is imported and added to the variable "hydroModel", but we can not see the model yet.

For this we need to import another library called "StandardFunctions" because this library has a function for adding an item to the project.

Code Block
languagepy
titleAdd hydromodel to project
from Libraries.StandardFunctions import *
AddToProject(hydroModel)

Now we should have the imported model in our project (see the project toolwindow):

 

Panel

Continue with Run the flow model