void GenerateLink() { Database db = Application.DocumentManager.MdiActiveDocument.Database; Line Elem = new Line(); DBPoint Node = new DBPoint(); Point3d pt = new Point3d(); double earthkeyx1 = -30000; double earthkeyx2 = -80000; List <double> earthxlist = Linsteps(earthkeyx1, earthkeyx2, -5000).ToList(); List <double> towerzlist = Linsteps(FrontE.StartPoint.Z, FrontE.StartPoint.Z + 10 * 2500, 2500).ToList(); List <double> beamxlist = Linsteps(keyx3, keyx4, cabledx).ToList(); int nearth, ntower, nbeam; int comm = -1; foreach (double tz in towerzlist) { comm++; for (int dir = -1; dir <= 2; dir += 2) { double ex = earthxlist[comm]; double bx = beamxlist[comm]; double ey = dir * 11000; pt = new Point3d(ex, ey, 0); Node = new DBPoint(pt); Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); nearth = GlobalNodeId; GlobalNodeId++; double tx = GetBackXCoord(tz); double ty = dir * Math.Sqrt((tz - tlevel) * (11000 * 11000) / (beamlevel - tlevel)); pt = new Point3d(tx, ty, tz); Node = new DBPoint(pt); ntower = GetClosestDBP(Node); pt = new Point3d(bx, ey, 0); Node = new DBPoint(pt); nbeam = GetClosestDBP(Node); if (nbeam == -1 || ntower == -1 || nearth == -1) { ; } Elem = new Line(NodeList[GetNodeListIndex(nearth)].Position, NodeList[GetNodeListIndex(ntower)].Position); Elem.SetElemXData(db, nearth, ntower, 0, GlobalElemId, "背索"); ElemList.Add(Elem); GlobalElemId++; Elem = new Line(NodeList[GetNodeListIndex(ntower)].Position, NodeList[GetNodeListIndex(nbeam)].Position); Elem.SetElemXData(db, ntower, nbeam, 0, GlobalElemId, "主索"); ElemList.Add(Elem); GlobalElemId++; } } }
/// <summary> /// 生成拱肋节点、单元 /// </summary> /// <returns></returns> void GenArchPoints() { Database db = Application.DocumentManager.MdiActiveDocument.Database; DBPoint Ni, Nj; Line Elem = new Line(); DBPoint Node; for (int j = 0; j < 2; j++) { foreach (double x0 in Xlist) { double xx = x0 / 1000; double yy = 0.9397 * Math.Sqrt(200 * xx - xx * xx + 7963.93) - 0.9397 * Math.Sqrt(7963.93); double zz = 0; if (j == 0) { zz = 0.3420 * Math.Sqrt(200 * xx - xx * xx + 7963.93) - 0.3420 * Math.Sqrt(7963.93); } else { zz = 0.3420 * Math.Sqrt(200 * xx - xx * xx + 7963.93) - 0.3420 * Math.Sqrt(7963.93); zz = -zz - 35.8; } Point3d pt = new Point3d(xx * 1000, yy * 1000, zz * 1000); Node = new DBPoint(pt); Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); GlobalNodeId++; // 单元 Nj = Node; if (x0 != Xlist[0]) { var previesid = from n in NodeList where n.GetID() == Nj.GetID() - 1 select n; Ni = previesid.ToList()[0]; Elem = new Line(Ni.Position, Nj.Position); int nk = j == 0 ? 9999 : 8888; Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(), nk, GlobalElemId, "拱肋"); ElemList.Add(Elem); double dx = Math.Max(Math.Abs(Nj.Position.X - 100000), Math.Abs(Ni.Position.X - 100000)); double height = 3000 + dx / 100000 * 500; ArchHeightList.Add(GlobalElemId, height); if (Math.Abs(x0 - 100000) >= 40000) { ArchThickList.Add(GlobalElemId, 70); } else if (Math.Abs(x0 - 100000) >= 20000) { ArchThickList.Add(GlobalElemId, 60); } else { ArchThickList.Add(GlobalElemId, 50); } GlobalElemId++; } } } return; }
/// <summary> /// 生成桥面系 /// </summary> void GenBeamPoints() { Database db = Application.DocumentManager.MdiActiveDocument.Database; DBPoint Ni, Nj; Line Elem = new Line(); DBPoint Node; foreach (double x0 in Xlist) { foreach (double z0 in Zlist) { if ((x0 == Xlist[0] || x0 == Xlist[Xlist.Length - 1]) && (z0 != Zlist[1])) { continue; } Node = new DBPoint(new Point3d(x0, 0, z0)); Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); GlobalNodeId++; } } foreach (double x0 in Xlist) { foreach (double z0 in Zlist) { if (z0 == Zlist[0]) { continue; } else { var njsel = from nn in NodeList where nn.Position.X == x0 && nn.Position.Z == z0 select nn; Nj = njsel.ToList()[0]; int index = Zlist.ToList().FindIndex(item => item.Equals(z0)); var nisel = from nj in NodeList where nj.Position.X == x0 && nj.Position.Z == Zlist[index - 1] select nj; Ni = nisel.ToList()[0]; Elem = new Line(Ni.Position, Nj.Position); Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(), 7777, GlobalElemId, "刚臂"); ElemList.Add(Elem); GlobalElemId++; } } } foreach (double x0 in Xlist) { double z0 = -17900; if (x0 != Xlist[0]) { var njsel = from nn in NodeList where nn.Position.X == x0 && nn.Position.Z == z0 select nn; Nj = njsel.ToList()[0]; int index = Xlist.ToList().FindIndex(item => item.Equals(x0)); var nisel = from nj in NodeList where nj.Position.X == Xlist[index - 1] && nj.Position.Z == z0 select nj; Ni = nisel.ToList()[0]; Elem = new Line(Ni.Position, Nj.Position); Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(), 7777, GlobalElemId, "主梁"); //if (z0==Zlist[2]) //{ // Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(),7777, GlobalElemId,"主梁"); //} //else //{ // Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(),7777,GlobalElemId, "刚臂"); //} ElemList.Add(Elem); GlobalElemId++; } } }
void GenerateTower() { Database db = Application.DocumentManager.MdiActiveDocument.Database; Line Elem = new Line(); DBPoint Node; List <double> tmp = Linsteps(BackLineA.EndPoint.Z, FrontA.EndPoint.Z, ElemSize).ToList(); tmp = tmp.Concat(Linsteps(FrontA.EndPoint.Z, FrontB.StartPoint.Z, ElemSize)).ToList(); tmp = tmp.Concat(Linsteps(FrontB.StartPoint.Z, FrontC.EndPoint.Z, ElemSize)).ToList(); tmp = tmp.Concat(Linsteps(FrontC.EndPoint.Z, 0, ElemSize)).ToList(); tmp = tmp.Concat(Linsteps(0, FrontD.StartPoint.Z, ElemSize)).ToList(); tmp = tmp.Concat(Linsteps(FrontD.StartPoint.Z, FrontE.StartPoint.Z, ElemSize)).ToList(); tmp = tmp.Concat(Linsteps(FrontE.StartPoint.Z, BackLineB.StartPoint.Z, 2500)).ToList(); tmp = tmp.Concat(Linsteps(BackLineB.StartPoint.Z, BackLineC.EndPoint.Z, 2500)).ToList(); List <double> zlist = new List <double>(); foreach (double a in tmp) { if (zlist.Contains(a)) { continue; } zlist.Add(a); } double xback = 0, xfront = 0; double yleft = 0, yright = 0; List <int> thisLayer = new List <int>(); List <int> lastLayer = new List <int>(); Point3d pt; foreach (double zi in zlist) { xback = GetBackXCoord(zi); xfront = GetFrontXCoord(zi); thisLayer.Clear(); if (zi <= beamlevel) { yleft = -11000; yright = 11000; } else { yleft = -Math.Sqrt((zi - tlevel) * (11000 * 11000) / (beamlevel - tlevel)); yright = -yleft; if (double.IsNaN(yleft) || double.IsNaN(yright)) { yleft = 0; yright = 0; } } if (zi < FrontE.StartPoint.Z) { pt = new Point3d(xback, yleft, zi); Node = new DBPoint(pt); if (IsInNodeList(Node) < 0) { Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); thisLayer.Add(GlobalNodeId); GlobalNodeId++; } else { thisLayer.Add(IsInNodeList(Node)); } pt = new Point3d(xback, yright, zi); Node = new DBPoint(pt); if (IsInNodeList(Node) < 0) { Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); thisLayer.Add(GlobalNodeId); GlobalNodeId++; } else { thisLayer.Add(IsInNodeList(Node)); } pt = new Point3d(xfront, yleft, zi); Node = new DBPoint(pt); if (IsInNodeList(Node) < 0) { Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); thisLayer.Add(GlobalNodeId); GlobalNodeId++; } else { thisLayer.Add(IsInNodeList(Node)); } pt = new Point3d(xfront, yright, zi); Node = new DBPoint(pt); if (IsInNodeList(Node) < 0) { Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); thisLayer.Add(GlobalNodeId); GlobalNodeId++; } else { thisLayer.Add(IsInNodeList(Node)); } } else { pt = new Point3d(xback, yleft, zi); Node = new DBPoint(pt); if (IsInNodeList(Node) < 0) { Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); thisLayer.Add(GlobalNodeId); GlobalNodeId++; } else { thisLayer.Add(IsInNodeList(Node)); } pt = new Point3d(xback, yright, zi); Node = new DBPoint(pt); if (IsInNodeList(Node) < 0) { Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); thisLayer.Add(GlobalNodeId); GlobalNodeId++; } else { thisLayer.Add(IsInNodeList(Node)); } } // 增加桥塔控制点 if (zi >= beamlevel) { TowerControlList.Add(thisLayer[0]); } if (zi == zlist[0]) { lastLayer = new List <int> (thisLayer); continue; } else { int tmp_counter = 0; int Ni = 0; //foreach(int Ni in thisLayer) foreach (int Nj in lastLayer) { if (lastLayer.Count != thisLayer.Count) { if (tmp_counter == 2 || tmp_counter == 3) { Ni = thisLayer[tmp_counter - 2]; } else { Ni = thisLayer[tmp_counter]; } } else { Ni = thisLayer[tmp_counter]; } Elem = new Line(NodeList[GetNodeListIndex(Nj)].Position, NodeList[GetNodeListIndex(Ni)].Position); string typename; if (tmp_counter == 0 || tmp_counter == 1) { typename = "后塔"; TowerHeightList.Add(GlobalElemId, GetBackTowerSection(zi)[0]); TowerThickList.Add(GlobalElemId, GetBackTowerSection(zi)[1]); } else { typename = "前塔"; TowerHeightList.Add(GlobalElemId, GetFrontTowerSection(zi)[0]); TowerThickList.Add(GlobalElemId, GetFrontTowerSection(zi)[1]); } Elem.SetElemXData(db, Nj, Ni, 0, GlobalElemId, typename); ElemList.Add(Elem); GlobalElemId++; tmp_counter++; } lastLayer = new List <int>(thisLayer); } } }
void GenerateMainBeam() { Database db = Application.DocumentManager.MdiActiveDocument.Database; Line Elem = new Line(); DBPoint Node = new DBPoint(); Point3d pt = new Point3d(); List <double> tmp = Linsteps(0, keyx1, 2000).ToList(); tmp = tmp.Concat(Linsteps(keyx1, keyx2, 2000)).ToList(); tmp = tmp.Concat(Linsteps(keyx2, keyx3, 2000)).ToList(); tmp = tmp.Concat(Linsteps(keyx3, keyx4, cabledx / 4)).ToList(); tmp = tmp.Concat(Linsteps(keyx4, 220000, 2000)).ToList(); List <double> beamxlist = new List <double>(); foreach (double a in tmp) { if (beamxlist.Contains(a)) { continue; } beamxlist.Add(a); } int ni = GlobalNodeId, nj = 0; foreach (double xx in beamxlist) { pt = new Point3d(xx, 0, beamlevel); Node = new DBPoint(pt); Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); nj = GlobalNodeId; GlobalNodeId++; if (xx != beamxlist[0]) { Elem = new Line(NodeList[GetNodeListIndex(ni)].Position, NodeList[GetNodeListIndex(nj)].Position); string typename = "主梁"; Elem.SetElemXData(db, ni, nj, 0, GlobalElemId, typename); ElemList.Add(Elem); GlobalElemId++; } ni = nj; int nside; if ((xx >= keyx3 && xx <= keyx4 && (xx - keyx3) % cabledx == 0)) { for (double yy = -7750; yy <= 15500; yy += 15500) { pt = new Point3d(xx, yy, beamlevel); Node = new DBPoint(pt); Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); nside = GlobalNodeId; GlobalNodeId++; Elem = new Line(NodeList[GetNodeListIndex(nside)].Position, NodeList[GetNodeListIndex(nj)].Position); string typename = "刚臂"; Elem.SetElemXData(db, nside, nj, 0, GlobalElemId, typename); ElemList.Add(Elem); GlobalElemId++; } } if (xx == keyx1 || xx == keyx2) { for (double yy = -11000; yy <= 11000; yy += 22000) { pt = new Point3d(xx, yy, 100); Node = new DBPoint(pt); Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); nside = GlobalNodeId; GlobalNodeId++; Elem = new Line(NodeList[GetNodeListIndex(nside)].Position, NodeList[GetNodeListIndex(nj)].Position); string typename = "刚臂"; Elem.SetElemXData(db, nside, nj, 0, GlobalElemId, typename); ElemList.Add(Elem); GlobalElemId++; } } } }
void GenerateTowerBeam() { Database db = Application.DocumentManager.MdiActiveDocument.Database; Line Elem = new Line(); DBPoint Node = new DBPoint(); Point3d pt = new Point3d(); List <double> towerX = Linsteps(GetBackXCoord(FrontB.StartPoint.Z), FrontB.StartPoint.X, ElemSize).ToList(); //double dx = FrontC.StartPoint.X - BackLineA.StartPoint.X; //double dz = FrontC.StartPoint.Z - BackLineA.StartPoint.Z; int ni = 0, nj = 0; for (double yy = -11000; yy <= 11000; yy += 22000) { foreach (double xx in towerX) { double zz = FrontB.StartPoint.Z; pt = new Point3d(xx, yy, zz); Node = new DBPoint(pt); if (xx == towerX[0]) { ni = GetClosestDBP(Node); continue; } else if (xx == towerX.Last()) { nj = GetClosestDBP(Node); } else { Node.SetNodeId(db, GlobalNodeId); NodeList.Add(Node); GlobalNodeId++; nj = IsInNodeList(Node); } if (xx != towerX[0]) { Elem = new Line(NodeList[GetNodeListIndex(ni)].Position, NodeList[GetNodeListIndex(nj)].Position); string typename = "桥塔纵梁"; TowerHeightList.Add(GlobalElemId, 5000); TowerThickList.Add(GlobalElemId, 40); Elem.SetElemXData(db, ni, nj, 0, GlobalElemId, typename); ElemList.Add(Elem); GlobalElemId++; } ni = nj; } } var nsel = from nd in NodeList where (nd.Position.Z == BackLineC.EndPoint.Z) select nd.XData.AsArray()[0].Value; Elem = new Line(NodeList[GetNodeListIndex((short)nsel.ElementAt(0))].Position, NodeList[GetNodeListIndex((short)nsel.ElementAt(1))].Position); TowerHeightList.Add(GlobalElemId, 4000); TowerThickList.Add(GlobalElemId, 40); Elem.SetElemXData(db, (short)nsel.ElementAt(0), (short)nsel.ElementAt(1), 0, GlobalElemId, "后塔"); ElemList.Add(Elem); GlobalElemId++; }