MexicanCustard 发表于 2015-6-16 07:43:19

AutoCAD ACA/MEP路由偏好耦合

我正在尝试从布管系统配置中获取接头类型/配件。我已经能够在布管系统配置中设置所有其他配件,但我不知道如何获得接头配件。任何人都有这方面的经验。
using (var tr = db.TransactionManager.StartTransaction())
            {
                var modelSpace = db.ModelSpace(OpenMode.ForWrite);
                var dict = new DictionaryPipePartRoutingPreferencesStyle(db);
                var rp = dict.Records.Cast()
                  .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();
            }
**** Hidden Message *****

MexicanCustard 发表于 2015-6-16 10:57:50

我明白了。这是我的错。我使用了一种类型的路由首选项,其中接头为空。当我将接头类型更改为对接焊以外的任何内容时,
rp.FindPartGuid(Type.Coupling, 2.0)
就像您所期望的那样工作。
页: [1]
查看完整版本: AutoCAD ACA/MEP路由偏好耦合