A reader contacted me a few weeks ago looking from a Set Rim Depth Pipe Rule for a structure. I never heard if he got it to work, but this is how I got the custom rule to work. Check the code after the jump.
First we need to create the custom macro to perform the rule. In this case we will copy the existing SetSumpDepth module. To do this right click on the SetSumpDepth and choose Export File.
Repeat the step, only this time use the Import File… option and select the file you just exported. Change the name of the module from SetSumpDepth1 to SetRimDepth (change the name in the Properties window). Now we need to replace all of the instances of SetSumpDepth to SetRimDepth, an easy way to do this is to use the Replace command under the Edit Menu. You should be able to replace all instances in the SetRimDepth module.
Now we are ready to code for the rule. In the SetRimDepth module go down the where the code matches the lines below in the pictures and make the changes indicated:
Now we need to modify the C3DPiperules.xml file to get Civil 3D to recognize the rule. Most of the steps are presented in my AU paper, so you can find the steps there (you may have to log in to see the download). The easiest rule to copy as a starting point should be the SetSumpDepthRule. My finished added XML lines are below:
Once you have made and saved all of the changes, close and open Civil 3D and you should have a working custom rule to set the surface adjustment value when you layout your pipe system, after adding it to your rule set of course.