/// <summary> /// 初始化地质图列表-根据一航数据 /// </summary> /// <param name="filepath"></param> /// <returns></returns> private List <DZT> IniDZT2(string filepath) { var DZT_Csv = BPublicFunctions.OpenCSV(filepath).AsEnumerable(); List <DZT> result = new List <DZT>(); string datpath = Path.ChangeExtension(filepath, "dzt"); StreamReader sR = File.OpenText(datpath); DZT item = new DZT(); Tuple <string, double> tuple = new Tuple <string, double>("", 0.0); List <Tuple <string, double> > theBGList = new List <Tuple <string, double> >(); string Content = sR.ReadToEnd(); sR.Close(); List <string> AllLines = Regex.Split(Content, "\r\n", RegexOptions.IgnoreCase).ToList(); foreach (string lines in AllLines) { int i = AllLines.IndexOf(lines); if (lines.StartsWith("HD")) { // 初始化暂存 theBGList = new List <Tuple <string, double> >(); item = new DZT(); // 查询桩号 var ff = from row in DZT_Csv where row["孔号"].ToString() == lines select row["中心桩号"].ToString(); if (ff.Count() == 0) { continue; } item.pk_double = Dalot.PkString2Double(ff.First()); item.kongkou = double.Parse(AllLines[i - 1]); List <string> layers = new List <string>(); for (int j = 0; Regex.IsMatch(AllLines[i + 4 + j], "[\u4e00-\u9fbb]"); j++) { layers.Add(AllLines[i + 4 + j].Split(':')[0]); } for (int j = 0; j < layers.Count(); j++) { tuple = new Tuple <string, double>(layers[j], double.Parse(AllLines[i + 3 + layers.Count() + 1 + j])); theBGList.Add(tuple); } item.DZBG = theBGList; result.Add(item); } } return(result); }
/// <summary> /// 地质图检索 /// </summary> /// <param name="repo">地质图列表</param> /// <param name="pk">里程(字符串)</param> /// <returns></returns> private DZT DztLookUp(List <DZT> repo, string pk) { DZT res = new DZT(); double aim = Dalot.PkString2Double(pk); var dist = from item in repo select Math.Abs(item.pk_double - aim); double dist_min = dist.Min(); foreach (DZT item in repo) { if (Math.Abs(item.pk_double - aim) - dist_min < 0.001) { res = item; break; } } return(res); }
/// <summary> /// 初始化地质图列表 /// </summary> /// <param name="filepath"></param> /// <returns></returns> private List <DZT> IniDZT(string filepath) { //System.Data.DataTable DZT_Csv = BPublicFunctions.OpenCSV(filepath); List <DZT> result = new List <DZT>(); string datpath = Path.ChangeExtension(filepath, "dat"); StreamReader sR = File.OpenText(datpath); string nextLine; DZT item = new DZT(); Tuple <string, double> tuple = new Tuple <string, double>("", 0.0); List <Tuple <string, double> > theBGList = new List <Tuple <string, double> >(); int i = 0; int jj = 0; while (true) { i++; nextLine = sR.ReadLine(); if (nextLine == null) { item.DZBG = theBGList; result.Add(item); theBGList = new List <Tuple <string, double> >(); break; } else if (nextLine.StartsWith("#")) { if (i != 1) { item.DZBG = theBGList; result.Add(item); theBGList = new List <Tuple <string, double> >(); item = new DZT(); jj = 0; } continue; } else if (nextLine.StartsWith("坐标")) { MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)"); item.pk_double = Convert.ToDouble(matches[2].Value) * 1000 + Convert.ToDouble(matches[3].Value); } else if (nextLine.StartsWith("孔口")) { MatchCollection matches = Regex.Matches(nextLine, @"(\d+\.?\d*)"); item.kongkou = Convert.ToDouble(matches[0].Value); } else if (nextLine.ToCharArray()[0] >= 0x4e00 && nextLine.ToCharArray()[0] <= 0x9fbb) { string res = nextLine.Split(":".ToCharArray())[0]; jj++; double data = 0; try { data = Convert.ToDouble(sR.ReadLine()); } catch { data = 0; } finally { tuple = new Tuple <string, double>(res, data); theBGList.Add(tuple); } } } sR.Close(); return(result); }
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(); }
public static void PlotDZT(Database db, Point2d pos, double refH, DZT relatedDZT, int s) { Dictionary <string, string> patterdic = new Dictionary <string, string>(); patterdic.Add("中砂砾", "TRIANG"); patterdic.Add("黏土", "ANSI31"); patterdic.Add("中砂", "DOTS"); patterdic.Add("全风化硅质板岩", "CORK"); patterdic.Add("强风化硅质板岩", "CROSS"); patterdic.Add("强风化岩", "CROSS"); patterdic.Add("中风化石英闪长岩", "AR-RSHKE"); patterdic.Add("中风化岩", "AR-RSHKE"); patterdic.Add("块体", "GRAVEL"); patterdic.Add("耕植土", "ANSI37"); patterdic.Add("其他", "ANSI38"); Dictionary <string, double> patterscale = new Dictionary <string, double>(); patterscale.Add("中砂砾", 15); patterscale.Add("黏土", 15); patterscale.Add("中砂", 30); patterscale.Add("全风化硅质板岩", 15); patterscale.Add("强风化硅质板岩", 15); patterscale.Add("强风化岩", 15); patterscale.Add("中风化石英闪长岩", 0.5); patterscale.Add("中风化岩", 0.5); patterscale.Add("块体", 15); patterscale.Add("耕植土", 15); patterscale.Add("其他", 15); 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 modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; for (int i = 0; i < relatedDZT.DZBG.Count(); i++) { Tuple <string, double> tp = relatedDZT.DZBG[i]; double topbg; double botbg = tp.Item2; DBText theTitle = new DBText(); theTitle.TextString = string.Format("{0:F3}", botbg); theTitle.Height = 2.5 * s; theTitle.Position = pos.Convert3D(0 + 2200 + 500, (botbg - refH) * 1000); theTitle.HorizontalMode = TextHorizontalMode.TextLeft; theTitle.VerticalMode = TextVerticalMode.TextBottom; theTitle.AlignmentPoint = theTitle.Position; theTitle.Layer = "地质"; theTitle.TextStyleId = st["fsdb"]; theTitle.WidthFactor = 0.85; modelSpace.AppendEntity(theTitle); tr.AddNewlyCreatedDBObject(theTitle, true); if (relatedDZT.DZBG.Count() == 1 || i + 1 == relatedDZT.DZBG.Count()) { topbg = relatedDZT.kongkou; theTitle = new DBText(); theTitle.TextString = string.Format("{0:F3}", topbg); theTitle.Height = 2.5 * s; theTitle.Position = pos.Convert3D(0 + 2200 + 500, (topbg - refH) * 1000); theTitle.HorizontalMode = TextHorizontalMode.TextLeft; theTitle.VerticalMode = TextVerticalMode.TextBottom; theTitle.AlignmentPoint = theTitle.Position; theTitle.Layer = "地质"; theTitle.TextStyleId = st["fsdb"]; theTitle.WidthFactor = 0.85; modelSpace.AppendEntity(theTitle); tr.AddNewlyCreatedDBObject(theTitle, true); } else { topbg = relatedDZT.DZBG[i + 1].Item2; } Polyline pl = new Polyline(); pl.AddVertexAt(0, pos.Convert2D(0 + 2200, (topbg - refH) * 1000), 0, 0, 0); pl.AddVertexAt(1, pos.Convert2D(500 + 2200, (topbg - refH) * 1000), 0, 0, 0); pl.AddVertexAt(2, pos.Convert2D(500 + 2200, (botbg - refH) * 1000), 0, 0, 0); pl.AddVertexAt(3, pos.Convert2D(0 + 2200, (botbg - refH) * 1000), 0, 0, 0); pl.Closed = true; pl.Layer = "地质"; modelSpace.AppendEntity(pl); tr.AddNewlyCreatedDBObject(pl, true); Hatch hat = new Hatch(); try { hat.SetHatchPattern(HatchPatternType.PreDefined, patterdic[tp.Item1]); hat.PatternScale = patterscale[tp.Item1]; } catch { hat.SetHatchPattern(HatchPatternType.PreDefined, patterdic["其他"]); hat.PatternScale = 15; } modelSpace.AppendEntity(hat); tr.AddNewlyCreatedDBObject(hat, true); hat.Layer = "地质"; hat.Associative = true; hat.AppendLoop(HatchLoopTypes.Default, new ObjectIdCollection { pl.ObjectId }); hat.EvaluateHatch(true); try { hat.SetHatchPattern(HatchPatternType.PreDefined, patterdic[tp.Item1]); hat.PatternScale = patterscale[tp.Item1]; } catch { hat.SetHatchPattern(HatchPatternType.PreDefined, patterdic["其他"]); hat.PatternScale = 15; } } tr.Commit(); } }