Example #1
0
        private DMT DmtLookUp(List <DMT> repo, string pk)
        {
            DMT    res       = new DMT();
            double pk_double = Dalot.PkString2Double(pk);

            foreach (DMT item in repo)
            {
                double target = Dalot.PkString2Double(item.pk_string);
                if (Dalot.PkString2Double(item.pk_string) == Dalot.PkString2Double(pk))
                {
                    res = item;
                }
            }
            return(res);
        }
Example #2
0
        public void Main()
        {
            //--------------------------------------------------------------------------------------
            // 基本句柄
            //--------------------------------------------------------------------------------------
            Document doc        = Application.DocumentManager.MdiActiveDocument;
            Database db         = doc.Database;
            Editor   ed         = doc.Editor;
            ObjectId paperSpace = db.CreatPaperSpace();

            MOExcel.Application app    = new MOExcel.Application();
            MOExcel.Workbook    wbook  = app.Workbooks.Add(Type.Missing);
            MOExcel.Worksheet   wsheet = (MOExcel.Worksheet)wbook.Worksheets[1];
            //--------------------------------------------------------------------------------------
            // 初始化带帽图列表
            //--------------------------------------------------------------------------------------
            string dmtpath = BPublicFunctions.GetXPath("选择带帽图数据", "断面图提取文件|*.dat");

            if (dmtpath == "")
            {
                return;
            }
            else
            {
                Dmt_list = IniDMT(dmtpath);
                ed.WriteMessage("\n断面图数据读取成功");
            }
            //--------------------------------------------------------------------------------------
            // 初始化地层图列表
            //--------------------------------------------------------------------------------------
            string dicengpath = BPublicFunctions.GetXPath("选择地层数据", "地层图提取文件|*.csv;*.dat");

            if (dicengpath == "")
            {
                return;
            }
            else
            {
                if (dicengpath.EndsWith("csv"))
                {
                    Dzt_list = IniDZT2(dicengpath);
                }
                else if (dicengpath.EndsWith("dat"))
                {
                    Dzt_list = IniDZT(dicengpath);
                }

                ed.WriteMessage("\n地层数据读取成功");
            }
            //--------------------------------------------------------------------------------------
            //读取数据
            //--------------------------------------------------------------------------------------
            Dalot TheDalot;

            System.Data.DataTable Parameters = new System.Data.DataTable();

            string aa = BPublicFunctions.GetXPath("选择设计表", "参数表|*.xls");

            if (aa == "")
            {
                return;
            }
            else
            {
                Parameters = GetDataFromExcelByCom(true, aa);
                ed.WriteMessage("\n涵洞数据读取成功");
            }
            //--------------------------------------------------------------------------------------
            // 生成绘图id序列
            //--------------------------------------------------------------------------------------
            var IDtoPolot = Parameters.AsEnumerable().Select(t => t.Field <int>("id")).ToList();

            //--------------------------------------------------------------------------------------
            // 实例化并绘图
            //--------------------------------------------------------------------------------------
            foreach (int ii in IDtoPolot)
            {
                // 实例化涵洞
                TheDalot = GetDalotFromDataTable(Parameters, ii);


                // 查询带帽图
                DMT relatedDMT = DmtLookUp(Dmt_list, TheDalot.Pk_string());
                if (relatedDMT.dmx is null)
                {
                    ed.WriteMessage("\n里程" + TheDalot.Pk_string() + "涵洞无断面信息,无法绘制");
                    continue;
                }
                Point3d PointDMT = new Point3d(relatedDMT.x0, 0, 0);
                TheDalot.W1 = relatedDMT.Wz * 1000;
                TheDalot.W2 = relatedDMT.Wy * 1000;
                TheDalot.H1 = relatedDMT.H1;
                TheDalot.H2 = relatedDMT.H2;
                TheDalot.H3 = relatedDMT.H3;
                TheDalot.H0 = relatedDMT.H2 - TheDalot.dH;

                Point3d SJXRefPoint = relatedDMT.sjx.GetClosestPointTo(PointDMT, Vector3d.YAxis, true);
                Point3d DmxRefP     = relatedDMT.dmx.GetClosestPointTo(PointDMT, Vector3d.YAxis, true);


                // 查询地层图
                DZT relatedDZT = DztLookUp(Dzt_list, TheDalot.Pk_string());
                if (relatedDZT.DZBG.Count() == 0)
                {
                    ed.WriteMessage("\n里程" + TheDalot.Pk_string() + "涵洞无地质信息,无法绘制");
                    continue;
                }
                TheDalot.relatedDZT = relatedDZT;


                //绘图
                int      scaleA      = TheDalot.ScaleA;
                int      scaleB      = TheDalot.ScaleB;
                double[] AreaForTabe = new double[4];

                Extents2d extA;
                extA = TheDalot.PlotA(db, TheDalot.BasePoint);
                double  cx          = (extA.MaxPoint.X + extA.MinPoint.X) * 0.5;
                double  cy          = (extA.MaxPoint.Y + extA.MinPoint.Y) * 0.5;
                double  halfY       = (extA.MaxPoint.Y - extA.MinPoint.Y) * 0.5;
                Point2d centerPoint = Point2d.Origin.Convert2D(cx, extA.MaxPoint.Y - 277 * 0.5 * scaleA + 15 * scaleA);
                double  dAB         = extA.MinPoint.Y - TheDalot.BasePoint.Y;
                dAB -= 15 * scaleA; //图名
                dAB -= 15 * scaleA; //顶标注
                dAB -= 15 * scaleA; //H2
                dAB -= (TheDalot.H2 - TheDalot.H0) * 1000;
                TheDalot.PlotB(db, TheDalot.BasePoint.Convert2D(0, dAB), relatedDMT.sjx, relatedDMT.dmx,
                               SJXRefPoint, DmxRefP);
                AreaForTabe = TheDalot.PlotC(db, TheDalot.BasePoint.Convert2D(800 * scaleA, dAB));

                double tmpwidth = (TheDalot.FooterW == 0) ? 500 : 2000;
                double dBC      = 0.5 * TheDalot.Sect[0] + TheDalot.FooterW + tmpwidth + TheDalot.Sect[2] + 1100 + 5 * scaleB;
                double offC     = scaleB * 240 * 0.5 - 73 * scaleB;// - dBC;

                Point2d centerPointC = TheDalot.BasePoint.Convert2D(800 * scaleA - offC, dAB - 22.5 * scaleB + TheDalot.Sect[2] + 30 * scaleB);



                // 成图
                string fsd = Path.Combine(Path.GetDirectoryName(dmtpath), "TK.dwg");

                db.XrefAttachAndInsert(fsd, paperSpace, Point3d.Origin.Convert3D(0, 24 - (1 + ii) * 297, 0));

                // 注释
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    Layout lay = (Layout)tr.GetObject(paperSpace, OpenMode.ForWrite);

                    var      vpIds = lay.GetViewports();
                    Viewport vpA, vpB;
                    var      btr = (BlockTableRecord)tr.GetObject(lay.BlockTableRecordId, OpenMode.ForWrite);
                    vpA = new Viewport();
                    btr.AppendEntity(vpA);
                    tr.AddNewlyCreatedDBObject(vpA, true);
                    vpA.On     = true;
                    vpA.GridOn = false;
                    vpA.DrawMyViewport(1, Point3d.Origin.Convert3D(0, -(1 + ii) * 297, 0), centerPoint, TheDalot.ScaleA);
                    vpB = new Viewport();
                    btr.AppendEntity(vpB);
                    tr.AddNewlyCreatedDBObject(vpB, true);
                    vpB.On     = true;
                    vpB.GridOn = false;
                    vpB.DrawMyViewport(2, Point3d.Origin.Convert3D(0, -(1 + ii) * 297, 0), centerPointC, TheDalot.ScaleB);

                    TextStyleTable st        = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                    MText          theNote   = new MText();
                    MText          theNoteZH = new MText();
                    if (TheDalot.DalotType <= DType.B)
                    {
                        theNote.Contents =
                            "Note:\\P" +
                            "1.L'unité de dimension est en centimètre sauf que les cotes. \\P" +
                            "2.Le corps du dalot est préfabriqué en segment et la tête d'ouvrage est coulés sur place. Le joint est  mis en place entre différents parties. \\P" +
                            "3.Explication pour joint et couche d'étanchéité : \\P" +
                            "   Joint: Le joint est rempli par bitume et filasse ou par autre matériaux d'étanchéité élastique. Le pied-droit et tablier adoptent deux couches " +
                            "de feutre bitumé coller dessus le joint par bitume, la largeur de feutre bitumé est de 40cm. Le feutre bitumé est collé dessus le gâchis hydrofuge si le tableau est couvert par le gâchis hydrofuge.\\P" +
                            "   Couche d'étanchéité: Pour hauteur de remblai plus de 0.5m, il faut enduire bitume avec épaisseur de 1~1.5mm deux  fois pour les partie enterrés du dalot; Pour H.remblai moins de 0.5m, " +
                            "il faut d'abord mettre 2cm de  mortier hydrofuge sur tablier et puis enduire bitume avec épaisseur de 1~1.5mm deux fois pour les  partie enterrés du dalot. \\P" +
                            "4.Vérifier la conformabilité entre les plans et terrain réel avant l'exécution du travaux. Il faut informer le bureau d'étude à réviser la cote s'il existe différence évidente.\\P" +
                            "5.Annuler l'enrochement d'exutoire du dalot si sa fondation est en roche. Après l'achèvement du dalot, il faut remplir ou creuser l'amont et l'aval du dalot pour assurer l'évacuation d'eau.\\P";
                        theNote.Location = Point3d.Origin.Convert3D(260, 100 - (1 + ii) * 297, 0);

                        theNoteZH.Contents =
                            "注:\\P" +
                            "1.本图尺寸除高程以米计外,其余均以厘米为单位。\\P" +
                            "2.涵身采用节段预制施工,进出水口构造采用现浇施工,涵身之间及涵身与进出口构造之间设置接缝。\\P" +
                            "3.涵洞接缝及防水层规定:\\P" +
                            "  接缝:涵身接缝及涵身与进出水口构造接缝采用沥青麻絮或其他有弹性的防水材料填塞,侧面及顶面采用两层油毛毡以沥青粘贴于涵身接缝位置,油毛毡宽度40cm。对于涵顶有防水砂浆罩面的情况,油毛毡黏贴于防水砂浆之上。\\P" +
                            "  防水层:当填土高度大于等于0.5m时,涵洞与填土接触部分涂抹热沥青两道,每道厚度约1~1.5mm;当填土高度小于0.5m时,涵洞顶部先采用2cm防水砂浆罩面,然后在涵洞与填土接触部分涂抹热沥青两道,每道厚度约1~1.5mm。\\P" +
                            "4.施工前认真核查设计图纸与实际地形是否吻合,如有较大差别及时与设计单位联系,调整涵洞标高。\\P" +
                            "5.如涵洞出口处地质为岩石,可取消出口处防冲碎石;涵洞施工完后,需对进出水口附近地面做适当挖填,以保证涵洞排水通畅。\\P";
                        theNoteZH.Location = Point3d.Origin.Convert3D(43, 68 - (1 + ii) * 297, 0);
                    }
                    else
                    {
                        theNote.Contents =
                            "Note:\\P" +
                            "1.L'unité de dimensions est en mètre pour altitude et en centimètre pour les autres. \\P" +
                            "2.Le dalot est fabriqué en béton coulé sur place sans joint dilatation pour le corps. \\P" +
                            "3.Enduire bitume avec  épaisseur de 1~1.5mm deux fois entre dalot et terre de remblai. \\P" +
                            "4.Vérifier l'identité entre les plans et terrain réel avant l'exécution de travaux. Il faut contacter  les bureaux d'étude à réviser l'altitude s'il existe différence évidente. \\P" +
                            "5.Après finir l'exécution de travaux, il faut remplir ou creuser l'amont et l'aval de dalot pour  assurer libre évacuation d'eau. \\P";
                        theNote.Location = Point3d.Origin.Convert3D(260, 80 - (1 + ii) * 297, 0);


                        theNoteZH.Contents =
                            "注:\\P" +
                            "1.本图尺寸除高程以米计外,其余均以厘米为单位。\\P" +
                            "2.涵洞采用现浇施工,基础岩石裸露,涵身不设置沉降缝。\\P" +
                            "3.在涵洞与填土接触部分涂抹热沥青两道,每道厚度约1~1.5mm。\\P" +
                            "4.施工前认真核查设计图纸与实际地形是否吻合,如有较大差别及时与设计单位联系,调整涵洞标高。\\P" +
                            "5.涵洞施工完后,需对进出水口附近地面做适当挖填,以保证涵洞排水通畅。\\P";
                        theNoteZH.Location = Point3d.Origin.Convert3D(43, 68 - (1 + ii) * 297, 0);
                    }

                    theNote.TextStyleId = st["En"];
                    theNote.Width       = 145;
                    btr.AppendEntity(theNote);
                    tr.AddNewlyCreatedDBObject(theNote, true);
                    theNoteZH.TextStyleId = st["fsdb"];
                    theNoteZH.Width       = 245;
                    // 中文
                    //btr.AppendEntity(theNoteZH);
                    //tr.AddNewlyCreatedDBObject(theNoteZH, true);


                    tr.Commit();
                }


                //  表格
                TextPloter.PrintTable(db, Point3d.Origin.Convert3D(0, -(ii + 1) * 297), TheDalot, relatedDMT, Parameters, AreaForTabe, wsheet, ii + 4);
                // 图名图号
                TextPloter.PrintNumTitle(db, Point3d.Origin.Convert3D(0, -(ii + 1) * 297), TheDalot);
            }

            //--------------------------------------------------------------------------------------
            // 制作表头 储存汇总数量表
            //--------------------------------------------------------------------------------------
            wsheet.Cells[1, 1] = "No";
            MOExcel.Range range = wsheet.get_Range("A1", "A4");
            range.Merge(0);
            wsheet.Cells[1, 2] = "PK";
            range = wsheet.get_Range("B1", "B4");
            range.Merge(0);
            wsheet.Cells[1, 3] = "Type\nd'ouvrage";
            range = wsheet.get_Range("C1", "C4");
            range.Merge(0);
            wsheet.Cells[1, 4] = "Dimension";
            range = wsheet.get_Range("D1", "D3");
            range.Merge(0);
            wsheet.Cells[4, 4] = "m";
            wsheet.Cells[1, 5] = "Biais";
            range = wsheet.get_Range("E1", "E3");
            range.Merge(0);
            wsheet.Cells[4, 5] = "°";
            wsheet.Cells[1, 6] = "L.";
            range = wsheet.get_Range("F1", "F3");
            range.Merge(0);
            wsheet.Cells[4, 6] = "m";
            wsheet.Cells[1, 7] = "Type d'éntrée et de\nsortie";
            range = wsheet.get_Range("G1", "H2");
            range.Merge(0);
            wsheet.Cells[3, 7] = "Amont";
            range = wsheet.get_Range("G3", "G4");
            range.Merge(0);
            wsheet.Cells[3, 8] = "Aval";
            range = wsheet.get_Range("H3", "H4");
            range.Merge(0);
            wsheet.Cells[2, 9] = "Corps";
            range = wsheet.get_Range("I2", "K2");
            range.Merge(0);
            wsheet.Cells[3, 9] = "Béton\n(C25/30)";
            wsheet.Cells[4, 9] = "m3";
            wsheet.Cells[4, 9].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 10] = "Armature\n(FeE 400)";
            wsheet.Cells[4, 10] = "kg";
            wsheet.Cells[3, 11] = "Quantité de segment de\nprefabriquation,transport et\nlevage";
            wsheet.Cells[4, 11] = "bloc";
            wsheet.Cells[2, 12] = "Entrée et sortie";
            range = wsheet.get_Range("L2", "O2");
            range.Merge(0);
            wsheet.Cells[3, 12] = "Puit déau\n(C25/30)";
            wsheet.Cells[4, 12] = "m3";
            wsheet.Cells[4, 12].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 13] = "Mur en aile\n(C25/30)";
            wsheet.Cells[4, 13] = "m3";
            wsheet.Cells[4, 13].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 14] = "Guide roue\n(C25/30)";
            wsheet.Cells[4, 14] = "m3";
            wsheet.Cells[4, 14].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 15] = "Armature\n(FeE 400)";
            wsheet.Cells[4, 15] = "kg";
            wsheet.Cells[2, 16] = "Foundation";
            range = wsheet.get_Range("P2", "Q2");
            range.Merge(0);
            wsheet.Cells[3, 16] = "Béton\n(C25/30)";
            wsheet.Cells[4, 16] = "m3";
            wsheet.Cells[4, 16].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 17] = "Substitution\nRadier";
            wsheet.Cells[4, 17] = "m3";
            wsheet.Cells[4, 17].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[2, 18] = "Etanchéité";
            range = wsheet.get_Range("R2", "T2");
            range.Merge(0);
            wsheet.Cells[3, 18] = "Badigeonnage\ndes parements";
            wsheet.Cells[4, 18] = "m2";
            wsheet.Cells[4, 18].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 19] = "Motier\nhydro";
            wsheet.Cells[4, 19] = "m2";
            wsheet.Cells[4, 19].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 20] = "Joint";
            wsheet.Cells[4, 20] = "m2";
            wsheet.Cells[4, 20].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[2, 21] = "Terrassement";
            range = wsheet.get_Range("U2", "W2");
            range.Merge(0);
            wsheet.Cells[3, 21] = "Déblai";
            wsheet.Cells[4, 21] = "m3";
            wsheet.Cells[4, 21].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 22] = "Remblaiement au\ndos des ponceaux";
            wsheet.Cells[4, 22] = "m3";
            wsheet.Cells[4, 22].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[3, 23] = "Enrochement";
            wsheet.Cells[4, 23] = "m3";
            wsheet.Cells[4, 23].Characters[2, 1].Font.Superscript = true;
            wsheet.Cells[1, 9] = "Quantité des travaux";
            range = wsheet.get_Range("I1", "W1");
            range.Merge(0);

            wsheet.Columns.EntireColumn.AutoFit();
            wsheet.Cells.HorizontalAlignment = MOExcel.XlHAlign.xlHAlignCenter; //水平居中
            wsheet.Cells.VerticalAlignment   = MOExcel.XlVAlign.xlVAlignCenter; //垂直居中

            string bb = Path.Combine(Path.GetDirectoryName(aa), string.Format("数量汇总表{0}-{1}", IDtoPolot.Min(), IDtoPolot.Max()));

            wsheet.SaveAs(bb, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            wbook.Close(false, Type.Missing, Type.Missing);
            Marshal.ReleaseComObject(wbook);
            wbook = null;
            app.Workbooks.Close();
            app.KillExcelApp();
        }
Example #3
0
        /// <summary>
        /// 初始化断面图
        /// </summary>
        /// <param name="filepath">数据文件路径</param>
        /// <returns></returns>
        private List <DMT> IniDMT(string filepath)
        {
            List <DMT> result = new List <DMT>();



            StreamReader sR = File.OpenText(filepath);
            string       nextLine;
            DMT          item = new DMT();
            int          i    = 0;

            while (true)
            {
                i++;
                nextLine = sR.ReadLine();
                if (nextLine == null)
                {
                    result.Add(item);
                    break;
                }
                else if (nextLine.StartsWith("#"))
                {
                    if (i != 1)
                    {
                        result.Add(item);
                        item    = new DMT();
                        item.Ht = 0;
                        item.Hw = 0;
                    }
                    continue;
                }
                else if (nextLine.StartsWith("Hw"))
                {
                    MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)");
                    item.Hw = Convert.ToDouble(matches[0].Value);
                    item.Wz = Convert.ToDouble(matches[1].Value);
                    item.Wy = Convert.ToDouble(matches[2].Value);
                }

                else if (nextLine.StartsWith("Ht"))
                {
                    MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)");
                    item.Ht = Convert.ToDouble(matches[0].Value);
                    item.Wz = Convert.ToDouble(matches[1].Value);
                    item.Wy = Convert.ToDouble(matches[2].Value);
                }
                else if (nextLine.StartsWith("PK") || nextLine.StartsWith("K"))
                {
                    item.pk_string = nextLine;
                }
                else if (nextLine.StartsWith("H0"))
                {
                    MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)");
                    item.H1 = Convert.ToDouble(matches[1].Value);
                }
                else if (nextLine.StartsWith("H1"))
                {
                    MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)");
                    item.H2 = Convert.ToDouble(matches[1].Value);
                }
                else if (nextLine.StartsWith("H2"))
                {
                    MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)");
                    item.H3 = Convert.ToDouble(matches[1].Value);
                }
                else if (nextLine.StartsWith("sjx"))
                {
                    item.sjx = GetPLFromFile(filepath, i);
                }
                else if (nextLine.StartsWith("dmx"))
                {
                    item.dmx = GetPLFromFile(filepath, i);
                }
                else if (nextLine.StartsWith("X"))
                {
                    MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)");
                    item.x0 = Convert.ToDouble(matches[0].Value);
                }
            }
            sR.Close();
            return(result);
        }
Example #4
0
        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;
        }