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); } }
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); } }