Exemplo n.º 1
0
 public void ToMidasMct_CableForce(string filepath)
 {
     using (StreamWriter file = new StreamWriter(Path.Combine(filepath, "调索.mct"),
                                                 false, System.Text.Encoding.GetEncoding("gbk")))
     {
         MCTWriter.CableForce(file, this);
     }
 }
Exemplo n.º 2
0
        public void ToMidasMct(string filepath)
        {
            using (StreamWriter file = new StreamWriter(Path.Combine(filepath, "VictoriaBridge.mct"),
                                                        false, System.Text.Encoding.GetEncoding("gbk")))
            {
                //==============================================================================================
                // Begin
                //==============================================================================================
                MCTWriter.Beginning(file);
                //==============================================================================================
                // Section
                //==============================================================================================
                file.WriteLine("*SECTION");
                foreach (int key in TowerHeightList.Keys)
                {
                    if ((string)ElemList[GetElemListIndex(key)].XData.AsArray()[4].Value == "桥塔纵梁")
                    {
                        file.WriteLine("{0},DBUSER,TowerS-{1},CB,0,0,0,0,0,0,YES,NO,BSTF,2,{2:F3},4000,{3:F3},{4:F3}," +
                                       "500,220,22,500,220,22,7,{5}", key, key, TowerHeightList[key], TowerThickList[key], TowerThickList[key],
                                       ((int)TowerHeightList[key] / 500.0));
                    }
                    else
                    {
                        file.WriteLine("{0},DBUSER,TowerS-{1},CC,0,0,0,0,0,0,YES,NO,BSTF,2,{2:F3},4000,{3:F3},{4:F3}," +
                                       "500,220,22,500,220,22,7,{5}", key, key, TowerHeightList[key], TowerThickList[key], TowerThickList[key],
                                       ((int)TowerHeightList[key] / 500.0));
                    }
                }
                file.WriteLine("501, DBUSER, cable, CC, 0, 0, 0, 0, 0, 0, YES,NO, SR , 2,100, 0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("503, DBUSER, Rig, CC, 0, 0, 0, 0, 0, 0, YES,NO, SR , 2, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("519,DBUSER,cable-19,CC,0,0,0,0,0,0,YES,NO,SR,2, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("531,DBUSER,cable-31,CC,0,0,0,0,0,0,YES,NO,SR,2, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("537,DBUSER,C15.2-37,CC,0,0,0,0,0,0,YES,NO,SR,2, 81,0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("543,DBUSER,C15.2-43,CC,0,0,0,0,0,0,YES,NO,SR,2, 87,0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("555,DBUSER,C15.2-55,CC,0,0,0,0,0,0,YES,NO,SR,2, 99,0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("561,DBUSER,C15.2-61,CC,0,0,0,0,0,0,YES,NO,SR,2,104,0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("573,DBUSER,C15.2-73,CC,0,0,0,0,0,0,YES,NO,SR,2,114,0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("585,DBUSER,C15.2-85,CC,0,0,0,0,0,0,YES,NO,SR,2,123,0, 0, 0, 0, 0, 0, 0, 0, 0");
                file.WriteLine("591,DBUSER,C15.2-91,CC,0,0,0,0,0,0,YES,NO,SR,2,127,0, 0, 0, 0, 0, 0, 0, 0, 0");
                MCTWriter.CompositeSection(file);

                //==============================================================================================
                // Node
                //==============================================================================================
                file.WriteLine("*NODE");
                foreach (DBPoint node in NodeList)
                {
                    int n = (short)node.XData.AsArray()[0].Value;
                    file.WriteLine("{0},{1:F3},{2:F3},{3:F3}", n, node.Position.X, node.Position.Y, node.Position.Z);
                }
                file.WriteLine("*ELEMENT");

                foreach (Line elem in ElemList)
                {
                    int    e          = (short)elem.XData.AsArray()[3].Value;
                    int    ni         = (short)elem.XData.AsArray()[0].Value;
                    int    nj         = (short)elem.XData.AsArray()[1].Value;
                    string typestring = (string)elem.XData.AsArray()[4].Value;
                    if (typestring == "主梁")
                    {
                        file.WriteLine("{0},BEAM,4,601,{1},{2},0", e, ni, nj, GetFixAng(elem));
                    }
                    else if (typestring == "刚臂")
                    {
                        file.WriteLine("{0},BEAM,9,503,{1},{2},0", e, ni, nj);
                    }
                    else if (typestring == "主索")
                    {
                        if (elem.Bounds.Value.MaxPoint.X <= 153000)
                        {
                            file.WriteLine("{0},TENSTR,4,531,{1},{2},0,1,0,0,NO", e, ni, nj);
                        }
                        //else if (elem.Bounds.Value.MaxPoint.X <= 153000)
                        //{
                        //    file.WriteLine("{0},TENSTR,4,512,{1},{2},0,1,0,0,NO", e, ni, nj);
                        //}
                        //else if (elem.Bounds.Value.MaxPoint.X <= 189000)
                        //{
                        //    file.WriteLine("{0},TENSTR,4,513,{1},{2},0,1,0,0,NO", e, ni, nj);
                        //}
                        else
                        {
                            file.WriteLine("{0},TENSTR,4,519,{1},{2},0,1,0,0,NO", e, ni, nj);
                        }
                    }
                    else if (typestring == "背索")
                    {
                        if (elem.Bounds.Value.MinPoint.X >= -45000)
                        {
                            file.WriteLine("{0},TENSTR,4,537,{1},{2},0,1,0,0,NO", e, ni, nj);
                        }
                        else
                        {
                            file.WriteLine("{0},TENSTR,4,543,{1},{2},0,1,0,0,NO", e, ni, nj);
                        }
                    }
                    else
                    {
                        file.WriteLine("{0},BEAM,4,{0},{1},{2},{3}", e, ni, nj, GetFixAng(elem));
                    }
                }

                // 575, TENSTR,    1,   467,   374,   515,     0,     1,     0,     0, NO

                //==============================================================================================
                // Constraint
                //==============================================================================================
                file.WriteLine("*CONSTRAINT");
                var nsel = from nd in NodeList where nd.Position.Z == BackLineA.EndPoint.Z select nd.XData.AsArray()[0].Value;

                foreach (short ni in nsel)
                {
                    string fixid = "111111";
                    file.WriteLine("{0},{1},AllBNDR", ni, fixid);
                }

                nsel = from nd in NodeList where nd.Position.X < 0 select nd.XData.AsArray()[0].Value;

                foreach (short ni in nsel)
                {
                    string fixid = "111111";
                    file.WriteLine("{0},{1},AllBNDR", ni, fixid);
                }

                nsel = from nd in NodeList where (nd.Position.X == 0) select nd.XData.AsArray()[0].Value;

                foreach (short ni in nsel)
                {
                    string fixid = "111000";
                    file.WriteLine("{0},{1},AllBNDR", ni, fixid);
                }

                nsel = from nd in NodeList where (nd.Position.X == 220000) select nd.XData.AsArray()[0].Value;

                foreach (short ni in nsel)
                {
                    string fixid = "011000";
                    file.WriteLine("{0},{1},AllBNDR", ni, fixid);
                }
                file.WriteLine("*ELASTICLINK");
                double zz = FrontC.EndPoint.Z;

                nsel = from nd in NodeList where (nd.Position.X == keyx1) && (nd.Position.Y == 11000) select nd.XData.AsArray()[0].Value;

                file.WriteLine(" 1,{0},{1},GEN,0,10e10,0, 0, 0, 0, 0, NO, 0.5, 0.5,AllBNDR", nsel.ElementAt(0), nsel.ElementAt(1));
                nsel = from nd in NodeList where (nd.Position.X == keyx1) && (nd.Position.Y == -11000) select nd.XData.AsArray()[0].Value;

                file.WriteLine(" 2,{0},{1},GEN,0,10e10,0, 0, 0, 0, 0, NO, 0.5, 0.5,AllBNDR", nsel.ElementAt(0), nsel.ElementAt(1));
                nsel = from nd in NodeList where (nd.Position.X == keyx2) && (nd.Position.Y == 11000) select nd.XData.AsArray()[0].Value;

                file.WriteLine(" 3,{0},{1},GEN,0,10e10,0, 0, 0, 0, 0, NO, 0.5, 0.5,AllBNDR", nsel.ElementAt(0), nsel.ElementAt(1));
                nsel = from nd in NodeList where (nd.Position.X == keyx2) && (nd.Position.Y == -11000) select nd.XData.AsArray()[0].Value;

                file.WriteLine(" 4,{0},{1},GEN,0,10e10,0, 0, 0, 0, 0, NO, 0.5, 0.5,AllBNDR", nsel.ElementAt(0), nsel.ElementAt(1));


                //                *ELASTICLINK
                //   1,   158,   414, GEN  ,     0, 1111, 0, 0, 0, 0, 0, NO, 0.5, 0.5,
                //==============================================================================================
                // Load
                //==============================================================================================
                file.WriteLine("*GROUP");
                file.WriteLine("AllBridge, 1to{0}, 1to{1}, 0", GlobalNodeId - 1, GlobalElemId - 1);
                MCTWriter.CableIniForce(file, this);
                file.WriteLine("*STLDCASE");
                file.WriteLine("DeadLoad,USER,");
                file.WriteLine("*LOADTOMASS, XYZ, YES, YES, YES, YES, 9806");
                file.WriteLine("DeadLoad, 1");
                file.WriteLine("*USE-STLD, DeadLoad");
                file.WriteLine("*SELFWEIGHT, 0, 0, -1,AllLoad");
                file.WriteLine("*CONLOAD");
                var nnsel = from nd in NodeList where nd.Position.Y == 0 select nd.XData.AsArray()[0].Value;

                ///人行道板 + 底座:6kN / m
                ///钢护栏:1kN / m
                ///铺装2.4ton/m3
                double ww     = (6 + 1 + 1) * 2.0 * 220 * 1000;
                double liqing = 2.4 * 0.1 * 8.2 * 220.0 * 1000 * 9.8;
                double fn     = (ww + liqing) / nnsel.Count() * -1.0;
                foreach (short n in nnsel)
                {
                    file.WriteLine("{0}, 0, 0, {1:F3}, 0, 0, 0,AllLoad ", n, fn);
                }
                //MCTWriter.CableForceForLC(file,this);
                //==============================================================================================
                file.WriteLine("*ENDDATA");
            }
        }