/// <summary> /// 这个函数线的方向和现有的还不太一样,还不能直接替换 TODO:修改点位顺序 /// </summary> public TxPolyline GetBottomPolyline(double precision) { double lengthFloorNormal = Math.Max(0, LengthHoriSup + LengthBottom - LengthCrossBeam - LengthFloor); //变高范围内底板等厚段长度,有可能是会小于0,但是目前没有去支持这样的情况,直接判定掉了 double lengthFloorChange = LengthHoriSup + LengthBottom - lengthFloorNormal - Math.Max(LengthCrossBeam + CvFloor, LengthHoriSup); //底板厚度变化段 double lengthFloorRemain = Math.Max(0, LengthBottom - lengthFloorNormal - lengthFloorChange); //剩余倒角段部分,未伸至全长 List <double> segFloorNormal = TX_Math.Design.BJ(lengthFloorNormal, precision, TX_Math.Design.BJType.Average); List <double> segFloorChange = TX_Math.Design.BJ(lengthFloorChange, precision, TX_Math.Design.BJType.Average); List <double> segFloorRemain = TX_Math.Design.BJ(lengthFloorRemain, precision, TX_Math.Design.BJType.Average); List <double> segCtl = new List <double>(); segCtl.AddRange(segFloorRemain); segCtl.AddRange(segFloorChange); segCtl.AddRange(segFloorNormal); TxPolyline result = new TxPolyline(); //添加墩顶水平段 if (LengthHoriSup > 0) { result.AddVertexAt(new Point3d(-LengthHoriSup, 0, 0)); } ParabolaEquation bottomEquation = this.BottomEquation; //从左往右顺序添加节点 double tempX = 0; for (int i = 0; i < segCtl.Count; i++) { Point3d tempPt = bottomEquation.GetPoint(tempX); result.AddVertexAt(tempPt); tempX += segCtl[i]; } //添加顶点 result.AddVertexAt(BottomEquation.Apex); return(result); }
public override void DrawDM(DatabaseToAcad block) { // WT1 WT2 // 2 0 3 // |-------------------------------------------| // | 12 8 9 13 | // 4|------------ 6 7 -----------|5 // \_ | 2|-/-------\-|3 | _/ // \| |/ \| |/ // \ 4| |5 / // 10| | | |11 // | | | | // | | | | // | |___________| | // | 0 1 | // |---------------------| // 6 1 7 // WD List<Point3d> dmPoints = new List<Point3d>(); MTL_Math.Array2.SetArray(dmPoints, 14); dmPoints[0] = new Point3d(DeckPoint.X, DeckPoint.Y + H, 0); dmPoints[1] = new Point3d(dmPoints[0].X, dmPoints[0].Y - H, 0); dmPoints[2] = new Point3d(dmPoints[0].X - WT1, dmPoints[0].Y - WT1 * iT, 0); dmPoints[3] = new Point3d(dmPoints[0].X + WT2, dmPoints[0].Y + WT2 * iT, 0); dmPoints[4] = new Point3d(dmPoints[2].X, dmPoints[2].Y - HT, 0); dmPoints[5] = new Point3d(dmPoints[3].X, dmPoints[3].Y - HT, 0); dmPoints[6] = new Point3d(dmPoints[0].X - WD * 0.5, dmPoints[0].Y - H, 0); dmPoints[7] = new Point3d(dmPoints[0].X + WD * 0.5, dmPoints[0].Y - H, 0); TxLine xlinef1 = new TxLine(dmPoints[6], new Point3d(dmPoints[6].X - H * 0.25, dmPoints[6].Y + H, 0));//左腹板外侧线 TxLine xlinef2 = new TxLine(dmPoints[7], new Point3d(dmPoints[7].X + H * 0.25, dmPoints[7].Y + H, 0));//右腹板外侧线 TxLine xlineJY = new TxLine(dmPoints[4] - Vector3d.YAxis * JYY, dmPoints[5] - Vector3d.YAxis * JYY);//顶板加腋处虚拟水平线 //dmPoints[8] = AcadAssist.GetIntersectionPoint(xlinef1, new TxLine(dmPoints[4], dmPoints[5])); //dmPoints[9] = AcadAssist.GetIntersectionPoint(xlinef2, new TxLine(dmPoints[4], dmPoints[5])); //dmPoints[10] = AcadAssist.GetIntersectionPoint(xlinef1, xlineJY); //dmPoints[11] = AcadAssist.GetIntersectionPoint(xlinef2, xlineJY); dmPoints[8] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef1, new TxLine(dmPoints[4], dmPoints[5])); dmPoints[9] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef2, new TxLine(dmPoints[4], dmPoints[5])); dmPoints[10] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef1, xlineJY); dmPoints[11] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef2, xlineJY); dmPoints[12] = new Point3d(dmPoints[8].X - JYX, dmPoints[8].Y - JYX * iT, 0); dmPoints[13] = new Point3d(dmPoints[9].X + JYY, dmPoints[9].Y + JYX * iT, 0); List<Point3d> dmPoints2 = new List<Point3d>(); MTL_Math.Array2.SetArray(dmPoints2, 8); dmPoints2[0] = new Point3d(dmPoints[6].X + WFb - HD * 0.25, dmPoints[6].Y + HD, 0); dmPoints2[1] = new Point3d(dmPoints[7].X - WFb + HD * 0.25, dmPoints[7].Y + HD, 0); TxLine xlinef3 = new TxLine(xlinef1.StartPoint + Vector3d.XAxis * WFb, xlinef1.EndPoint + Vector3d.XAxis * WFb);//左腹板内侧线 TxLine xlinef4 = new TxLine(xlinef2.StartPoint - Vector3d.XAxis * WFb, xlinef2.EndPoint - Vector3d.XAxis * WFb);//左腹板内侧线 ////dmPoints2[2] = AcadAssist.GetIntersectionPoint(xlinef3, new TxLine(dmPoints[4], dmPoints[5])); ////dmPoints2[3] = AcadAssist.GetIntersectionPoint(xlinef4, new TxLine(dmPoints[4], dmPoints[5])); ////dmPoints2[4] = AcadAssist.GetIntersectionPoint(xlinef3, xlineJY); ////dmPoints2[5] = AcadAssist.GetIntersectionPoint(xlinef4, xlineJY); dmPoints2[2] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef3, new TxLine(dmPoints[4], dmPoints[5])); dmPoints2[3] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef4, new TxLine(dmPoints[4], dmPoints[5])); dmPoints2[4] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef3, xlineJY); dmPoints2[5] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef4, xlineJY); double Point6X = Math.Abs(dmPoints2[4].X - dmPoints[0].X) - CTX; double Point7X = Math.Abs(dmPoints2[5].X - dmPoints[0].X) - CTX; dmPoints2[6] = new Point3d(dmPoints[0].X - Point6X, dmPoints[0].Y - Point6X * iT - HT, 0); dmPoints2[7] = new Point3d(dmPoints[0].X + Point7X, dmPoints[0].Y + Point7X * iT - HT, 0); //交通部的小箱梁处理倒角不一样,外侧倒角从交点向外偏移180,内侧倒角从下面点偏移150 TxPolyline pline1 = new TxPolyline(); pline1.AddVertexAt(0, new Point2d(dmPoints[2].X, dmPoints[2].Y), 0, 0, 0); pline1.AddVertexAt(1, new Point2d(dmPoints[3].X, dmPoints[3].Y), 0, 0, 0); pline1.AddVertexAt(2, new Point2d(dmPoints[5].X, dmPoints[5].Y), 0, 0, 0); pline1.AddVertexAt(3, new Point2d(dmPoints[13].X, dmPoints[13].Y), 0, 0, 0); pline1.AddVertexAt(4, new Point2d(dmPoints[11].X, dmPoints[11].Y), 0, 0, 0); pline1.AddVertexAt(5, new Point2d(dmPoints[7].X, dmPoints[7].Y), 0, 0, 0); pline1.AddVertexAt(6, new Point2d(dmPoints[6].X, dmPoints[6].Y), 0, 0, 0); pline1.AddVertexAt(7, new Point2d(dmPoints[10].X, dmPoints[10].Y), 0, 0, 0); pline1.AddVertexAt(8, new Point2d(dmPoints[12].X, dmPoints[12].Y), 0, 0, 0); pline1.AddVertexAt(9, new Point2d(dmPoints[4].X, dmPoints[4].Y), 0, 0, 0); pline1.AddVertexAt(10, new Point2d(dmPoints[2].X, dmPoints[2].Y), 0, 0, 0); TxPolyline pline2 = new TxPolyline(); pline2.AddVertexAt(0, new Point2d(dmPoints2[6].X, dmPoints2[6].Y), 0, 0, 0); pline2.AddVertexAt(1, new Point2d(dmPoints2[7].X, dmPoints2[7].Y), 0, 0, 0); pline2.AddVertexAt(2, new Point2d(dmPoints2[5].X, dmPoints2[5].Y), 0, 0, 0); pline2.AddVertexAt(3, new Point2d(dmPoints2[1].X, dmPoints2[1].Y), 0, 0, 0); pline2.AddVertexAt(4, new Point2d(dmPoints2[0].X, dmPoints2[0].Y), 0, 0, 0); pline2.AddVertexAt(5, new Point2d(dmPoints2[4].X, dmPoints2[4].Y), 0, 0, 0); pline2.AddVertexAt(6, new Point2d(dmPoints2[6].X, dmPoints2[6].Y), 0, 0, 0); block.AddPolyline(pline1, CommonLayer.gz1layer); block.AddPolyline(pline2, CommonLayer.gz1layer); //绘制横隔板 //double Hgb = H - 200;//横隔板高度(从顶板算起) List<Point3d> gbPoints = new List<Point3d>(); MTL_Math.Array2.SetArray(gbPoints, 4); TxLine xlineGB = new TxLine(dmPoints[2] - Vector3d.YAxis * HGB, dmPoints[3] - Vector3d.YAxis * HGB);//横隔板处虚拟水平线 gbPoints[0] = new Point3d(dmPoints[2].X, dmPoints[2].Y - HGB, 0); gbPoints[1] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef1, xlineGB); gbPoints[2] = new Point3d(dmPoints[3].X, dmPoints[3].Y - HGB, 0); gbPoints[3] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef2, xlineGB); if (type == BeamLocate.Left || type == BeamLocate.Mid) { block.AddLine(dmPoints[5], gbPoints[2], CommonLayer.gz1layer); block.AddLine(gbPoints[2], gbPoints[3], CommonLayer.gz1layer); } if (type == BeamLocate.Right || type == BeamLocate.Mid) { block.AddLine(dmPoints[4], gbPoints[0], CommonLayer.gz1layer); block.AddLine(gbPoints[0], gbPoints[1], CommonLayer.gz1layer); } }
/// <summary> /// 这个函数线的方向和现有的还不太一样,还不能直接替换 TODO:修改点位顺序 /// </summary> public TxPolyline GetFloorPolyline(double precision) { //一种是虚交点,这个应该是直接用方程计算 //一种是算控制点分段计算 if (IsByVirtualPoint) { double lengthFloorChange = LengthFloor - CvFloor; //底板厚度变化段 List <double> segFloor = TX_Math.Design.BJ(lengthFloorChange, precision, TX_Math.Design.BJType.Average); Point3d apex = new Point3d(LengthBottom, MaxBeamHeight - MinBeamHeight + MinFloorThick, 0); Point3d pt2 = new Point3d(0, MaxFloorThick, 0); ParabolaEquation equation = ParabolaEquation.CreateEquation(PowOfFloor, apex, pt2); TxPolyline result = new TxPolyline(); //从左往右顺序添加节点 double tempX = CvFloor; for (int i = 0; i < segFloor.Count; i++) { Point3d tempPt = equation.GetPoint(tempX); result.AddVertexAt(tempPt); tempX += segFloor[i]; } //添加顶点 result.AddVertexAt(apex); return(result); } else { double lengthFloorNormal = Math.Max(0, LengthHoriSup + LengthBottom - LengthCrossBeam - LengthFloor); //变高范围内底板等厚段长度,有可能是会小于0,但是目前没有去支持这样的情况,直接判定掉了 double lengthFloorChange = LengthHoriSup + LengthBottom - lengthFloorNormal - Math.Max(LengthCrossBeam + CvFloor, LengthHoriSup); // 底板厚度变化段 List <double> segFloorNormal = TX_Math.Design.BJ(lengthFloorNormal, precision, TX_Math.Design.BJType.Average); List <double> segFloorChange = TX_Math.Design.BJ(lengthFloorNormal, precision, TX_Math.Design.BJType.Average); List <double> segCtl = new List <double>(); segCtl.AddRange(segFloorChange); segCtl.AddRange(segFloorNormal); //底板上缘看原先的书写是底板厚度的变化值是按照抛物线来计算的,与底板下缘线型采用抛物线有一些不一样 Point3d apexFloor = new Point3d(LengthFloor, 0, 0); Point3d pt2Floor = new Point3d(0, MaxFloorThick - MinFloorThick, 0); ParabolaEquation equationFloor = ParabolaEquation.CreateEquation(PowOfFloor, apexFloor, pt2Floor); TxPolyline result = new TxPolyline(); //这里有个异常情况是倒角段也没伸出平段,这里特殊处理一下添加一个平段 if (LengthCrossBeam + CvFloor - LengthHoriSup < 0) { result.AddVertexAt(new Point3d(LengthCrossBeam + CvFloor - LengthHoriSup, MaxFloorThick, 0)); } //从左往右顺序添加节点 double tempX = Math.Max(0, LengthCrossBeam + CvFloor - LengthHoriSup); for (int i = 0; i < segCtl.Count; i++) { Point3d tempPt = BottomEquation.GetPoint(tempX); double thick = equationFloor.GetY(tempX); tempPt += Vector3d.YAxis * thick; result.AddVertexAt(tempPt); tempX += segCtl[i]; } //添加顶点 result.AddVertexAt(BottomEquation.Apex + Vector3d.YAxis * MinFloorThick); return(result); } }
public void DrawPM(DatabaseToAcad block) { // 1a 2a // /-----------------/-----------------------/ // / 3a / 5a / // 1c/----\_ 4a / 6a_/-------/2c // / \---------/--------------/ / // 1/-----------------/-----------------------/ // / __/--------/---------------\ / // 1d/ -----/ 4b / 6b \-----/2d // / 3b / 5b / // /-----------------/-----------------------/ //1b 2b if (center != null && center.StartPoint.X > center.EndPoint.X) { center = AcadAssist.ReverseTxLine(center); } if (borderDn != null && borderDn.StartPoint.X > borderDn.EndPoint.X) { borderDn = AcadAssist.ReverseCurve(borderDn); } if (borderUp != null && borderUp.StartPoint.X > borderUp.EndPoint.X) { borderUp = AcadAssist.ReverseCurve(borderUp); } TxLine center2 = null; TxCurve borderDn2 = null; TxCurve borderUp2 = null; if (center == null) { center2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0)); } else { center2 = AcadAssist.CloneTxLine(center); } if (borderDn == null) { borderDn2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0)); } else { borderDn2 = AcadAssist.CloneTxCurve(borderDn); } if (borderUp == null) { borderUp2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0)); } else { borderUp2 = AcadAssist.CloneTxCurve(borderUp); } TxLine borderLeft = new TxLine(borderDn2.StartPoint, borderUp2.StartPoint); TxLine borderRight = new TxLine(borderDn2.EndPoint, borderUp2.EndPoint); Vector3d vectCenterLine = center2.StartPoint.GetVectorTo(center2.EndPoint).GetNormal(); Point3d ctPoint1 = center2.StartPoint; //Point3d ctPoint1a = new Point3d(ctPoint1.X + Math.Tan(alf1) * WTL1, ctPoint1.Y + WTL1, 0); //Point3d ctPoint1b = new Point3d(ctPoint1.X - Math.Tan(alf1) * WTL2, ctPoint1.Y - WTL2, 0); Point3d ctPoint1c = ctPoint1 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf1); Point3d ctPoint1d = ctPoint1 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf1); //Point3d ctPoint1c = new Point3d(ctPoint1.X + Math.Tan(alf1) * WD * 0.5, ctPoint1.Y + WD * 0.5, 0); //Point3d ctPoint1d = new Point3d(ctPoint1.X - Math.Tan(alf1) * WD * 0.5, ctPoint1.Y - WD * 0.5, 0); Point3d ctPoint2 = center2.EndPoint; //Point3d ctPoint2a = new Point3d(ctPoint2.X + Math.Tan(alf2) * WTR1, ctPoint1.Y + WTR1, 0); //Point3d ctPoint2b = new Point3d(ctPoint2.X - Math.Tan(alf2) * WTR2, ctPoint1.Y - WTR2, 0); Point3d ctPoint2c = ctPoint2 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf2); Point3d ctPoint2d = ctPoint2 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf2); //Point3d ctPoint2c = new Point3d(ctPoint2.X + Math.Tan(alf2) * WD * 0.5, ctPoint2.Y + WD * 0.5, 0); //Point3d ctPoint2d = new Point3d(ctPoint2.X - Math.Tan(alf2) * WD * 0.5, ctPoint2.Y - WD * 0.5, 0); Point3d ctPoint3 = center2.GetPointAtDist(Ld); Point3d ctPoint3a = new Point3d(ctPoint3.X + Math.Tan(alf1) * WD * 0.5, ctPoint3.Y + WD * 0.5, 0); Point3d ctPoint3b = new Point3d(ctPoint3.X - Math.Tan(alf1) * WD * 0.5, ctPoint3.Y - WD * 0.5, 0); Point3d ctPoint4 = center2.GetPointAtDist(Ld + Ldx); Point3d ctPoint4a = new Point3d(ctPoint4.X + Math.Tan(alf1) * WFb * 0.5, ctPoint3.Y + WFb * 0.5, 0); Point3d ctPoint4b = new Point3d(ctPoint4.X - Math.Tan(alf1) * WFb * 0.5, ctPoint3.Y - WFb * 0.5, 0); Point3d ctPoint5 = center2.GetPointAtDist(L - Ld); Point3d ctPoint5a = new Point3d(ctPoint5.X + Math.Tan(alf2) * WD * 0.5, ctPoint5.Y + WD * 0.5, 0); Point3d ctPoint5b = new Point3d(ctPoint5.X - Math.Tan(alf2) * WD * 0.5, ctPoint5.Y - WD * 0.5, 0); Point3d ctPoint6 = center2.GetPointAtDist(L - Ld - Ldx); Point3d ctPoint6a = new Point3d(ctPoint6.X + Math.Tan(alf2) * WFb * 0.5, ctPoint6.Y + WFb * 0.5, 0); Point3d ctPoint6b = new Point3d(ctPoint6.X - Math.Tan(alf2) * WFb * 0.5, ctPoint6.Y - WFb * 0.5, 0); //外轮廓 //TxLine sideLine1 = new TxLine(ctPoint1a, ctPoint2a); //TxLine sideLine2 = new TxLine(ctPoint1b, ctPoint2b); //block.AddLine(ctPoint1a, ctPoint1b, CommonLayer.gz1layer); //block.AddLine(ctPoint2a, ctPoint2b, CommonLayer.gz1layer); //block.AddLine(ctPoint1a, ctPoint2a, CommonLayer.gz1layer); //block.AddLine(ctPoint1b, ctPoint2b, CommonLayer.gz1layer); //内轮廓 TxPolyline plineUp = new TxPolyline(); plineUp.AddVertexAt(0, new Point2d(ctPoint1c.X, ctPoint1c.Y), 0, 0, 0); plineUp.AddVertexAt(1, new Point2d(ctPoint3a.X, ctPoint3a.Y), 0, 0, 0); plineUp.AddVertexAt(2, new Point2d(ctPoint4a.X, ctPoint4a.Y), 0, 0, 0); plineUp.AddVertexAt(3, new Point2d(ctPoint6a.X, ctPoint6a.Y), 0, 0, 0); plineUp.AddVertexAt(4, new Point2d(ctPoint5a.X, ctPoint5a.Y), 0, 0, 0); plineUp.AddVertexAt(5, new Point2d(ctPoint2c.X, ctPoint2c.Y), 0, 0, 0); //block.AddPolyline(plineUp, CommonLayer.gz2layer); TxPolyline plineDn = new TxPolyline(); plineDn.AddVertexAt(0, new Point2d(ctPoint1d.X, ctPoint1d.Y), 0, 0, 0); plineDn.AddVertexAt(1, new Point2d(ctPoint3b.X, ctPoint3b.Y), 0, 0, 0); plineDn.AddVertexAt(2, new Point2d(ctPoint4b.X, ctPoint4b.Y), 0, 0, 0); plineDn.AddVertexAt(3, new Point2d(ctPoint6b.X, ctPoint6b.Y), 0, 0, 0); plineDn.AddVertexAt(4, new Point2d(ctPoint5b.X, ctPoint5b.Y), 0, 0, 0); plineDn.AddVertexAt(5, new Point2d(ctPoint2d.X, ctPoint2d.Y), 0, 0, 0); //block.AddPolyline(plineDn, CommonLayer.gz2layer); //获取横梁线 List<TxLine> hlCenters; List<TxLine> hlLinesL; List<TxLine> hlLinesR; this.GetHLLine(out hlCenters, out hlLinesL, out hlLinesR); //绘制横梁线--考虑剪切断开 for (int i = 0; i < hlCenters.Count; i++) block.AddLine(hlCenters[i], CommonLayer.cenlayer); for (int i = 0; i < hlLinesL.Count; i++) { Point3d xPoint1 = AcadAssist.GetIntersectionPoint(plineDn, hlLinesL[i]); Point3d xPoint2 = AcadAssist.GetIntersectionPoint(plineDn, hlLinesR[i]); Point3d xPoint3 = AcadAssist.GetIntersectionPoint(plineUp, hlLinesL[i]); Point3d xPoint4 = AcadAssist.GetIntersectionPoint(plineUp, hlLinesR[i]); if (type == BeamLocate.Mid || type == BeamLocate.Left) { block.AddLine(xPoint1, hlLinesL[i].StartPoint, CommonLayer.gz2layer); block.AddLine(xPoint2, hlLinesR[i].StartPoint, CommonLayer.gz2layer); } if (type == BeamLocate.Mid || type == BeamLocate.Right) { block.AddLine(xPoint3, hlLinesL[i].EndPoint, CommonLayer.gz2layer); block.AddLine(xPoint4, hlLinesR[i].EndPoint, CommonLayer.gz2layer); } } //绘制腹板线--纵向 if (type == BeamLocate.Mid || type == BeamLocate.Right) { List<Point3d> xPointsUp = new List<Point3d>(); for (int i = 0; i < hlLinesL.Count; i++) { xPointsUp.AddRange(AcadAssist.GetIntersectionPoints(plineUp, hlLinesL[i])); //Point3dCollection curPointsL = new Point3dCollection(); //plineUp.IntersectWith(hlLinesL[i], Intersect.OnBothOperands, curPointsL, 0, 0); //for (int j = 0; j < curPointsL.Count; j++) // xPointsUp.Add(curPointsL[j]); xPointsUp.AddRange(AcadAssist.GetIntersectionPoints(plineUp, hlLinesR[i])); //Point3dCollection curPointsR = new Point3dCollection(); //plineUp.IntersectWith(hlLinesR[i], Intersect.OnBothOperands, curPointsR, 0, 0); //for (int j = 0; j < curPointsR.Count; j++) //xPointsUp.Add(curPointsR[j]); } xPointsUp.Sort(new CompairPoint3dX()); ////Point3dCollection xPointsUp2 = new Point3dCollection(); ////for (int i = 0; i < xPointsUp.Count; i++) ////{ //// xPointsUp2.Add(xPointsUp[i]); ////} ////DBObjectCollection objCurvesUp = plineUp.GetSplitCurves(xPointsUp2); List<TxCurve> objCurvesUp = AcadAssist.SplitCurveByPoints(plineUp, xPointsUp); //输出基数个数 int count1 = Convert.ToInt32((objCurvesUp.Count + 1) / 2); for (int i = 0; i < count1; i++) { block.AddCurve((TxCurve)objCurvesUp[i * 2], CommonLayer.gz2layer); } } if (type == BeamLocate.Mid || type == BeamLocate.Left) { //腹板线--右侧侧 List<Point3d> xPointsDn = new List<Point3d>(); for (int i = 0; i < hlLinesL.Count; i++) { xPointsDn.AddRange(AcadAssist.GetIntersectionPoints(plineUp, hlLinesL[i])); ////Point3dCollection curPointsL = new Point3dCollection(); ////plineDn.IntersectWith(hlLinesL[i], Intersect.OnBothOperands, curPointsL, 0, 0); ////for (int j = 0; j < curPointsL.Count; j++) //// xPointsDn.Add(curPointsL[j]); ////Point3dCollection curPointsR = new Point3dCollection(); ////plineDn.IntersectWith(hlLinesR[i], Intersect.OnBothOperands, curPointsR, 0, 0); ////for (int j = 0; j < curPointsR.Count; j++) //// xPointsDn.Add(curPointsR[j]); } xPointsDn.Sort(new CompairPoint3dX()); ////Point3dCollection xPointsDn2 = new Point3dCollection(); ////for (int i = 0; i < xPointsDn.Count; i++) ////{ //// xPointsDn2.Add(xPointsDn[i]); ////} List<TxCurve> objCurvesDn = AcadAssist.SplitCurveByPoints(plineDn, xPointsDn); //DBObjectCollection objCurvesDn = plineDn.GetSplitCurves(xPointsDn2); //输出基数个数 int count2 = Convert.ToInt32((objCurvesDn.Count + 1) / 2); for (int i = 0; i < count2; i++) { block.AddCurve((TxCurve)objCurvesDn[i * 2], CommonLayer.gz2layer); } } if (type == BeamLocate.Left) block.AddPolyline(plineUp, CommonLayer.gz2layer); if (type == BeamLocate.Right) block.AddPolyline(plineDn, CommonLayer.gz2layer); //腹板中心线 TxCurve centerLine = AcadAssist.OffsetLineToBoarder(center2, 0, borderLeft, borderRight); block.AddCurve(centerLine, CommonLayer.cenlayer); //中心线长度 Point3d textPoint = center2.GetPointAtDist(center2.Length * 0.4); Vector3d textVect = center2.GetFirstDerivative(textPoint); //double textAngle = textVect.AngleOnPlane(center2.GetPlane()); double textAngle = AcadAssist.AngleOnPlan(textVect, center2); block.AddText(textPoint, String.Format("中心线长度{0:F0}", center2.Length), block.style.RealTextHeigth * 1000, textAngle, CommonLayer.dimlayer, TxTextHorizontalMode.TextCenter, TxTextVerticalMode.TextBottom); //角度标注 for (int i = 0; i < hlCenters.Count; i++) { Point3d hlPointx = AcadAssist.GetIntersectionPoint(center2, hlCenters[i]); Vector3d curVectx = center2.GetFirstDerivative(hlPointx).GetNormal(); Vector3d vectHL = hlCenters[i].EndPoint.GetVectorTo(hlCenters[i].StartPoint).GetNormal(); if (i == hlCenters.Count - 1) block.AddDimAngularFix(hlPointx, hlPointx - curVectx * block.style.BlockScale * 2000, hlPointx + vectHL * block.style.BlockScale * 2000, block.style.DimFirstLayer * 1000); else block.AddDimAngularFix(hlPointx, hlPointx + curVectx * block.style.BlockScale * 2000, hlPointx + vectHL * block.style.BlockScale * 2000, block.style.DimFirstLayer * 1000); } }
/// <summary> /// 绘制梁图 /// </summary> private void DrawBeamSlab() { supportPointsL = new List<Point3d>(); supportPointsR = new List<Point3d>(); //---如果是调试位置,可以打开图块的外边框 IsDrawBlockBorder = true; if (user_curveZX == null || user_cvBoardUp == null || user_cvBoardDn == null || user_pierline1 == null || user_pierline2 == null) { System.Windows.Forms.MessageBox.Show("未选择线。"); return; } xPoint1 = AcadAssist.GetIntersectionPoint(user_curveZX, user_pierline1); xPoint2 = AcadAssist.GetIntersectionPoint(user_curveZX, user_pierline2); Vector3d vectRotate1 = xPoint1.GetVectorTo(xPoint2); //double rotate1Angle = vectRotate1.AngleOnPlane(user_curveZX.GetPlane()); rotate1Angle = AcadAssist.AngleOnPlan(vectRotate1, user_curveZX); curveZX2 = AcadAssist.ConvertToTxPolyline(user_curveZX); cvBoardUp2 = AcadAssist.ConvertToTxPolyline(user_cvBoardUp); cvBoardDn2 = AcadAssist.ConvertToTxPolyline(user_cvBoardDn); pierline12 = (TxLine)user_pierline1.Clone(); pierline22 = (TxLine)user_pierline2.Clone(); curveZX2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1); cvBoardUp2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1); cvBoardDn2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1); pierline12.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1); pierline22.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1); m_storeCLines2 = new List<TxLine>(); for (int i = 0; i < user_storedCLines.Count; i++) { m_storeCLines2.Add((TxLine)user_storedCLines[i].Clone()); m_storeCLines2[i].TransformBy(Matrix3d.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1)); } m_hgbLines2 = new List<TxLine>(); for (int i = 0; i < user_hgbLines.Count; i++) { m_hgbLines2.Add((TxLine)user_hgbLines[i].Clone()); m_hgbLines2[i].TransformBy(Matrix3d.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1)); } if (curveZX2.StartPoint.X > curveZX2.EndPoint.X) curveZX2 = AcadAssist.ReverseTxPolyline(curveZX2); if (cvBoardUp2.StartPoint.X > cvBoardUp2.EndPoint.X) cvBoardUp2 = AcadAssist.ReverseTxPolyline(cvBoardUp2); if (cvBoardDn2.StartPoint.X > cvBoardDn2.EndPoint.X) cvBoardDn2 = AcadAssist.ReverseTxPolyline(cvBoardDn2); if (pierline12.StartPoint.Y > pierline12.EndPoint.Y) pierline12 = AcadAssist.ReverseTxLine(pierline12); if (pierline22.StartPoint.Y > pierline22.EndPoint.Y) pierline22 = AcadAssist.ReverseTxLine(pierline22); try { #region 绘制总体构造信息 [道路设计线,伸缩缝中心线,桩号,墩号,墩位,板梁端部线] //-------------前面还有个中心线的相交-------不相交有没有处理过,是不是已经延长过了,不记得了;这个是新加上的---------- List<Point3d> milePoints1 = AcadAssist.GetIntersectionPoints(curveZX2, pierline12); List<Point3d> milePoints2 = AcadAssist.GetIntersectionPoints(curveZX2, pierline22); if (milePoints1.Count == 0 || milePoints2.Count == 0) System.Windows.Forms.MessageBox.Show("分控线和桥梁边线没有交点"); milePoint1 = AcadAssist.GetIntersectionPoint(curveZX2, pierline12); milePoint2 = AcadAssist.GetIntersectionPoint(curveZX2, pierline22); //伸缩缝中心线线转化为线段 pierline1x = AcadAssist.LineToBorder(pierline12, cvBoardUp2, cvBoardDn2); pierline2x = AcadAssist.LineToBorder(pierline22, cvBoardUp2, cvBoardDn2); //道路设计线 block.AddLine(pierline1x, CommonLayer.cenlayer); block.AddLine(pierline2x, CommonLayer.cenlayer); TxCurve centerLine = AcadAssist.CurveToBorder(curveZX2, pierline12, pierline22); Point3d centerLineMidPoint = centerLine.GetPointAtDist(centerLine.GetDistAtPoint(centerLine.EndPoint) * 0.7); Vector3d centerLineMidVect = AcadAssist.GetFirstDerivative(centerLine, centerLineMidPoint); centerLine = AcadAssist.ExtendCurve(centerLine, 8 * block.style.BlockScale); block.AddCurve(centerLine, CommonLayer.cenlayer); //板梁端部线 [伸缩缝附近横桥向端线] endLine1 = AcadAssist.OffsetLineToBoarder(pierline12, -m_glWidth1 * m_drawScale, cvBoardUp2, cvBoardDn2); endLine2 = AcadAssist.OffsetLineToBoarder(pierline22, +m_glWidth2 * m_drawScale, cvBoardUp2, cvBoardDn2); if (endLine1.StartPoint.Y > endLine1.EndPoint.Y) endLine1 = AcadAssist.ReverseTxLine(endLine1); if (endLine2.StartPoint.Y > endLine2.EndPoint.Y) endLine2 = AcadAssist.ReverseTxLine(endLine2); //空心板横桥向端线 block.AddLine(endLine1, CommonLayer.gz1layer); block.AddLine(endLine2, CommonLayer.gz1layer); //转角---以后对齐,标注等都要用 TxLine alignLine = new TxLine(AcadAssist.Mid(endLine1.StartPoint, endLine1.EndPoint), AcadAssist.Mid(endLine2.StartPoint, endLine2.EndPoint)); Vector3d vectRotate = alignLine.StartPoint.GetVectorTo(alignLine.EndPoint); startLineAngle = AcadAssist.AngleOnPlan(vectRotate, alignLine); #endregion //最外侧板梁边线--------边板悬臂外边线 cvBoardUpx = AcadAssist.CurveToBorder(cvBoardUp2, endLine1, endLine2); cvBoardDnx = AcadAssist.CurveToBorder(cvBoardDn2, endLine1, endLine2); block.AddCurve(cvBoardUpx, CommonLayer.gz1layer); block.AddCurve(cvBoardDnx, CommonLayer.gz1layer); //计算辅助点(去掉悬臂后的空心板边板外侧线的点) // kxb_bb1_point1 kxb_bb1_point2 // ------------------------- // | | // | | // | | // ------------------------- // kxb_bb2_point1 kxb_bb2_point2 #region 初始板梁块数 TxLine borderLineS = new TxLine(cvBoardUpx.StartPoint, cvBoardUpx.EndPoint); TxLine offsetBordS1 = AcadAssist.OffsetLineToBoarder(borderLineS, -m_initWsideLS * m_drawScale, endLine1, endLine2); TxLine offsetBordS2 = AcadAssist.OffsetLineToBoarder(borderLineS, -m_initWsideRS * m_drawScale, endLine1, endLine2); TxLine centerLineS1 = new TxLine(offsetBordS1.StartPoint, offsetBordS2.EndPoint); TxLine borderLineX = new TxLine(cvBoardDnx.StartPoint, cvBoardDnx.EndPoint); TxLine offsetBordX1 = AcadAssist.OffsetLineToBoarder(borderLineX, m_initWsideLX * m_drawScale, endLine1, endLine2); TxLine offsetBordX2 = AcadAssist.OffsetLineToBoarder(borderLineX, m_initWsideRX * m_drawScale, endLine1, endLine2); TxLine centerLineX1 = new TxLine(offsetBordX1.StartPoint, offsetBordX2.EndPoint); double distBorderL = centerLineS1.StartPoint.DistanceTo(centerLineX1.StartPoint); double distBorderR = centerLineS1.EndPoint.DistanceTo(centerLineX1.EndPoint); double Wone = m_initWone * m_drawScale; double Wsum = Math.Min(distBorderL, distBorderR) + Wone; double initWsjf2 = m_initWsjf * m_drawScale; boxCount = AcadAssist.CalBeamCountCombineSjf(Wsum, Wone, initWsjf2, Wone * 0.5); #endregion sideLines = new List<TxLine>(); cenLines = new List<TxLine>(); #region 定义梁中心线 if (drawingMode == DrawingMode.AUTO) { //箱梁划板[按照boxCount*(Wone+sjfW1/2)+Wone的原则] sideLines.Clear(); cenLines.Clear(); List<Point3d> divPointL = AcadAssist.SplitLineByCount(centerLineX1.StartPoint, centerLineS1.StartPoint, boxCount - 1); List<Point3d> divPointR = AcadAssist.SplitLineByCount(centerLineX1.EndPoint, centerLineS1.EndPoint, boxCount - 1); for (int i = 0; i < divPointL.Count; i++) { cenLines.Add(new TxLine(divPointL[i], divPointR[i])); } for (int i = 0; i < cenLines.Count; i++) { sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], -Wone * 0.5, endLine1, endLine2)); sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], +Wone * 0.5, endLine1, endLine2)); } //加上两个边梁d的中心线和内边线 cenLines.Add(centerLineX1); cenLines.Add(centerLineS1); sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineX1, +Wone * 0.5, endLine1, endLine2)); sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineS1, -Wone * 0.5, endLine1, endLine2)); if (isAdjustSJFW) { ///--------求出各湿接缝长度------------------ CompairTxLineStartY compairY1 = new CompairTxLineStartY(); sideLines.Sort(compairY1); cenLines.Sort(compairY1); List<double> sjfWidthBefore1 = new List<double>();//调整前湿接缝左宽度表 List<double> sjfWidthBefore2 = new List<double>();//调整前湿接缝右宽度表 int sjfCount = sideLines.Count / 2;//sidLine是梁边线(除边梁外边线)--数量是(中板数+1)*2==湿接缝数*2 for (int i = 0; i < sjfCount; i++) { double sjfWWW1 = sideLines[i * 2].StartPoint.DistanceTo(sideLines[i * 2 + 1].StartPoint); double sjfWWW2 = sideLines[i * 2].EndPoint.DistanceTo(sideLines[i * 2 + 1].EndPoint); sjfWidthBefore1.Add(sjfWWW1); sjfWidthBefore2.Add(sjfWWW2); } double sjfWidth1Ave = MTL_Math.Math2.sum(sjfWidthBefore1) / sjfWidthBefore1.Count; double sjfWidth2Ave = MTL_Math.Math2.sum(sjfWidthBefore2) / sjfWidthBefore2.Count; List<double> adjustSjfW1 = new List<double>();//湿接缝左宽度调整量表 List<double> adjustSjfW2 = new List<double>();//湿接缝右宽度调整量表 for (int i = 0; i < sjfWidthBefore1.Count - 1; i++) { adjustSjfW1.Add(-(sjfWidthBefore1[i] - sjfWidth1Ave)); adjustSjfW2.Add(-(sjfWidthBefore1[i] - sjfWidth1Ave)); } sideLines.Clear(); cenLines.Clear(); //-----自动均匀调整湿接缝的宽度----------------- List<Point3d> divPointLx = this.AdjustSjfW(centerLineX1.StartPoint, centerLineS1.StartPoint, boxCount - 1, adjustSjfW1); List<Point3d> divPointRx = this.AdjustSjfW(centerLineX1.EndPoint, centerLineS1.EndPoint, boxCount - 1, adjustSjfW2); for (int i = 0; i < divPointL.Count; i++) { cenLines.Add(new TxLine(divPointLx[i], divPointRx[i])); } for (int i = 0; i < cenLines.Count; i++) { sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], -Wone * 0.5, endLine1, endLine2)); sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], +Wone * 0.5, endLine1, endLine2)); } //加上两个边梁d的中心线和内边线 cenLines.Add(centerLineX1); cenLines.Add(centerLineS1); sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineX1, +Wone * 0.5, endLine1, endLine2)); sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineS1, -Wone * 0.5, endLine1, endLine2)); } } else if (drawingMode == DrawingMode.USER_CENTER) { sideLines.Clear(); cenLines.Clear(); for (int i = 0; i < m_storeCLines2.Count; i++) { TxLine tempLine = AcadAssist.LineToBorder(m_storeCLines2[i], endLine1, endLine2); cenLines.Add(tempLine); } CompairTxLineStartY compairY1 = new CompairTxLineStartY(); cenLines.Sort(compairY1); //-----与前面自动确定中心线后形成的梁边线的代码相同-------------- for (int i = 0; i < cenLines.Count; i++) { if (i != 0) { sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], -Wone * 0.5, endLine1, endLine2)); } if (i != cenLines.Count - 1) { sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], +Wone * 0.5, endLine1, endLine2)); } } //加上两个边梁d的中心线和内边线 //cenLines.Add(centerLineX1); //cenLines.Add(centerLineS1); //sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineX1, +Wone * 0.5, endLine1, endLine2)); //sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineS1, -Wone * 0.5, endLine1, endLine2)); //-----与前面自动确定中心线后形成的梁边线的代码相同-------------- } else { //箱梁划板[按照文字定义的梁宽和湿接缝宽] sideLines.Clear(); //double offsetX1 = -distX1; //double offsetX2 = -distX2; //List<double> XwidthOffsetL = MTL_Math.ParseString.ParaseToDouble(widthOffsetL); //List<double> XwidthOffsetR = MTL_Math.ParseString.ParaseToDouble(widthOffsetR); //List<double> XwidthOffsetJfL = MTL_Math.ParseString.ParaseToDouble(widthOffsetSjfL); //List<double> XwidthOffsetJfR = MTL_Math.ParseString.ParaseToDouble(widthOffsetSjfR); //if ((XwidthOffsetL.Count != XwidthOffsetR.Count) || (XwidthOffsetL.Count != XwidthOffsetJfL.Count + 1) // || (XwidthOffsetR.Count != XwidthOffsetJfR.Count + 1)) //{ // System.Windows.Forms.MessageBox.Show("板梁个数与湿接缝个数不一致,请修改数据"); // return; //} //for (int i = 0; i < XwidthOffsetL.Count; i++) //{ // double beamWSumLeft = XwidthOffsetL[i]; // double beamWSumRigt = XwidthOffsetR[i]; // //偏移半块板的宽度---求出梁中心线 // double beamWDnLeft = (i == 0) ? (beamWSumLeft - initWsideI2) : ((i == boxCount - 1) ? initWsideI2 : (beamWSumLeft * 0.5)); // double beamWDnRigt = (i == 0) ? (beamWSumRigt - initWsideI2) : ((i == boxCount - 1) ? initWsideI2 : (beamWSumRigt * 0.5)); // TxLine offsetLine1 = AcadAssist.OffsetLineToBoarder(startLine2, (offsetX1 + beamWDnLeft) , endLine1, endLine2); // TxLine offsetLine2 = AcadAssist.OffsetLineToBoarder(startLine2, (offsetX2 + beamWDnRigt) , endLine1, endLine2); // TxLine center1 = new TxLine(offsetLine1.StartPoint, offsetLine2.EndPoint); // if (i != boxCount - 1) // cenLines.Add(center1); // //再偏移半块板的宽度---求出梁上缘边线 // double beamWUpLeft = beamWSumLeft - beamWDnLeft; // double beamWUpRigt = beamWSumRigt - beamWDnRigt; // TxLine offsetLine3 = AcadAssist.OffsetLineToBoarder(startLine2,( offsetX1 + beamWSumLeft ), endLine1, endLine2); // TxLine offsetLine4 = AcadAssist.OffsetLineToBoarder(startLine2, (offsetX2 + beamWSumRigt), endLine1, endLine2); // TxLine border1 = new TxLine(offsetLine3.StartPoint, offsetLine4.EndPoint); // if (i != boxCount - 1) // kxbLines.Add(border1); // offsetX1 += XwidthOffsetL[i]; // offsetX2 += XwidthOffsetR[i]; //} } #endregion //中心线与边线排序 CompairTxLineStartY compareY2 = new CompairTxLineStartY(); sideLines.Sort(compareY2); cenLines.Sort(compareY2); //输出板边线 for (int i = 0; i < sideLines.Count; i++) { block.AddLine(sideLines[i], CommonLayer.gz1layer); } //定义横梁线 List<TxLine> hlLines = new List<TxLine>();//横梁线 if (this.isUserhgbCount == false) { hlLines.AddRange(m_hgbLines2); } else { //-----目前只在跨中加一道横隔板---- TxLine beamSideUpLine1 = new TxLine(cvBoardDnx.StartPoint, cvBoardDnx.EndPoint); TxLine beamSideUpLine2 = new TxLine(cvBoardUpx.StartPoint, cvBoardUpx.EndPoint); Point3d hlPoint1 = AcadAssist.Mid(beamSideUpLine1.StartPoint, beamSideUpLine1.EndPoint); Point3d hlPoint2 = AcadAssist.Mid(beamSideUpLine2.StartPoint, beamSideUpLine2.EndPoint); hlLines.Add(new TxLine(hlPoint1, hlPoint2)); } #region 绘制板梁平面构造图 //绘制小箱梁T梁构造平面[kxbLines不包含上下构造边线--因此要用加上边线的kxbLinesWithBorder] List<BeamBox> BeamBoxs = new List<BeamBox>(); //横向布置箱梁 List<BeamT> beamTs = new List<BeamT>(); //横向布置箱梁 List<TxCurve> kxbLinesWithBorder = new List<TxCurve>(); kxbLinesWithBorder.Insert(0, cvBoardDnx); for (int i = 0; i < sideLines.Count; i++) kxbLinesWithBorder.Add(sideLines[i]); kxbLinesWithBorder.Add(cvBoardUpx); boxCountX = Convert.ToInt32(sideLines.Count / 2); for (int i = 0; i <= boxCountX; i++) { TxLine curBeamCenterLine = cenLines[i]; TxCurve curBeamSideLineDn = kxbLinesWithBorder[i * 2]; TxCurve curBeamSideLineUp = kxbLinesWithBorder[i * 2 + 1]; Point3d beamStartPoint = curBeamCenterLine.StartPoint; if (structType == BeamType.BEAMBOX) { BeamBox BeamBox = new BeamBox(); if (i == 0) BeamBox.type = BeamBase.BeamLocate.Right; if (i == boxCountX) BeamBox.type = BeamBase.BeamLocate.Left; BeamBox.SetLinePM(curBeamCenterLine, curBeamSideLineDn, curBeamSideLineUp, hlLines, m_drawScale); if (isDrawBeam) { DatabaseToAcad blockBeamBox = new DatabaseToAcad(block.style.BlockScale / m_drawScale); BeamBox.DrawPM(blockBeamBox); blockBeamBox.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint)); //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale blockBeamBox.ResetDimensionScale(block.style.BlockScale); //blockBeamBox.DimensionScale(m_drawScale); block.Append(blockBeamBox); } else { DatabaseToAcad blockBeamBox = new DatabaseToAcad(block.style.BlockScale / m_drawScale); //BeamBox.DrawCenterLine(blockBeamBox); blockBeamBox.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint)); //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale blockBeamBox.ResetDimensionScale(block.style.BlockScale); //blockBeamBox.DimensionScale(m_drawScale); block.Append(blockBeamBox); } BeamBoxs.Add(BeamBox); } else if (structType == BeamType.BEAMT) { BeamT beamT = new BeamT(); if (i == 0) beamT.type = BeamBase.BeamLocate.Right; if (i == boxCountX) beamT.type = BeamBase.BeamLocate.Left; beamT.SetLinePM(curBeamCenterLine, curBeamSideLineDn, curBeamSideLineUp, hlLines, m_drawScale); if (isDrawBeam) { DatabaseToAcad blockBeamT = new DatabaseToAcad(block.style.BlockScale / m_drawScale); beamT.DrawPM(blockBeamT); blockBeamT.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint)); //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale blockBeamT.ResetDimensionScale(block.style.BlockScale); //blockBeamT.DimensionScale(m_drawScale); block.Append(blockBeamT); } else { DatabaseToAcad blockBeamT = new DatabaseToAcad(block.style.BlockScale / m_drawScale); //beamT.DrawCenterLine(blockBeamT); beamT.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint)); //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale blockBeamT.ResetDimensionScale(block.style.BlockScale); //blockBeamBox.DimensionScale(m_drawScale); block.Append(blockBeamT); } beamTs.Add(beamT); } else { throw new System.Exception("未知上部结构类型。"); } } #endregion #region 湿接缝填充 //桥面板湿接缝填充[kxbLines不包含上下构造边线] int kxbLineCount2 = sideLines.Count / 2; for (int i = 0; i < kxbLineCount2; i++) { TxLine border1 = sideLines[i * 2 + 0]; TxLine border2 = sideLines[i * 2 + 1]; TxPolyline loopPolyline = new TxPolyline(); loopPolyline.AddVertexAt(0, new Point2d(border1.StartPoint.X, border1.StartPoint.Y), 0, 0, 0); loopPolyline.AddVertexAt(0, new Point2d(border1.EndPoint.X, border1.EndPoint.Y), 0, 0, 0); loopPolyline.AddVertexAt(0, new Point2d(border2.EndPoint.X, border2.EndPoint.Y), 0, 0, 0); loopPolyline.AddVertexAt(0, new Point2d(border2.StartPoint.X, border2.StartPoint.Y), 0, 0, 0); loopPolyline.AddVertexAt(0, new Point2d(border1.StartPoint.X, border1.StartPoint.Y), 0, 0, 0); block.AddHatch(loopPolyline, 3 * block.style.BlockScale, CommonLayer.gz3layer); } //桥面板湿接缝填充 #endregion #region 绘制湿接缝范围的横隔板 //湿接缝横梁[START] if (isDrawBeam) { DatabaseToAcad blockSjf = new DatabaseToAcad(block.style.BlockScale); for (int j = 1; j < BeamBoxs.Count; j++) { List<TxLine> hlCenters1 = new List<TxLine>(); List<TxLine> hlLines1L = new List<TxLine>(); List<TxLine> hlLines1R = new List<TxLine>(); BeamBoxs[j - 1].GetHLLine(out hlCenters1, out hlLines1L, out hlLines1R); for (int k = 0; k < hlCenters1.Count; k++) { hlCenters1[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j - 1].StartPointX)); hlLines1L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j - 1].StartPointX)); hlLines1R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j - 1].StartPointX)); } List<TxLine> hlCenters2 = new List<TxLine>(); List<TxLine> hlLines2L = new List<TxLine>(); List<TxLine> hlLines2R = new List<TxLine>(); BeamBoxs[j].GetHLLine(out hlCenters2, out hlLines2L, out hlLines2R); for (int k = 0; k < hlCenters1.Count; k++) { hlCenters2[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j].StartPointX)); hlLines2L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j].StartPointX)); hlLines2R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j].StartPointX)); } for (int k = 0; k < hlCenters1.Count; k++) { blockSjf.AddLine(new TxLine(hlCenters1[k].EndPoint, hlCenters2[k].StartPoint), CommonLayer.cenlayer); } for (int k = 0; k < hlLines1L.Count; k++) { blockSjf.AddLine(new TxLine(hlLines1L[k].EndPoint, hlLines2L[k].StartPoint), CommonLayer.gz2layer); blockSjf.AddLine(new TxLine(hlLines1R[k].EndPoint, hlLines2R[k].StartPoint), CommonLayer.gz2layer); } } //T梁湿接缝 for (int j = 1; j < beamTs.Count; j++) { List<TxLine> hlCenters1 = new List<TxLine>(); List<TxLine> hlLines1L = new List<TxLine>(); List<TxLine> hlLines1R = new List<TxLine>(); beamTs[j - 1].GetHLLine(out hlCenters1, out hlLines1L, out hlLines1R); for (int k = 0; k < hlCenters1.Count; k++) { hlCenters1[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j - 1].StartPointX)); hlLines1L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j - 1].StartPointX)); hlLines1R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j - 1].StartPointX)); } List<TxLine> hlCenters2 = new List<TxLine>(); List<TxLine> hlLines2L = new List<TxLine>(); List<TxLine> hlLines2R = new List<TxLine>(); beamTs[j].GetHLLine(out hlCenters2, out hlLines2L, out hlLines2R); for (int k = 0; k < hlCenters1.Count; k++) { hlCenters2[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j].StartPointX)); hlLines2L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j].StartPointX)); hlLines2R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j].StartPointX)); } for (int k = 0; k < hlCenters1.Count; k++) { blockSjf.AddLine(new TxLine(hlCenters1[k].EndPoint, hlCenters2[k].StartPoint), CommonLayer.cenlayer); } for (int k = 0; k < hlLines1L.Count; k++) { blockSjf.AddLine(new TxLine(hlLines1L[k].EndPoint, hlLines2L[k].StartPoint), CommonLayer.gz2layer); blockSjf.AddLine(new TxLine(hlLines1R[k].EndPoint, hlLines2R[k].StartPoint), CommonLayer.gz2layer); } } block.Append(blockSjf); } //湿接缝横梁[END] #endregion this.isDrawn = true; } catch { System.Windows.Forms.MessageBox.Show("绘图出错,请修改结构定义。" + "可能是结构边线是否合理。"); } }
public override void Draw(DatabaseToAcad block) { // ======================== 基本几何操作 ==================================== /// 点和向量的计算 Point3d structPt1 = new Point3d(0, -5000, 0); Vector3d vect = new Vector3d(3, 9, 0); /// Vector3d vectUnit = vect.GetNormal(); ///取单位向量 Vector3d vectPer = vectUnit.RotateBy(Math.PI * 0.5, Vector3d.ZAxis); ///向量的垂直,顺时针方向转90度 Point3d structPt2 = structPt1 + vectUnit.MultiplyBy(2000); ///点可以是点和向量相加 Point3d structPt3 = structPt1 + vectPer.MultiplyBy(2000); /// 直线 TxLine line1 = new TxLine(new Point3d(0, 0, 0), new Point3d(500, 500, 0)); TxLine line2 = AcadAssist.GetOffsetLineToLeft(line1, 200); //线的偏移 TxLine line3 = new TxLine(new Point3d(100, -500, 0), new Point3d(100, 5000, 0)); TxLine line4 = new TxLine(new Point3d(1000, -500, 0), new Point3d(1000, 5000, 0)); List<Point3d> xpnt = AcadAssist.GetIntersectionPoints(line1, line3); /// 两条线求交 /// 圆弧 TxArc arc = new TxArc(new Point3d(), new Point3d(100, 100, 0), new Point3d(200, 0, 0));///三点确定圆弧 /// 圆弧转化为多义线 TxPolyline pl2 = AcadAssist.ConvertToTxPolyline(arc); /// 多义线 TxPolyline pl1 = new TxPolyline(); pl1.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); pl1.AddVertexAt(1, new Point2d(0, 500), 0, 0, 0); pl1.AddVertexAt(2, new Point2d(500, 500), 0, 0, 0); pl1.AddVertexAt(3, new Point2d(300, 100), 0.5, 0, 0); /// 这个参数不是0,则是曲线 pl1.AddVertexAt(4, new Point2d(0, 0), 0, 0, 0); // ======================== 基本图形的运算 AcadAssist.() ==================================== /// 多义线裁剪和对称 TxPolyline pl3 = AcadAssist.TrimPolylineGetFront(pl2, new Point3d(500, 500, 0)); /// 裁剪,求线的前面部分 pl3 = AcadAssist.MillarTxPolyline(pl3, 0); // ======================== 绘制图形 ==================================== /// -------- 绘制线 ----------- block.AddLine(new Point3d(0, 0, 0), new Point3d(500, 500, 0), CommonLayer.zerolayer); /// --------绘制线 ----------------------- 图层说明 -- 构造有四个图层, 加入的对象颜色和线型都是随层的 block.AddLine(line1, CommonLayer.gz1layer); ///粗实线 block.AddLine(line2, CommonLayer.gz2layer); ///细实线 block.AddLine(line3, CommonLayer.gz3layer); ///粗虚线 block.AddLine(line4, CommonLayer.gz4layer); ///细虚线 /// --------- 绘制其它基本图形 block.AddCircle(new Point3d(0, 0, 0), 500, CommonLayer.zerolayer); block.AddCurve(arc, CommonLayer.dimlayer); //public void AddSectionLineHori(Point3d midPoint, string name, bool isTextUp, bool isArrowLeft); /// 剖断线 //public void AddSectionLineVert(Point3d midPoint, string name, bool isTextLeft, bool isArrowUpside); /// 剖断线 /// --------绘制线 ----------------------- 图层说明 -- 构造有四个图层, 加入的对象颜色和线型都是随层的 block.AddCurve(pl1); block.AddCurve(pl2); block.AddCurve(pl3); ///标注文字和线 [带指引线的文字] block.AddTextDim(new Point3d(0, 500, 0), CommonSimbel.ConvertToDimStr(1000) + CommonSimbel.multipliSymbol + CommonSimbel.ConvertToDimStr(500), 2); /// 最后一个参数表示是哪个象限[1,2,3,4] block.AddTextDimAngle(new Point3d(0, 1500, 0), "sss", new Point3d(2500, 5000, 0), 250); ///加阴影部分 TxPolyline plx = AcadAssist.CloneTxPolyline(pl1); block.AddHatch(plx, 1, CommonLayer.gz1layer); // -------- 绘制文字 ------ block.AddText(new Point3d(800, 800, 0), "Hello1"); block.AddText(new Point3d(900, 900, 0), "Hello2", block.style.RealTextHeigth, Math.PI * 0.25, CommonLayer.dimlayer, TxTextHorizontalMode.TextRight, TxTextVerticalMode.TextTop); ///加标题 block.AddTitle(new Point3d(500, 500, 0), "图块标题"); /// 应该考虑图块放在上面还是下面 /// CommonSimbel.IsDownTitle ///加折断线 ,有三种,单折断线,双折断线,圆柱折断线 //block.AddBreakLine() // ======================== 标注 ==================================== //block.AddDimContinueAlign_AutoAdjust( ,);/// 自动向外调整位置 //block.AddDimension_UserTextPoint()/// 一般情况下文字位置自定处理的,但是也可以设定 // ======================== 绘制钢筋 ==================================== /// ------ 绘制点钢筋 --------- double BHC = 30; ISteelBar ist_dot = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101); SteelDotByLine st_dot = SteelFactory.CreateSteelDots(ist_dot, structPt1, structPt2, BHC); block.AddSteelEntity(st_dot); /// ------ 绘制线钢筋 --------- ISteelBar ist_line = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101); SteelLines st_line = SteelFactory.CreateSteelParalLine(ist_line, structPt1, structPt3, BHC, 45, 2000); block.AddSteelEntity(st_line); }