Occasionally you may have a need to change the manning’s value for multiple pipes. Going to in each pipe’s properties can be a pain. Using the API we can change all of the manning’s value for all of the pipes in a Pipe Network.
There appears to be a bug in the API where it isn’t possible to change the Manning’s value directly. It is possible to change the value by temporarily giving the manning’s value a unit value. Once the units are set the manning’s value may be changed. Just have to remember to change the value back. The relevant code is below.
oPipe = DirectCast(tm.GetObject(oPipeID, OpenMode.ForWrite, True), Pipe)
Dim oPipeCOM As AeccPipe = oPipe.AcadObject
Dim oPartDataRecordCOM As AeccPartDataRecord = oPipeCOM.PartDataRecord
Dim oPartDataFieldCOM As AeccPartDataField = oPartDataRecordCOM.Find("ACMan")
oPartDataFieldCOM.Units = "ft"
Dim oPartDataRecord As PartDataRecord = oPipe.PartData
Dim oPartDataField As PartDataField = oPartDataRecord.GetDataFieldBy("ACMan")
oPartDataField.Value = dMannings
oPipe.PartData = oPartDataRecord
oPartDataFieldCOM.Units = ""
This workaround, or kludge, is required for any pipe property included in the part data record that is unitless.
The entire code for this may be found in the Civil 3D Reminders Pack source code. The command to run the program is C3DRChangeMannings if you download the program.