Author Topic: Autocad ACA/MEP Routing Preference Coupling  (Read 1398 times)

0 Members and 1 Guest are viewing this topic.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Autocad ACA/MEP Routing Preference Coupling
« on: June 16, 2015, 07:43:19 AM »
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.

Code: [Select]
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();
            }
Revit 2019, AMEP 2019 64bit Win 10

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Autocad ACA/MEP Routing Preference Coupling
« Reply #1 on: June 16, 2015, 10:57:50 AM »
I got it. It was my fault.  I was using the one type of routing preference where the joint is null.  When I change the joint type to anything other than Butt Weld
Code: [Select]
rp.FindPartGuid(Type.Coupling, 2.0) works like you would expect.
Revit 2019, AMEP 2019 64bit Win 10