<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>6. Python Scripting in Delft3DFM Suite</title>
  <link rel="self" href="https://dlt-acc.firelay.cloud/en/c/message_boards/find_category?p_l_id=4041874&amp;mbCategoryId=4392213" />
  <subtitle>In this category we will share Python scripts, discuss the issues and share ideas how to tackle them using build-in scripting.</subtitle>
  <id>https://dlt-acc.firelay.cloud/en/c/message_boards/find_category?p_l_id=4041874&amp;mbCategoryId=4392213</id>
  <updated>2026-05-12T15:58:45Z</updated>
  <dc:date>2026-05-12T15:58:45Z</dc:date>
  <entry>
    <title>RE: Python scripting of sewer network geometry</title>
    <link rel="alternate" href="https://dlt-acc.firelay.cloud/en/c/message_boards/find_message?p_l_id=4041874&amp;messageId=4392585" />
    <author>
      <name>Sebastian Schoeller</name>
    </author>
    <id>https://dlt-acc.firelay.cloud/en/c/message_boards/find_message?p_l_id=4041874&amp;messageId=4392585</id>
    <updated>2018-07-17T13:24:16Z</updated>
    <published>2018-06-21T09:51:59Z</published>
    <summary type="html">&lt;p&gt;After reconsulting the documentation I have managed to import the
  correct library and to attached a culvert object to a channel as follows:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;
from DelftTools.Hydro import CulvertGeometryType&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;
    # create cross section for channel
    # checking for circular channel
    if int(feature.Attributes.TryGetValue(&amp;quot;Profilart&amp;quot;)[1][:2]) == 0:
        diameter = float(feature.Attributes.TryGetValue(&amp;quot;ProfBreite&amp;quot;)[1])/1000
        inlet = float(feature.Attributes.TryGetValue(&amp;quot;SohleZu&amp;quot;)[1])
        outlet = float(feature.Attributes.TryGetValue(&amp;quot;SohleAb&amp;quot;)[1])
        id = str(feature.Attributes.TryGetValue(&amp;quot;ProfBez&amp;quot;)[1])
        name = str(startNode.Id) + &amp;quot;-&amp;quot; + str(endNode.Id) + &amp;quot;_Round&amp;quot;
        culvert = CreateBranchObjectOnBranchUsingChainage(BranchObjectType.Culvert, id, channel, channel.Length/2)
        culvert.GeometryType = CulvertGeometryType.Round
        culvert.Diameter = diameter
        configureCulvert( culvert, channel.Length, inlet, outlet)&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Unfortunately when trying to test run, Sobek 3 is complaining that
  channel objects do not have a cross-section attached to it. My current
  setup is that a network has branches and each branch has a channel.
  Since I want to simulate a closed sewer system and I cannot find any
  closed cross-sections I attached conduits between nodes. It does not
  work though. My ultimate goal is to test&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;
RainfallRunoff-&amp;gt;2D area-&amp;gt;lateral inflow into-&amp;gt;1D sewer network-&amp;gt;outlet to 2D area&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Any assistance is highly appreciated.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;</summary>
    <dc:creator>Sebastian Schoeller</dc:creator>
    <dc:date>2018-06-21T09:51:59Z</dc:date>
  </entry>
  <entry>
    <title>Python scripting of sewer network geometry</title>
    <link rel="alternate" href="https://dlt-acc.firelay.cloud/en/c/message_boards/find_message?p_l_id=4041874&amp;messageId=4392572" />
    <author>
      <name>Sebastian Schoeller</name>
    </author>
    <id>https://dlt-acc.firelay.cloud/en/c/message_boards/find_message?p_l_id=4041874&amp;messageId=4392572</id>
    <updated>2018-07-17T13:24:16Z</updated>
    <published>2018-06-14T15:32:52Z</published>
    <summary type="html">&lt;p&gt;Dear all,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I have started exploring python scriptability of Sobek 3. I am
  importing from a SHP-file to generate a network. First I have created
  nodes and channel objects as well as added that to branches and the
  network itself. Everything has worked and is correct in plan view.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;When trying to define branch geometries I run in to difficulties
  though. I first add a cross-section to the branch and then try to set
  the geometry type which I cannot get my head around:&lt;/p&gt;
&lt;pre&gt;
    # checking for egg-shape channel
    elif int(feature.Attributes.TryGetValue(&amp;quot;Profilart&amp;quot;)[1][:2]) == 1:
        crossSection = CreateBranchObjectOnBranchUsingChainage(BranchObjectType.Culvert, str(feature.Attributes.TryGetValue(&amp;quot;Profilart&amp;quot;)), channel, 7)
        crossSection.GeometryType.Egg&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Setting GeometryType throws an error. The following import statements
  have been included in the header:&lt;/p&gt;
&lt;pre&gt;
from Libraries.MapFunctions import CreateLineGeometry, CreatePointGeometry
from Libraries.MapFunctions import GetShapeFileFeatures, GetShapeFileCoordinateSystem
from Libraries.StandardFunctions import *
from Libraries.NetworkFunctions import *
from Libraries.SobekWaterFlowFunctions import *
from Libraries.StandardFunctions import *&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Any advise is highly welcome.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Sebastian&lt;/p&gt;</summary>
    <dc:creator>Sebastian Schoeller</dc:creator>
    <dc:date>2018-06-14T15:32:52Z</dc:date>
  </entry>
</feed>
