Programmatically add barriers to geometric network

4406
2
04-23-2015 11:58 AM
SamuelHenderson
New Contributor II

Hi everyone,

I'm developing an ArcMap add-in that will run a trace against a water main that the user has selected using the selection tool.  The geometric is already defined and I can run the trace by manually placing the edge barriers at each end of the main, putting an edge flag somewhere on the water main between the edge barriers and then tracing downstream (using indeterminate flow).  Basically I am displaying a list of all the customers that are receiving water from that water main.

I'd like to automate this so that the user doesn't need to place barriers or flag(s) but just needs to select the water main and hit a button to preform the trace.  I guess my pseudocode would be something like:

  1. User selects a water main
  2. User clicks my Add-In button
    1. Place Edge Barrier at both ends of selected water main segment
    2. Place Flag somewhere between barriers
    3. Run the trace getting all the curbstop valves fed by the water main

As I said I can already perform the trace manually, I just want things to be automated.  How would I do this?

Tags (2)
0 Kudos
2 Replies
nicogis
MVP Frequent Contributor

you can use the trace TraceFlowSolver.FindFlowEndElements ArcObjects 10 .NET SDK Help so you find all reachable network end elements based on the specified flow method

PaulDavidson1
Occasional Contributor III

Are you doing this via ArcObjects or Python?

Can you create a model ModelBuilder that does what you need?

If so, then export the model to Python code and use that as the framework for your tool.

If doing ArcObjects, you should still be able to use the Python code as pseudo code, pointing you in the right direction for the appropriate function calls.

Just noticed this was 2015, not 2016... will post anyway as it might help someone out.

0 Kudos