When laying out pipes you can choose the slope method with the slope button to make the pipe's flow direction to go from Start To End or End To Start, you don't have the option to have it use the By Slope flow direction. You can set up a custom pipe rule to accomplish this task and that is what I am covering in this post. I'm not going to cover all of the steps, for the steps I don't cover you can get from my AU 2007 paper or from previous posts regarding pipe rules.
To start you will need to decide, at least for Civil 3D 2009, to choose what programming language to work in. I'm going to use VBA, though you can use vb.net to accomplish the same task. This first step is to open the C3DPipeRules.dvb file using VBAMan and then do a SaveAs of the file. I'm going to call the file C3DCustomPipeRules.dvb. Next I'm going to rename the PipeLength module to PipeBySlope.
Next go to the edit menu and choose Replace. Replace all of the instances of PipeLength to PipeBySlope. This will rename all of the macros to match the name of the Module. Next move the highlighted text to the location indicated below.
Next add code to make the to set the flow direction of the pipe. The highlighted code below.
Next delete the code in the validate section. The code should be as shown below.
Next delete the Modules that aren't needed.
Next modify the C3DPiperules.xml file to add the pipe rule to Civil 3D and your done.