See if this will change routing preference.
Using out of the box stuff
*************Edit *************
Need this
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.Aec.DatabaseServices;
using Autodesk.Aec.Building.DatabaseServices;
using PipeDbServies = Autodesk.Aec.Building.Piping.DatabaseServices;
using ArchDbSrvcs = Autodesk.Aec.Arch.DatabaseServices;
using ObjectId = Autodesk.AutoCAD.DatabaseServices.ObjectId;
using Autodesk.Aec.Building.ApplicationServices;
[CommandMethod("PipePref")]
public void PipePref()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
using (Transaction trx = db.TransactionManager.StartTransaction())
{
PipeDbServies.DictionaryPipePartRoutingPreferencesStyle pipePrefDic = new PipeDbServies.DictionaryPipePartRoutingPreferencesStyle(db);
ObjectId newPipePrefId = pipePrefDic.GetAt("Brazed Copper");
ObjectId pipeId = ed.GetEntity("Select Pipe").ObjectId;
Member member = trx.GetObject(pipeId, OpenMode.ForWrite) as Member;
DataRecord dataRecord = PartManager.GetEngineeringData(member);
DataField routingPeference = dataRecord.DataFields.FindByContext(Context.RoutingPreferenceId);
routingPeference.ValueObjectId = newPipePrefId;
PartManager.SetPartData(member, dataRecord);
PartManager.SetEngineeringData(member, dataRecord);
trx.Commit();
}
}