I'm trying to get the joint type/fitting from the routing preference. I've been able to get all the other fittings set in the routing preference but I cannot figure out how to get the joint fitting. Anyone have some experience with this.
using (var tr = db.TransactionManager.StartTransaction())
{
var modelSpace = db.ModelSpace(OpenMode.ForWrite);
var dict = new DictionaryPipePartRoutingPreferencesStyle(db);
var rp = dict.Records.Cast<ObjectId>()
.Select(r => (PipePartRoutingPreferencesStyle) tr.GetObject(r, OpenMode.ForRead))
.FirstOrDefault(p => p.Name == "Butt Welded");
if (rp == null)
return;
// This doesn't return the joint type
ConnectionType jointConnType;
rp.GetJointConnectionType(2.0, out jointConnType);
Type jointType;
rp.GetJointObjectType(2.0, out jointType);
var x = rp.FindPartGuid(BuiltInShape.Circular, BuiltInShape.Circular, BuiltInShape.Circular,
BuiltInShape.Circular, jointConnType, jointConnType, jointConnType, jointConnType, jointType, false,
2.0);
//These don't return the joint type
var couplingId = rp.FindPartGuid(jointType, 2.0);
couplingId = rp.FindPartGuid(Type.Coupling, 2.0);
//All these work as expected
var cross = rp.FindPartGuid(Type.Cross, 2.0);
var elbowId = rp.FindPartGuid(Type.Elbow, 2.0);
var flex = rp.FindPartGuid(Type.PipeFlex, 2.0);
var lateral = rp.FindPartGuid(Type.Lateral, 2.0);
var pipeId = rp.FindPartGuid(Type.Pipe, 2.0);
var takeoff = rp.FindPartGuid(Type.Takeoff, 2.0);
var tee = rp.FindPartGuid(Type.Tee, 2.0);
var wye = rp.FindPartGuid(Type.Wye, 2.0);
var concentric = rp.FindPartGuid(Type.Transition, 2.0);
var eccentric = rp.FindEccentricPartGuid(Type.Transition, true, 2.0);
tr.Commit();
}