/// <summary> /// 平面\立面视口. /// </summary> /// <param name="vpNum">1=平面,2=剖面.</param> /// <param name="ytop">1=平面,2=剖面.</param> public static void DrawMyViewport(this Viewport vp, int vpNum, Point3d BasePoint, Point2d CenterPoint, int scale) { if (vpNum == 1) { vp.CenterPoint = BasePoint.Convert3D(150, 148.5); vp.Width = 240; vp.Height = 277; } else if (vpNum == 2) { vp.CenterPoint = BasePoint.Convert3D(220 + 70, 148.5, 0); vp.Width = 240; vp.Height = 277; } vp.ViewCenter = CenterPoint; vp.CustomScale = 1.0 / scale; vp.Layer = "图框"; vp.Locked = true; }
/// <summary> /// 横向平行多线 /// </summary> /// <param name="db"></param> /// <param name="BotStartPoint">左下起点</param> /// <param name="BotEndPoint">右下终点</param> /// <param name="Seps">相对下线间距列表</param> /// <param name="Layers">图层列表</param> /// <param name="isVertical">是否竖直修剪</param> /// <returns>多线集合</returns> public static Line[] PlotN(Database db, Point3d BotStartPoint, Point3d BotEndPoint, double[] Seps, string[] Layers, bool isVertical = false) { int size = Layers.Length; System.Diagnostics.Debug.Assert(size == Seps.Length); Line[] LineSet = new Line[size]; Line leftside, rightside; Line tmp; Point3dCollection startPts, endPts; leftside = new Line(BotStartPoint, BotStartPoint.Convert3D(0, 1)); rightside = new Line(BotEndPoint, BotEndPoint.Convert3D(0, 1)); using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; for (int ii = 0; ii < size; ii++) { startPts = new Point3dCollection(); endPts = new Point3dCollection(); tmp = new Line(BotStartPoint, BotEndPoint) { Layer = Layers[ii], LinetypeScale = 4.0 }; tmp = (Line)tmp.GetOffsetCurves(Seps[ii])[0]; if (isVertical & Seps[ii] != 0) { tmp.IntersectWith(leftside, Intersect.ExtendBoth, startPts, IntPtr.Zero, IntPtr.Zero); tmp.IntersectWith(rightside, Intersect.ExtendBoth, endPts, IntPtr.Zero, IntPtr.Zero); tmp.StartPoint = startPts[0]; tmp.EndPoint = endPts[0]; } LineSet[ii] = tmp; modelSpace.AppendEntity(LineSet[ii]); tr.AddNewlyCreatedDBObject(LineSet[ii], true); } tr.Commit(); } return(LineSet); }
/// <summary> /// 绘制平立面 /// </summary> /// <param name="db"></param> /// <param name="AnchorPoint"></param> public double PlotA(Database db, Point2d AnchorPoint, int ScaleA = 0) { Transaction tr = db.TransactionManager.StartTransaction(); BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord ms = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; DimStyleTable dst = (DimStyleTable)tr.GetObject(db.DimStyleTableId, OpenMode.ForRead); if (ScaleA == 0) { ScaleA = GetScaleA(); } double dy = ScaleA * -50; // 立面图 ObjectId blkRecId = blockTbl["T321-1"]; ObjectId HLJJ = blockTbl["T321-HLJJ"]; ObjectId QMB = blockTbl["T321-QMB"]; ObjectId HL = blockTbl["T321-HL-C" + Columns.ToString()]; ObjectId T321PM = blockTbl["T321-2"]; ObjectId XZ = blockTbl["T321-XZ"]; ObjectId QZC1 = blockTbl["T321-QZ-C1"]; ObjectId QZC1R = blockTbl["T321-QZ-C1R"]; ObjectId QZC2 = blockTbl["T321-QZ-C2"]; ObjectId QZC2R = blockTbl["T321-QZ-C2R"]; ObjectId ZBC1 = blockTbl["T321-ZB-C1"]; ObjectId ZBC2 = blockTbl["T321-ZB-C2"]; ObjectId ZBC3 = blockTbl["T321-ZB-C3"]; ObjectId ZBC3L = blockTbl["T321-ZB-C3L"]; ObjectId ZCJ = blockTbl["T321-ZCJ-2"]; ObjectId KFLG = blockTbl["T321-KFLG"]; ObjectId QMB2 = blockTbl["T321-QMB-2"]; ObjectId JQXG = blockTbl["T321-JQXG"]; // 立面桁架 for (int i = 0; i < Pieces; i++) { for (int j = 0; j < Layers; j++) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(0 + i * 3000, 0 + j * 1500), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } if (IsEnhence && i != 0 && i != (Pieces - 1)) { if (j == 0) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(0 + i * 3000, 0 + j * 1500 - 100), JQXG)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } else if (j == Layers - 1) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(0 + i * 3000, 0 + j * 1500 + 1500), JQXG)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } } if (j == 0) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(1413 + i * 3000, 328), HLJJ)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(1413 + i * 3000, dy), HL)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(1413 + 1410 + i * 3000, 328), HLJJ)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(1413 + 1410 + i * 3000, dy), HL)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(1323 + i * 3000, 553), QMB)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } } } blkRecId = blockTbl["T321-ZCJ-1"]; double offsetZCJ = 0.0; if (Columns != 1) { for (int i = 0; i < Pieces; i++) { if (IsEnhence) { if (i == 0 || i == (Pieces - 1)) { offsetZCJ = 0; } else { offsetZCJ = 100; } } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(910 + i * 3000, (Layers) * 1500 - 70 + offsetZCJ), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } } blkRecId = blockTbl["T321-YTDZ"]; using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } blkRecId = blockTbl["T321-HL-1"]; using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-157, 58), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-157, dy), HL)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } blkRecId = blockTbl["T321-ITDZ"]; using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000.0), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } blkRecId = blockTbl["T321-QZ"]; using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000.0 + 37, -145), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, -145), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } blkRecId = blockTbl["T321-ZB"]; using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000.0 + 37, -297), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, -297), blkRecId)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } // 平面桁架 for (int k = 0; k < 2; k++) { double sidey = (-4200) * k; int dir = k == 0 ? 1 : -1; for (int i = 0; i < Columns; i++) { double cy; if (i == 0) { cy = 0; } else if (i == 1) { cy = dir * 450; } else { cy = (450 + 250) * dir; } for (int j = 0; j < Pieces; j++) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(j * 3000, dy - 825 + sidey + cy), T321PM)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } if (j != 0) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(j * 3000, dy - 825 + sidey + cy - 75.3), XZ)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } if (i == 0) { if (Columns != 1) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(j * 3000 + 910, dy - 825 + sidey + dir * 450), ZCJ)) { if (dir == -1) { acBlkRef.TransformBy(Matrix3d.Mirroring(new Line3d( AnchorPoint.Convert3D(j * 3000 + 910, dy - 825 + sidey + dir * 450), AnchorPoint.Convert3D(j * 3000 + 910 + 100, dy - 825 + sidey + dir * 450) ))); } ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } if (k == 0) { if (j < 0.5 * Pieces) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(j * 3000 + 329, dy - 825 + sidey), KFLG)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } else { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(j * 3000 + 2821, dy - 825 + sidey - 180), QMB2)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } } } } } if (Columns == 1) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey), QZC1)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000 + 37, dy - 825 + sidey), QZC1R)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey), ZBC1)) { acBlkRef.TransformBy(Matrix3d.Mirroring(new Line3d( AnchorPoint.Convert3D(-37, dy - 825 + sidey), AnchorPoint.Convert3D(-37, dy - 825 + sidey + 100) ))); ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(37 + Pieces * 3000, dy - 825 + sidey), ZBC1)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } else if (Columns == 2) { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey), QZC1)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 450), QZC1)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000 + 37, dy - 825 + sidey), QZC1R)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000 + 37, dy - 825 + sidey + dir * 450), QZC1R)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000 + 37, dy - 825 + sidey + dir * 225), ZBC2)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 225), ZBC2)) { acBlkRef.TransformBy(Matrix3d.Mirroring(new Line3d(AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 225), AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 225 + 100)))); ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } else { using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey), QZC1)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * (450 + 125)), QZC2)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000 + 37, dy - 825 + sidey), QZC1R)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000 + 37, dy - 825 + sidey + dir * (450 + 125)), QZC2R)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(Pieces * 3000 + 37, dy - 825 + sidey + dir * 350), ZBC3)) { ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } using (BlockReference acBlkRef = new BlockReference(AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 350), ZBC3)) { acBlkRef.TransformBy(Matrix3d.Mirroring(new Line3d( AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 350), AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 350 + 100) ))); if (dir == -1) { acBlkRef.TransformBy(Matrix3d.Mirroring(new Line3d( AnchorPoint.Convert3D(-37, dy - 825 + sidey + dir * 350), AnchorPoint.Convert3D(-37 + 100, dy - 825 + sidey + dir * 350) ))); } ms.AppendEntity(acBlkRef); tr.AddNewlyCreatedDBObject(acBlkRef, true); } } } tr.Commit(); tr.Dispose(); // 标注 var DimStyleID = dst["1-" + ScaleA.ToString()]; Point3d SW = AnchorPoint.Convert3D(); Point3d SE = AnchorPoint.Convert3D(Pieces * 3000.0); Point3d NW = SW.Convert3D(0, Layers * 1400 + (Layers - 1) * 100); Point3d NE = SE.Convert3D(0, Layers * 1400 + (Layers - 1) * 100); Point3d CT = NW.Convert3D(0.5 * Pieces * 3000.0); Point3d pNW = SW.Convert3D(0, dy - 825); Point3d pNE = SE.Convert3D(0, dy - 825); Point3d pSW = pNW.Convert3D(0, -4200); Point3d pSE = pNE.Convert3D(0, -4200); Point3d pCT = pNW.Convert3D(0.5 * Pieces * 3000.0); string stmp = string.Format("{0}×3000=<>", Pieces); DimPloter.Dim0(db, NW, NE, NE.Convert3D(0, 10 * ScaleA), DimStyleID, 0, stmp); DimPloter.Dim0(db, SW, NW, NW.Convert3D(-10 * ScaleA), DimStyleID, 0.5 * Math.PI); DimPloter.Dim0(db, SE, SE.Convert3D(0, 1400), SE.Convert3D(8 * ScaleA), DimStyleID, 0.5 * Math.PI); for (int i = 0; i < Layers - 1; i++) { DimPloter.Dim0(db, SE.Convert3D(0, 1500 * (i + 1) - 100), SE.Convert3D(0, 1500 * (i + 1)), SE.Convert3D(8 * ScaleA), DimStyleID, 0.5 * Math.PI); DimPloter.Dim0(db, SE.Convert3D(0, 1500 * (i + 1)), SE.Convert3D(0, 1500 * (i + 1) + 1400), SE.Convert3D(8 * ScaleA), DimStyleID, 0.5 * Math.PI); } DimPloter.Dim0(db, pSW, pSE, pSW.Convert3D(0, -15 * ScaleA), DimStyleID); DimPloter.Dim0(db, pSW, pNW, pNW.Convert3D(-10 * ScaleA), DimStyleID, 0.5 * Math.PI); double ymin = pSW.Convert3D(0, -15 * ScaleA).Y; // 图名 TextPloter.PrintTitle(db, "立 面", CT.Convert2D(0, 25 * ScaleA), ScaleA); TextPloter.PrintTitle(db, "平 面", pCT.Convert2D(0, 20 * ScaleA), ScaleA); double ymax = CT.Convert2D(0, 25 * ScaleA).Y; return(ymax - AnchorPoint.Y); }
public static void PrintNumTitle(Database db, Point3d PaperOrigenPoint, Dalot curDalot) { using (Transaction tr = db.TransactionManager.StartTransaction()) { TextStyleTable st = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable; BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord recorder = tr.GetObject(blockTbl[BlockTableRecord.PaperSpace], OpenMode.ForWrite) as BlockTableRecord; for (int i = 0; i <= 1; i++) { DBText num = new DBText(); num.TextString = "1"; num.Height = 2.5; if (i == 0) { num.Position = PaperOrigenPoint.Convert3D(394.817, 283.25); } else { num.Position = PaperOrigenPoint.Convert3D(404.939, 283.25); } num.HorizontalMode = TextHorizontalMode.TextCenter; num.VerticalMode = TextVerticalMode.TextVerticalMid; num.AlignmentPoint = num.Position; num.Layer = "标注"; num.TextStyleId = st["En"]; num.WidthFactor = 0.85; recorder.AppendEntity(num); tr.AddNewlyCreatedDBObject(num, true); } // 标题 DBText title = new DBText(); if (curDalot.DalotType == DType.A) { title.TextString = "PLAN DE COFFRAGE DU DALOT (1-1.5×1.0m)"; } else if (curDalot.DalotType == DType.B) { title.TextString = "PLAN DE COFFRAGE DU DALOT (1-2.0×1.5m)"; } else if (curDalot.DalotType == DType.C) { title.TextString = "PLAN DE COFFRAGE DU DALOT (1-4.0×2.0m)"; } else if (curDalot.DalotType == DType.D) { title.TextString = "PLAN DE COFFRAGE DU DALOT (1-4.0×3.0m)"; } else { return; } title.Height = 3.5; title.Position = PaperOrigenPoint.Convert3D(254.5391, 21.4013); title.HorizontalMode = TextHorizontalMode.TextCenter; title.VerticalMode = TextVerticalMode.TextVerticalMid; title.AlignmentPoint = title.Position; title.Layer = "标注"; title.TextStyleId = st["En"]; title.WidthFactor = 0.8; recorder.AppendEntity(title); tr.AddNewlyCreatedDBObject(title, true); title = new DBText(); title.TextString = curDalot.Pk_string(); title.Height = 3.5; title.Position = PaperOrigenPoint.Convert3D(254.5391, 15.2987); title.HorizontalMode = TextHorizontalMode.TextCenter; title.VerticalMode = TextVerticalMode.TextVerticalMid; title.AlignmentPoint = title.Position; title.Layer = "标注"; title.TextStyleId = st["En"]; title.WidthFactor = 0.8; recorder.AppendEntity(title); tr.AddNewlyCreatedDBObject(title, true); // 图号 DBText dn = new DBText(); dn.TextString = curDalot.DesignNo; dn.Height = 2.5; dn.Position = PaperOrigenPoint.Convert3D(371, 14); dn.HorizontalMode = TextHorizontalMode.TextCenter; dn.VerticalMode = TextVerticalMode.TextVerticalMid; dn.AlignmentPoint = dn.Position; dn.Layer = "标注"; dn.TextStyleId = st["En"]; dn.WidthFactor = 0.8; recorder.AppendEntity(dn); tr.AddNewlyCreatedDBObject(dn, true); tr.Commit(); } return; }
public static void PrintTable(Database db, Point3d PaperOrigenPoint, Dalot curDatlotObj, DMT curDMT, System.Data.DataTable curParas, double [] AreaOfSection, MOExcel.Worksheet worksheet, int LineIdx) { double x0 = 284; double y_anchor = 267; double y0 = 0; double x1 = x0 + 106; double t1 = x0 + 24; double t2 = t1 + 38; double t3 = t2 + 17; double t4 = t3 + 16; int[] num23 = curDatlotObj.GetSegNum(); var results = from myRow in curParas.AsEnumerable() where Dalot.PkString2Double(myRow.Field <string>("pk")) == curDatlotObj.Pk select myRow; var theData = results.First(); using (Transaction tr = db.TransactionManager.StartTransaction()) { TextStyleTable st = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable; BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord recorder = tr.GetObject(blockTbl[BlockTableRecord.PaperSpace], OpenMode.ForWrite) as BlockTableRecord; DBText theTitle = new DBText(); theTitle.TextString = "TABLEAU QUANTITATIF DES DALOT " + curDatlotObj.Pk_string(); theTitle.Height = 3.5; theTitle.Position = PaperOrigenPoint.Convert3D((x0 + x1) * 0.5, y_anchor); theTitle.HorizontalMode = TextHorizontalMode.TextCenter; theTitle.VerticalMode = TextVerticalMode.TextBottom; theTitle.AlignmentPoint = theTitle.Position; theTitle.Layer = "标注"; theTitle.TextStyleId = st["En"]; theTitle.WidthFactor = 0.85; recorder.AppendEntity(theTitle); tr.AddNewlyCreatedDBObject(theTitle, true); DBText theTitleZh = new DBText(); theTitleZh.TextString = "涵洞材料数量表"; theTitleZh.Height = 5; theTitleZh.Position = PaperOrigenPoint.Convert3D((x0 + x1) * 0.5, y_anchor + 6); theTitleZh.HorizontalMode = TextHorizontalMode.TextCenter; theTitleZh.VerticalMode = TextVerticalMode.TextBottom; theTitleZh.AlignmentPoint = theTitleZh.Position; theTitleZh.Layer = "标注"; theTitleZh.TextStyleId = st["fsdb"]; theTitleZh.WidthFactor = 0.85; // 取消中文 //recorder.AppendEntity(theTitleZh); //tr.AddNewlyCreatedDBObject(theTitleZh, true); Dictionary <int, string[]> table = new Dictionary <int, string[]>(); double Conc = 0; double Steel = 0; int totalSegNum = 0; double bzqL = 0, jsjL = 0; double SectA = 0; double YiGeXiaoSanJiao = 0; double BZQfangshuiceng = 0; double JSJfangshuiceng = 0; if (curDatlotObj.DalotType == DType.A) { Conc = 2.0 * num23[0] * 1.18915 + 3.0 * num23[1] * 1.18915; Steel = num23[0] * (double)theData["2m钢筋量"] + num23[1] * (double)theData["3m钢筋量"]; totalSegNum = num23[0] + num23[1]; bzqL = 2.000; jsjL = 1.850; SectA = 1.18915; YiGeXiaoSanJiao = 2 * 2 * Math.Tan(30.0 / 180.0 * Math.PI) * 0.5; BZQfangshuiceng = 3.8; JSJfangshuiceng = 7.84; } else if (curDatlotObj.DalotType == DType.B) { Conc = curDatlotObj.Length / 1000 * 2.035; Steel = (double)theData["节段钢筋量"] * num23[0]; totalSegNum = num23[0]; bzqL = 2.825; jsjL = 1.900; SectA = 2.035; YiGeXiaoSanJiao = 2.82 * 2.82 * Math.Tan(30.0 / 180.0 * Math.PI) * 0.5; BZQfangshuiceng = 7; JSJfangshuiceng = 12.4; } else if (curDatlotObj.DalotType == DType.C) { Conc = curDatlotObj.Length / 1000 * 5.5379; Steel = (double)theData["现浇钢筋总量"]; totalSegNum = num23[0]; bzqL = 3.6; jsjL = 0; SectA = 5.5379; YiGeXiaoSanJiao = 3.6 * 3.6 * Math.Tan(30.0 / 180.0 * Math.PI) * 0.5; BZQfangshuiceng = 14.965; } else if (curDatlotObj.DalotType == DType.D) { Conc = curDatlotObj.Length / 1000 * 6.24965; Steel = (double)theData["现浇钢筋总量"]; totalSegNum = num23[0]; bzqL = 5.1; jsjL = 0; SectA = 6.24965; YiGeXiaoSanJiao = 5.1 * 5.1 * Math.Tan(30.0 / 180.0 * Math.PI) * 0.5; BZQfangshuiceng = 27.089; } string JSJConc, BZQConc; double ASteel = 0; double totalLength; string C15 = ""; string Gra = ""; string Bad = ""; if (curDatlotObj.Amont == AType.BZQ) { JSJConc = "-"; BZQConc = string.Format("{0:F1}", (double)theData["八字墙混凝土"] * 2.0); ASteel = (double)theData["八字墙钢筋"] * 2; totalLength = curDatlotObj.Length / 1000 + 2 * bzqL; C15 = string.Format("{0:F1}", (AreaOfSection[1] * totalLength + YiGeXiaoSanJiao * 4 * 0.1) * 1.05); Gra = AreaOfSection[2] == 0 ? "-" : string.Format("{0:F1}", (AreaOfSection[2] * (totalLength - curDatlotObj.MouthT / 1000 * 2) + YiGeXiaoSanJiao * 4 * curDatlotObj.LayerT / 1000) * 1.05); Bad = string.Format("{0:F1}", (AreaOfSection[3] * 2 + AreaOfSection[4]) * curDatlotObj.Length / 1000 + BZQfangshuiceng * 2.0); } else { JSJConc = string.Format("{0:F1}", (double)theData["八字墙混凝土"] * 1.0); BZQConc = string.Format("{0:F1}", (double)theData["八字墙混凝土"] * 1.0); ASteel = (double)theData["八字墙钢筋"] + (double)theData["集水井钢筋"]; totalLength = curDatlotObj.Length / 1000 + bzqL + jsjL; C15 = string.Format("{0:F1}", (AreaOfSection[1] * totalLength + YiGeXiaoSanJiao * 2 * 0.1) * 1.05); Gra = AreaOfSection[2] == 0 ? "-" : string.Format("{0:F1}", (AreaOfSection[2] * (totalLength - curDatlotObj.MouthT / 1000 * 2) + YiGeXiaoSanJiao * 2 * curDatlotObj.LayerT / 1000) * 1.05); Bad = string.Format("{0:F1}", (AreaOfSection[3] * 2 + AreaOfSection[4]) * curDatlotObj.Length / 1000 + BZQfangshuiceng * 2.0 + BZQfangshuiceng + JSJfangshuiceng); } string Mot = "-"; if (curDatlotObj.H2 - curDatlotObj.H0 - (curDatlotObj.Sect[2] - curDatlotObj.Sect[3]) / 1000 <= 0.5) { Mot = string.Format("{0:F1}", AreaOfSection[4] * curDatlotObj.Length / 1000); } string Joint = string.Format("{0:F1}", (SectA + AreaOfSection[1]) * (totalSegNum + 1)); string Rem = string.Format("{0:F1}", AreaOfSection[0] * totalLength); string Enr = string.Format("{0:F1}", (bzqL / Math.Sqrt(3) * 2 + curDatlotObj.Sect[0] / 1000) * 0.625); string Deb = string.Format("{0:F1}", (AreaOfSection[0] + AreaOfSection[5] + AreaOfSection[1] + AreaOfSection[2]) * totalLength); table.Add(1, new string[] { "Béton", "C25/30", "m3", string.Format("{0:F1}", Conc) }); table.Add(2, new string[] { "Armature", "FeE400", "kg", string.Format("{0:F1}", Steel) }); table.Add(3, new string[] { "Quantité de segment", "-", "bloc", string.Format("{0:G}", totalSegNum) }); table.Add(4, new string[] { "Puit d'eau", "C25/30", "m3", JSJConc }); table.Add(5, new string[] { "Mur en aile", "C25/30", "m3", BZQConc }); table.Add(6, new string[] { "Guide roue", "C25/30", "m3", "-" }); table.Add(7, new string[] { "Armature", "FeE400", "kg", string.Format("{0:F1}", ASteel) }); table.Add(8, new string[] { "Béton", "C12/15", "m3", C15 }); table.Add(9, new string[] { "Substitution Radier", "-", "m3", Gra }); table.Add(10, new string[] { "Badigeonnage des parements", "-", "m2", Bad }); table.Add(11, new string[] { "Motier hydro", "-", "m2", Mot }); table.Add(12, new string[] { "Joint", "-", "m2", Joint }); table.Add(13, new string[] { "Déblai", "-", "m3", Deb }); table.Add(14, new string[] { "Remblaiement au dos de dalot", "-", "m3", Rem }); table.Add(15, new string[] { "Enrochement", "-", "m3", Enr }); Dictionary <int, string> columnName = new Dictionary <int, string>(); columnName.Add(2, "Crops"); columnName.Add(5, "Entrée et sortie"); columnName.Add(8, "Foundation"); columnName.Add(11, "Etanchéité"); columnName.Add(14, "Terrassement"); // 输出表格数据 worksheet.Cells[LineIdx, 1] = " "; worksheet.Cells[LineIdx, 2] = curDatlotObj.Pk_string(); worksheet.Cells[LineIdx, 3] = "dalot"; if (curDatlotObj.DalotType == DType.A) { worksheet.Cells[LineIdx, 4] = "1-1.5*1.0"; } else if (curDatlotObj.DalotType == DType.B) { worksheet.Cells[LineIdx, 4] = "1-2.0*1.5"; } else if (curDatlotObj.DalotType == DType.C) { worksheet.Cells[LineIdx, 4] = "1-4.0*2.0"; } else if (curDatlotObj.DalotType == DType.D) { worksheet.Cells[LineIdx, 4] = "1-4.0*3.0"; } worksheet.Cells[LineIdx, 5] = 90 - curDatlotObj.Ang; worksheet.Cells[LineIdx, 6] = curDatlotObj.Length / 1000; if (curDatlotObj.Amont == AType.BZQ) { worksheet.Cells[LineIdx, 7] = "Mur en aile"; } else { worksheet.Cells[LineIdx, 7] = "Puit d'eau"; } worksheet.Cells[LineIdx, 8] = "Mur en aile"; worksheet.Cells[LineIdx, 9] = string.Format("{0:F1}", Conc); worksheet.Cells[LineIdx, 10] = string.Format("{0:F1}", Steel); worksheet.Cells[LineIdx, 11] = string.Format("{0:G}", totalSegNum); worksheet.Cells[LineIdx, 12] = JSJConc; worksheet.Cells[LineIdx, 13] = BZQConc; worksheet.Cells[LineIdx, 14] = "-"; worksheet.Cells[LineIdx, 15] = string.Format("{0:F1}", ASteel); worksheet.Cells[LineIdx, 16] = C15; worksheet.Cells[LineIdx, 17] = Gra; worksheet.Cells[LineIdx, 18] = Bad; worksheet.Cells[LineIdx, 19] = Mot; worksheet.Cells[LineIdx, 20] = Joint; worksheet.Cells[LineIdx, 21] = Deb; worksheet.Cells[LineIdx, 22] = Rem; worksheet.Cells[LineIdx, 23] = Enr; worksheet.Cells[LineIdx, 24] = curDatlotObj.H0.ToString(); for (int i = 0; i < 16; i++) { y0 = y_anchor - i * 6; if (new List <int> { 1, 4, 8, 10, 13 }.Contains(i)) { Line hengxian = new Line(PaperOrigenPoint.Convert3D(x0, y0, 0), PaperOrigenPoint.Convert3D(x1, y0, 0)); hengxian.Layer = "标注"; recorder.AppendEntity(hengxian); tr.AddNewlyCreatedDBObject(hengxian, true); } else { Line hengxian = new Line(PaperOrigenPoint.Convert3D(t1, y0, 0), PaperOrigenPoint.Convert3D(x1, y0, 0)); hengxian.Layer = "标注"; recorder.AppendEntity(hengxian); tr.AddNewlyCreatedDBObject(hengxian, true); } // 列名 if (new List <int> { 2, 5, 8, 11, 14 }.Contains(i)) { DBText txt = new DBText(); txt.TextString = columnName[i]; txt.TextStyleId = st["En"]; txt.Height = 2.5; if (i == 5 || i == 8) { txt.Position = PaperOrigenPoint.Convert3D((x0 + t1) * 0.5, y0); txt.HorizontalMode = TextHorizontalMode.TextCenter; txt.VerticalMode = TextVerticalMode.TextVerticalMid; txt.AlignmentPoint = PaperOrigenPoint.Convert3D((x0 + t1) * 0.5, y0 - 6); } else { txt.Position = PaperOrigenPoint.Convert3D((x0 + t1) * 0.5, y0); txt.HorizontalMode = TextHorizontalMode.TextCenter; txt.VerticalMode = TextVerticalMode.TextVerticalMid; txt.AlignmentPoint = PaperOrigenPoint.Convert3D((x0 + t1) * 0.5, y0 - 3); } txt.Layer = "标注"; txt.WidthFactor = 0.85; recorder.AppendEntity(txt); tr.AddNewlyCreatedDBObject(txt, true); } // 内容 if (i != 0) { for (int j = 0; j < 4; j++) { double tx = 0; if (j == 0) { tx = (t1 + t2) * 0.5; } else if (j == 1) { tx = (t3 + t2) * 0.5; } else if (j == 2) { tx = (t3 + t4) * 0.5; } else { tx = (x1 + t4) * 0.5; } DBText txt = new DBText() { TextString = table[i][j], TextStyleId = st["En"], Height = 2.5, Position = PaperOrigenPoint.Convert3D(tx, y0 - 3), HorizontalMode = TextHorizontalMode.TextCenter, VerticalMode = TextVerticalMode.TextVerticalMid, AlignmentPoint = PaperOrigenPoint.Convert3D(tx, y0 - 3), Layer = "标注", WidthFactor = 0.85, }; recorder.AppendEntity(txt); tr.AddNewlyCreatedDBObject(txt, true); } } } foreach (double x_shuxian in new List <double> { t1, t2, t3, t4 }) { Line ShuXin = new Line(); if (x_shuxian == t1) { ShuXin = new Line(PaperOrigenPoint.Convert3D(x_shuxian, y_anchor - 6), PaperOrigenPoint.Convert3D(x_shuxian, y_anchor - 96)); } else { ShuXin = new Line(PaperOrigenPoint.Convert3D(x_shuxian, y_anchor), PaperOrigenPoint.Convert3D(x_shuxian, y_anchor - 96)); } ShuXin.Layer = "标注"; recorder.AppendEntity(ShuXin); tr.AddNewlyCreatedDBObject(ShuXin, true); } DBText rowName = new DBText() { TextString = "Aspect d'ouvrage", TextStyleId = st["En"], Height = 2.5, Position = PaperOrigenPoint.Convert3D((x0 + t2) * 0.5, y_anchor - 3), HorizontalMode = TextHorizontalMode.TextCenter, VerticalMode = TextVerticalMode.TextVerticalMid, AlignmentPoint = PaperOrigenPoint.Convert3D((x0 + t2) * 0.5, y_anchor - 3), Layer = "标注", WidthFactor = 0.85, }; recorder.AppendEntity(rowName); tr.AddNewlyCreatedDBObject(rowName, true); rowName = new DBText() { TextString = "Matériaux", TextStyleId = st["En"], Height = 2.5, Position = PaperOrigenPoint.Convert3D((t2 + t3) * 0.5, y_anchor - 3), HorizontalMode = TextHorizontalMode.TextCenter, VerticalMode = TextVerticalMode.TextVerticalMid, AlignmentPoint = PaperOrigenPoint.Convert3D((t3 + t2) * 0.5, y_anchor - 3), Layer = "标注", WidthFactor = 0.85, }; recorder.AppendEntity(rowName); tr.AddNewlyCreatedDBObject(rowName, true); rowName = new DBText() { TextString = "Unité", TextStyleId = st["En"], Height = 2.5, Position = PaperOrigenPoint.Convert3D((t4 + t3) * 0.5, y_anchor - 3), HorizontalMode = TextHorizontalMode.TextCenter, VerticalMode = TextVerticalMode.TextVerticalMid, AlignmentPoint = PaperOrigenPoint.Convert3D((t3 + t4) * 0.5, y_anchor - 3), Layer = "标注", WidthFactor = 0.85, }; recorder.AppendEntity(rowName); tr.AddNewlyCreatedDBObject(rowName, true); rowName = new DBText() { TextString = "Quantité", TextStyleId = st["En"], Height = 2.5, Position = PaperOrigenPoint.Convert3D((x1 + t4) * 0.5, y_anchor - 3), HorizontalMode = TextHorizontalMode.TextCenter, VerticalMode = TextVerticalMode.TextVerticalMid, AlignmentPoint = PaperOrigenPoint.Convert3D((x1 + t4) * 0.5, y_anchor - 3), Layer = "标注", WidthFactor = 0.85, }; recorder.AppendEntity(rowName); tr.AddNewlyCreatedDBObject(rowName, true); Polyline box = new Polyline(); box.AddVertexAt(0, PaperOrigenPoint.Convert2D(x0, y0 + 15 * 6), 0, 0.3, 0.3); box.AddVertexAt(1, PaperOrigenPoint.Convert2D(x1, y0 + 15 * 6), 0, 0.3, 0.3); box.AddVertexAt(2, PaperOrigenPoint.Convert2D(x1, y0 - 6), 0, 0.3, 0.3); box.AddVertexAt(3, PaperOrigenPoint.Convert2D(x0, y0 - 6), 0, 0.3, 0.3); box.Layer = "标注"; box.Closed = true; recorder.AppendEntity(box); tr.AddNewlyCreatedDBObject(box, true); tr.Commit(); } return; }
public static void PrintNumTitle(Database db, Point3d PaperOrigenPoint, Bridge theBridge) { using (Transaction tr = db.TransactionManager.StartTransaction()) { TextStyleTable st = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable; BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord recorder = tr.GetObject(blockTbl[BlockTableRecord.PaperSpace], OpenMode.ForWrite) as BlockTableRecord; // 右上角标号 for (int j = 0; j < 2; j++) { for (int i = 0; i <= 1; i++) { DBText num = new DBText(); num.Height = 3.5; if (i == 0) { num.TextString = (j + 1).ToString(); num.Position = PaperOrigenPoint.Convert3D(387.5 + j * 420, 283); } else { num.TextString = "2"; num.Position = PaperOrigenPoint.Convert3D(402.5 + j * 420, 283); } num.HorizontalMode = TextHorizontalMode.TextCenter; num.VerticalMode = TextVerticalMode.TextVerticalMid; num.AlignmentPoint = num.Position; num.Layer = "标注"; num.TextStyleId = st["仿宋"]; recorder.AppendEntity(num); tr.AddNewlyCreatedDBObject(num, true); } } // 标题 for (int j = 0; j < 2; j++) { DBText title = new DBText(); if (j == 0) { title.TextString = "桥梁总体布置图(一)"; title.Position = PaperOrigenPoint.Convert3D(167.5, 15); } else { title.TextString = "桥梁总体布置图(二)"; title.Position = PaperOrigenPoint.Convert3D(167.5 + 420, 15); } title.Height = 4.5; title.HorizontalMode = TextHorizontalMode.TextCenter; title.VerticalMode = TextVerticalMode.TextVerticalMid; title.AlignmentPoint = title.Position; title.Layer = "标注"; title.TextStyleId = st["仿宋"]; title.WidthFactor = 0.8; recorder.AppendEntity(title); tr.AddNewlyCreatedDBObject(title, true); } tr.Commit(); } return; }
public static void PrintFName(Database db, Point3d InsertPoint, Bridge bridge) { using (Transaction tr = db.TransactionManager.StartTransaction()) { TextStyleTable st = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable; BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord recorder = tr.GetObject(blockTbl[BlockTableRecord.PaperSpace], OpenMode.ForWrite) as BlockTableRecord; DBText title = new DBText(); title.TextString = bridge.Name; title.Position = InsertPoint.Convert3D(108.3735, 17.5); title.Height = 3; title.HorizontalMode = TextHorizontalMode.TextCenter; title.VerticalMode = TextVerticalMode.TextVerticalMid; title.AlignmentPoint = title.Position; title.Layer = "标注"; title.TextStyleId = st["仿宋"]; title.WidthFactor = 0.8; recorder.AppendEntity(title); tr.AddNewlyCreatedDBObject(title, true); title = new DBText(); title.TextString = string.Format("{0}-{1}", bridge.BS, bridge.ES); title.Position = InsertPoint.Convert3D(108.3735, 17.5 - 5); title.Height = 3; title.HorizontalMode = TextHorizontalMode.TextCenter; title.VerticalMode = TextVerticalMode.TextVerticalMid; title.AlignmentPoint = title.Position; title.Layer = "标注"; title.TextStyleId = st["仿宋"]; title.WidthFactor = 0.8; recorder.AppendEntity(title); tr.AddNewlyCreatedDBObject(title, true); title = new DBText(); title.TextString = bridge.Name; title.Position = InsertPoint.Convert3D(108.3735 + 420, 17.5); title.Height = 3; title.HorizontalMode = TextHorizontalMode.TextCenter; title.VerticalMode = TextVerticalMode.TextVerticalMid; title.AlignmentPoint = title.Position; title.Layer = "标注"; title.TextStyleId = st["仿宋"]; title.WidthFactor = 0.8; recorder.AppendEntity(title); tr.AddNewlyCreatedDBObject(title, true); title.TextString = string.Format("{0}-{1}", bridge.BS, bridge.ES); title.Position = InsertPoint.Convert3D(108.3735 + 420, 17.5 - 5); title.Height = 3; title.HorizontalMode = TextHorizontalMode.TextCenter; title.VerticalMode = TextVerticalMode.TextVerticalMid; title.AlignmentPoint = title.Position; title.Layer = "标注"; title.TextStyleId = st["仿宋"]; title.WidthFactor = 0.8; recorder.AppendEntity(title); tr.AddNewlyCreatedDBObject(title, true); tr.Commit(); } return; }