internal static IList <Class908> smethod_2( DxfMText mtext, Color color, short lineWeight) { return(Class666.smethod_3(mtext, color, lineWeight, Matrix4D.Identity, (Class985)null)); }
public DxfAttributeObjectContextData(DxfAttributeDefinition attribute, DxfScale scale) : base((DxfText)attribute, scale) { DxfMText mtext = attribute.method_21(); this.dxfMTextObjectContextData_0 = mtext != null ? new DxfMTextObjectContextData(mtext, scale) : (DxfMTextObjectContextData)null; }
internal static IList <Class908> smethod_3( DxfMText mtext, Color color, short lineWeight, Matrix4D insertionTransformation, Class985 mtextLayoutInfo) { return(Class666.smethod_1(mtext.Text, mtext.ReferenceRectangleWidth, mtext.Height, mtext.AttachmentPoint, mtext.LineSpacingFactor, mtext.LineSpacingStyle, mtext.Style, mtext.Style.WidthFactor, color, mtext.DrawingDirection, lineWeight, insertionTransformation * mtext.Transform, mtextLayoutInfo, Enum24.flag_3)); }
public DxfMTextObjectContextData(DxfMText mtext, DxfScale scale) : base(scale) { this.size2D_0.X = mtext.ReferenceRectangleWidth; this.size2D_0.Y = mtext.ReferenceRectangleHeight; this.size2D_1.X = mtext.BoxWidth; this.size2D_1.Y = mtext.BoxHeight; this.vector3D_0 = mtext.XAxis; this.point3D_0 = mtext.InsertionPoint; this.attachmentPoint_0 = mtext.AttachmentPoint; }
/// <summary> /// 方法,向模型空间添加一个多行文本,居中对齐 /// </summary> /// <param name="_model">模型</param> /// <param name="_text">文本内容</param> /// <param name="_x">起点X坐标</param> /// <param name="_y">起点Y坐标</param> /// <param name="_width">文本宽度</param> /// <param name="_height">文本高度</param> /// <param name="_style">文字样式</param> /// <returns></returns> public DxfMText AddMText(string _text, double _x, double _y, double _width, double _height, DxfTextStyle _style) { DxfMText mText = new DxfMText(_text, new Point3D(_x, _y, 0d), _height); mText.ReferenceRectangleWidth = _width; mText.Height = _height; mText.Style = _style; mText.AttachmentPoint = AttachmentPoint.MiddleCenter; Model.Entities.Add(mText); return(mText); }
internal static IList <Class908> smethod_4( DxfMText mtext, Color color, short lineWeight, Matrix4D insertionTransformation, Bounds2D collectBounds) { Class985 resultLayoutInfo = collectBounds == null ? (Class985)null : new Class985(); IList <Class908> class908List = Class666.smethod_1(mtext.Text, mtext.ReferenceRectangleWidth, mtext.Height, mtext.AttachmentPoint, mtext.LineSpacingFactor, mtext.LineSpacingStyle, mtext.Style, mtext.Style.WidthFactor, color, mtext.DrawingDirection, lineWeight, insertionTransformation * mtext.Transform, resultLayoutInfo, Enum24.flag_3); collectBounds?.Update(resultLayoutInfo.Bounds); return(class908List); }
public void CreateMText(DxfMText text, DrawContext.Wireframe drawContext) { throw new Exception("The method or operation is not implemented."); }
public Class971(DxfMText text, DrawContext.Wireframe drawContext) { this.dxfMText_0 = text; this.wireframe_0 = drawContext; }
public void CreateMText(DxfMText text, DrawContext.Wireframe drawContext) { this.linkedListNodeRef_0.Insert((IWireframeDrawable) new WireframeGraphicsCache.Class971(text, drawContext)); }
public void CreateMText(DxfMText text) { this.iwireframeGraphicsFactory2_0.CreateMText(text); }
/// <summary> /// Visits the specified entity. /// See the <see cref="IEntityVisitor"/> for more details. /// </summary> public override void Visit(DxfMText mtext) { HandleEntity(mtext); }
public static IEnumerable <Tuple <string, DxfEntity> > AssociateEntitiesWithDescriptions(IEnumerable <DxfEntity> input_entities) { List <LocatedEntity> graphical_object_locations = new List <LocatedEntity>(); List <LocatedDescription> desciptions_locations = new List <LocatedDescription>(); List <Tuple <string, DxfEntity> > ret = new List <Tuple <string, DxfEntity> >(); foreach (DxfEntity entity in input_entities) { DxfPoint point = DxfPoint.Origin; string desc = null; switch (entity.EntityType) { case DxfEntityType.MText: DxfMText text = entity as DxfMText; desc = text.Text; point = text.InsertionPoint; break; case DxfEntityType.Text: DxfText text2 = entity as DxfText; desc = text2.Value; point = text2.Location; break; default: var bb = entity.GetBoundingBox(); if (bb.HasValue == true) { var boundingBox = bb.Value; point = (boundingBox.MinimumPoint + boundingBox.MaximumPoint) / 2; } break; } if ((point != DxfPoint.Origin) && (desc != null)) { LocatedDescription md; md.point = point; md.description = desc; desciptions_locations.Add(md); } else { graphical_object_locations.Add(new LocatedEntity { point = point, entity = entity }); } } if (desciptions_locations.Count == 0) { foreach (var o in graphical_object_locations) { ret.Add(new Tuple <string, DxfEntity>(null, o.entity)); } } else { if (desciptions_locations.Count != graphical_object_locations.Count) { throw new InvalidOperationException("number of objects differs from number of descriptions"); } foreach (var b in desciptions_locations) { double min_dist = double.MaxValue; LocatedEntity?closest_object = null; foreach (var c in graphical_object_locations) { var distance = (c.point - b.point).Length; if (distance < min_dist) { min_dist = distance; closest_object = c; } } if (closest_object != null) { ret.Add(new Tuple <string, DxfEntity>(b.description, closest_object.Value.entity)); graphical_object_locations.Remove((LocatedEntity)closest_object); } } } return(ret); }
/// <summary> /// 创建一张表格的方法 /// </summary> public void createOneTable() { string str = getRadomData(6); model = new DxfModel(); //创建一个图层 DxfLayer layerTable = new DxfLayer("" + str + programName); model.Layers.Add(layerTable); //创建一个块 block = new DxfBlock("AcosticBoreHoleTable_Block" + str); model.Blocks.Add(block); DxfInsert insert = new DxfInsert(block, new Point3D(0, 0, 0)); insert.Layer = layerTable; model.Entities.Add(insert); { DxfTableStyle tableStyle1 = new DxfTableStyle("Single1 bordered" + str); tableStyle1.DataCellStyle.SetAllBordersBorderType(BorderType.Single); //tableStyle1.DataCellStyle.SetAllBordersColor(Colors.DarkGray); tableStyle1.TitleCellStyle.SetAllBordersBorderType(BorderType.Single); tableStyle1.HeaderCellStyle.SetAllBordersBorderType(BorderType.Single); //tableStyle1.HeaderCellStyle.ContentColor = Colors.DarkGray; model.TableStyles.Add(tableStyle1); DxfTable table1 = new DxfTable(tableStyle1); //表格插入点的位置 table1.InsertionPoint = new Point3D(0d, 0d, 0d); //设置表格的行数和列数 //各行高 table1.RowCount = 3; table1.ColumnCount = 9; table1.Rows.ElementAt <DxfTableRow>(0).Height = 18d; table1.Rows.ElementAt <DxfTableRow>(1).Height = 5d; table1.Rows.ElementAt <DxfTableRow>(2).Height = 255; /*foreach (DxfTableColumn column in table1.Columns) * { * column.Width = 25d; * }*/ table1.Columns.ElementAt <DxfTableColumn>(0).Width = 9; table1.Columns.ElementAt <DxfTableColumn>(1).Width = 13; table1.Columns.ElementAt <DxfTableColumn>(2).Width = 9; table1.Columns.ElementAt <DxfTableColumn>(3).Width = 13; table1.Columns.ElementAt <DxfTableColumn>(4).Width = 20; table1.Columns.ElementAt <DxfTableColumn>(5).Width = 40; table1.Columns.ElementAt <DxfTableColumn>(6).Width = 15; table1.Columns.ElementAt <DxfTableColumn>(7).Width = 20; table1.Columns.ElementAt <DxfTableColumn>(8).Width = 33; DxfMText drillHoleStadHeight = new DxfMText( @"地" + '\n' + "层" + '\n' + "时" + '\n' + "代", new Point3D(2.5d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"层 底" + '\n' + "厚 度" + '\n' + "(米)", new Point3D(12.5d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 层 " + '\n' + " 厚 " + '\n' + "(米)", new Point3D(24d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"层 底" + '\n' + "标 高" + '\n' + "(米)", new Point3D(33d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 柱 状 剖 面" + '\n' + " (比例尺)" + '\n' + " 1:" + plottingScale, new Point3D(46d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 所 通 过 岩 层 的 描 述" + '\n', new Point3D(66d, -3.5d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"(颗粒成分、状态、 颜色、掺杂物等)", new Point3D(66d, -9d, 0d), 1.5d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"岩芯" + '\n' + "采取率" + '\n' + "(%)", new Point3D(106d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"原 位 测 试", new Point3D(121d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 声 波 曲 线" + '\n' + " (km/s)", new Point3D(141d, -3.5d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"1", new Point3D(3d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"2", new Point3D(14.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"3", new Point3D(25d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"4", new Point3D(37.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"5", new Point3D(52.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"6", new Point3D(85d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"7", new Point3D(109.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"8", new Point3D(127d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"9", new Point3D(153.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); block.Entities.Add(table1); } { //************table2*************tableStyle2************** //set table borderStyle 此处DxfTableStyle括号中的名字,每个table的都不能相同 DxfTableStyle dxfTableStyle2 = new DxfTableStyle("Single2 bordered" + str); dxfTableStyle2.DataCellStyle.SetAllBordersBorderType(BorderType.Single); dxfTableStyle2.DataCellStyle.SetAllBordersColor(Colors.DarkGray); dxfTableStyle2.TitleCellStyle.SetAllBordersBorderType(BorderType.Single); dxfTableStyle2.HeaderCellStyle.SetAllBordersBorderType(BorderType.Single); dxfTableStyle2.HeaderCellStyle.SetAllBordersColor(Colors.DarkGray); //有该行的时候两个表格不能同时生成???***但是没有该行生成的图形文件又不完整 model.TableStyles.Add(dxfTableStyle2); //model.TableStyles.Insert(1,dxfTableStyle2); //定义一个拥有给定格式的表格 DxfTable table2 = new DxfTable(dxfTableStyle2); //表格插入点的位置 table2.InsertionPoint = new Point3D(-2d, 25d, 0d); table2.RowCount = 1; table2.ColumnCount = 1; table2.Rows.ElementAt <DxfTableRow>(0).Height = 305; foreach (DxfTableColumn column in table2.Columns) { column.Width = 176d; } block.Entities.Add(table2); } { //标题下划线 //定义线的长度 // A complex line type. DxfLineType lineType = new DxfLineType("titleLine" + str); model.LineTypes.Add(lineType); DxfLine line = new DxfLine(); line.Start = new Point3D(44d, 10d, 0d); line.End = new Point3D(113d, 10d, 0d); line.LineType = lineType; block.Entities.Add(line); //标题名 DxfMText mText = new DxfMText( @"钻孔柱状剖面图", new Point3D(46d, 18d, 0d), 6d ); block.Entities.Add(mText); } //定义标题栏中的其他部分 { //定义输入钻孔***X***坐标位置 DxfMText mText1 = new DxfMText( @"坐标 X=", new Point3D(135d, 20d, 0d), 2.5d ); block.Entities.Add(mText1); DxfLineType lineType1 = new DxfLineType("applicanceX" + str); model.LineTypes.Add(lineType1); DxfLine lineX = new DxfLine(); lineX.Start = new Point3D(149d, 17.5d, 0d); lineX.End = new Point3D(172d, 17.5d, 0d); lineX.LineType = lineType1; block.Entities.Add(lineX); DxfMText mText11 = new DxfMText( @"" + applicationCoordinateX, new Point3D(151d, 20d, 0d), 2d ); block.Entities.Add(mText11); //定义输入钻孔***Y***坐标位置********一块填写部分开始 DxfMText mText2 = new DxfMText( @"Y=", new Point3D(145d, 10d, 0d), 2.5d ); block.Entities.Add(mText2); DxfLineType lineType2 = new DxfLineType("applicanceY" + str); model.LineTypes.Add(lineType2); DxfLine lineY = new DxfLine(); lineY.Start = new Point3D(149d, 7.5d, 0d); lineY.End = new Point3D(172d, 7.5d, 0d); lineY.LineType = lineType2; block.Entities.Add(lineY); DxfMText mText21 = new DxfMText( @"" + applicationCoordinateY, new Point3D(151d, 10d, 0d), 2d ); block.Entities.Add(mText21); //********************************** 一块填写部分结束********************** } { //原位测试的长线条 DxfLineType drillCodeLineType = new DxfLineType("TestLine1" + str); model.LineTypes.Add(drillCodeLineType); DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(124d, -23d, 0d); drillCodeine.End = new Point3D(124d, -278d, 0d); drillCodeine.Color = EntityColors.Gray; drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); DxfLineType drillCodeLineType1 = new DxfLineType("TestLine2" + str); model.LineTypes.Add(drillCodeLineType1); DxfLine drillCodeine1 = new DxfLine(); drillCodeine1.Start = new Point3D(129d, -23d, 0d); drillCodeine1.End = new Point3D(129d, -278d, 0d); drillCodeine1.Color = EntityColors.Gray; drillCodeine1.LineType = drillCodeLineType1; block.Entities.Add(drillCodeine1); DxfLineType drillCodeLineType2 = new DxfLineType("TestLine3" + str); model.LineTypes.Add(drillCodeLineType2); DxfLine drillCodeine2 = new DxfLine(); drillCodeine2.Start = new Point3D(134d, -23d, 0d); drillCodeine2.End = new Point3D(134d, -278d, 0); drillCodeine2.Color = EntityColors.Gray; drillCodeine2.LineType = drillCodeLineType2; block.Entities.Add(drillCodeine2); } { //声波曲线的长线条 DxfLineType drillCodeLineType = new DxfLineType("TestLine11" + str); model.LineTypes.Add(drillCodeLineType); { //长线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(144d, -23d, 0d); drillCodeine.End = new Point3D(144d, -278d, 0d); drillCodeine.Color = EntityColors.Gray; drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } { DxfMText mtext = new DxfMText( @"2", new Point3D(143.5d, -13.5d, 0d), 2d ); model.Entities.Add(mtext); //长短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(144d, -16d, 0d); drillCodeine.End = new Point3D(144d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } { //短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(141.5d, -17d, 0d); drillCodeine.End = new Point3D(141.5d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } DxfLineType drillCodeLineType1 = new DxfLineType("TestLine12" + str); model.LineTypes.Add(drillCodeLineType1); { DxfLine drillCodeine1 = new DxfLine(); drillCodeine1.Start = new Point3D(149d, -23d, 0d); drillCodeine1.End = new Point3D(149d, -278d, 0d); drillCodeine1.Color = EntityColors.Gray; drillCodeine1.LineType = drillCodeLineType1; block.Entities.Add(drillCodeine1); } { DxfMText mtext = new DxfMText( @"3", new Point3D(148.5d, -13.5d, 0d), 2d ); model.Entities.Add(mtext); //长短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(149d, -16d, 0d); drillCodeine.End = new Point3D(149d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } { //短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(146.5d, -17d, 0d); drillCodeine.End = new Point3D(146.5d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } DxfLineType drillCodeLineType2 = new DxfLineType("TestLine13" + str); model.LineTypes.Add(drillCodeLineType2); { DxfLine drillCodeine2 = new DxfLine(); drillCodeine2.Start = new Point3D(154d, -23d, 0d); drillCodeine2.End = new Point3D(154d, -278d, 0); drillCodeine2.Color = EntityColors.Gray; drillCodeine2.LineType = drillCodeLineType2; block.Entities.Add(drillCodeine2); } { DxfMText mtext = new DxfMText( @"4", new Point3D(153.5d, -13.5d, 0d), 2d ); model.Entities.Add(mtext); //长短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(154d, -16d, 0d); drillCodeine.End = new Point3D(154d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } { //短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(151.5d, -17d, 0d); drillCodeine.End = new Point3D(151.5d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } DxfLineType drillCodeLineType3 = new DxfLineType("TestLine14" + str); model.LineTypes.Add(drillCodeLineType3); { DxfLine drillCodeine3 = new DxfLine(); drillCodeine3.Start = new Point3D(159d, -23d, 0d); drillCodeine3.End = new Point3D(159d, -278d, 0d); drillCodeine3.Color = EntityColors.Gray; drillCodeine3.LineType = drillCodeLineType3; block.Entities.Add(drillCodeine3); } { DxfMText mtext = new DxfMText( @"5", new Point3D(158.5d, -13.5d, 0d), 2d ); model.Entities.Add(mtext); //长短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(159d, -16d, 0d); drillCodeine.End = new Point3D(159d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } { //短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(156.5d, -17d, 0d); drillCodeine.End = new Point3D(156.5d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } DxfLineType drillCodeLineType4 = new DxfLineType("TestLine15" + str); model.LineTypes.Add(drillCodeLineType4); { DxfLine drillCodeine4 = new DxfLine(); drillCodeine4.Start = new Point3D(164d, -23d, 0d); drillCodeine4.End = new Point3D(164d, -278d, 0d); drillCodeine4.Color = EntityColors.Gray; drillCodeine4.LineType = drillCodeLineType4; block.Entities.Add(drillCodeine4); } { DxfMText mtext = new DxfMText( @"6", new Point3D(163.5d, -13.5d, 0d), 2d ); model.Entities.Add(mtext); //长短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(164d, -16d, 0d); drillCodeine.End = new Point3D(164d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } { //短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(161.5d, -17d, 0d); drillCodeine.End = new Point3D(161.5d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } DxfLineType drillCodeLineType5 = new DxfLineType("TestLine16" + str); model.LineTypes.Add(drillCodeLineType5); { DxfLine drillCodeine5 = new DxfLine(); drillCodeine5.Start = new Point3D(169d, -23d, 0d); drillCodeine5.End = new Point3D(169d, -278d, 0); drillCodeine5.Color = EntityColors.Gray; drillCodeine5.LineType = drillCodeLineType5; block.Entities.Add(drillCodeine5); } { DxfMText mtext = new DxfMText( @"7", new Point3D(168.5d, -13.5d, 0d), 2d ); model.Entities.Add(mtext); //长短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(169d, -16d, 0d); drillCodeine.End = new Point3D(169d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } { //短线 DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(166.5d, -17d, 0d); drillCodeine.End = new Point3D(166.5d, -18d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); } } //需要填入表中的其他部分的内容 { //钻孔编号***************************************************************** DxfMText drillCodeText = new DxfMText( @"钻孔编号", new Point3D(0d, 5d, 0d), 2.5d ); block.Entities.Add(drillCodeText); DxfLineType drillCodeLineType = new DxfLineType("zkbhLine" + str); model.LineTypes.Add(drillCodeLineType); DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(15d, 1d, 0d); drillCodeine.End = new Point3D(33d, 1d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); DxfMText drillCodeWriteIn = new DxfMText( @"" + drillCode, new Point3D(17d, 4d, 0d), 2d ); block.Entities.Add(drillCodeWriteIn); //*********************************************************************** //钻孔位置*************************************************************** DxfMText drillLocationText = new DxfMText( @"钻孔位置", new Point3D(35d, 5d, 0d), 2.5d ); block.Entities.Add(drillLocationText); DxfLineType drillLocationLineType = new DxfLineType("drillLocationLine" + str); model.LineTypes.Add(drillLocationLineType); DxfLine drillLocationLine = new DxfLine(); drillLocationLine.Start = new Point3D(52d, 1, 0d); drillLocationLine.End = new Point3D(77d, 1d, 0d); drillLocationLine.LineType = drillLocationLineType; block.Entities.Add(drillLocationLine); DxfMText drillLocationWriteIn = new DxfMText( @"" + drillLocation + drillLocation1 + drillLocation2, new Point3D(54d, 4d, 0d), 2d ); block.Entities.Add(drillLocationWriteIn); //***************************************************************************** //********施钻起止日期********************************************************* DxfMText drillDate = new DxfMText( @"施钻起止日期", new Point3D(79d, 5d, 0d), 2.5d ); block.Entities.Add(drillDate); DxfLineType drillDateLineType = new DxfLineType("drillDateLine" + str); model.LineTypes.Add(drillDateLineType); DxfLine drillDateLine = new DxfLine(); drillDateLine.Start = new Point3D(101, 1d, 0d); drillDateLine.End = new Point3D(133, 1d, 0d); drillDateLine.LineType = drillDateLineType; block.Entities.Add(drillDateLine); DxfMText drillDateWriteIn = new DxfMText( @"" + drillStartTime + "--" + drillEndTime, new Point3D(102d, 4d, 0d), 2d ); block.Entities.Add(drillDateWriteIn); //*********************************************************************** //**********孔口标高***************************************************** DxfMText drillHoleStadHeight = new DxfMText( @"孔口标高", new Point3D(136d, 5d, 0d), 2.5d ); block.Entities.Add(drillHoleStadHeight); DxfLineType drillHoleStadHeightLineType = new DxfLineType("drillHoleStaHeight" + str); model.LineTypes.Add(drillHoleStadHeightLineType); DxfLine drillHoleStadHeightLine = new DxfLine(); drillHoleStadHeightLine.Start = new Point3D(151d, 1d, 0d); drillHoleStadHeightLine.End = new Point3D(172d, 1d, 0d); drillHoleStadHeightLine.LineType = drillHoleStadHeightLineType; block.Entities.Add(drillHoleStadHeightLine); DxfMText drillHoleStadHeightWriteIn = new DxfMText( @"" + drillHoleStadardHeight, new Point3D(152d, 4d, 0d), 2d ); block.Entities.Add(drillHoleStadHeightWriteIn); //********************************************************************************** } addExtension(); //添加扩展线,包括描述信息的添加() AcosticWave aw = new AcosticWave(); //声波数据 aw.getAusticWave(model, block); //文件存储路径 //dxf格式的柱状图 string path = AppDomain.CurrentDomain.BaseDirectory + "Drill\\acosticHistogram\\" + drillCode + ".dxf"; DxfWriter.Write(path, model, true); //获取其他格式的柱状图 ConvertFigureFormat cf = new ConvertFigureFormat(); string filename = drillCode; string outfile = AppDomain.CurrentDomain.BaseDirectory + "Drill\\acosticHistogram\\" + filename; cf.getDXFFormat(model, filename, outfile); }
public void CreateMText(DxfMText text, DrawContext.Wireframe drawContext) { if (text.Text == null || text.Text.Trim() == string.Empty) { return; } Bounds2D collectBounds = new Bounds2D(); IList <Class908> chunks = Class666.smethod_4(text, text.Color.ToColor(), drawContext.GetLineWeight((DxfEntity)text), drawContext.GetTransformer().Matrix, collectBounds); BackgroundFillFlags backgroundFillFlags = text.BackgroundFillFlags; BackgroundFillInfo backgroundFillInfo = text.BackgroundFillInfo; if (backgroundFillFlags == BackgroundFillFlags.UseBackgroundFillColor && backgroundFillInfo != null) { System.Drawing.Color color = (System.Drawing.Color)DxfEntity.GetColor(this.graphicsConfig_0.IndexedColors, backgroundFillInfo.Color, drawContext.ByBlockColor, drawContext.ByBlockDxfColor, text.GetLayer((DrawContext)drawContext)); double num1 = text.Height * (backgroundFillInfo.BorderOffsetFactor - 1.0); double x1 = collectBounds.Center.X; double y1 = collectBounds.Center.Y; double width = text.Width; double y2 = collectBounds.Delta.Y; double num2; double num3; switch (text.AttachmentPoint) { case AttachmentPoint.TopLeft: num2 = collectBounds.Corner1.X + 0.5 * width; num3 = collectBounds.Corner2.Y - 0.5 * y2; break; case AttachmentPoint.TopCenter: num2 = collectBounds.Center.X; num3 = collectBounds.Corner2.Y - 0.5 * y2; break; case AttachmentPoint.TopRight: num2 = collectBounds.Corner2.X - 0.5 * width; num3 = collectBounds.Corner2.Y - 0.5 * y2; break; case AttachmentPoint.MiddleLeft: num2 = collectBounds.Corner1.X + 0.5 * width; num3 = collectBounds.Center.Y; break; case AttachmentPoint.MiddleCenter: num2 = collectBounds.Center.X; num3 = collectBounds.Center.Y; break; case AttachmentPoint.MiddleRight: num2 = collectBounds.Corner2.X - 0.5 * width; num3 = collectBounds.Center.Y; break; case AttachmentPoint.BottomLeft: num2 = collectBounds.Corner1.X + 0.5 * width; num3 = collectBounds.Corner1.Y + 0.5 * y2; break; case AttachmentPoint.BottomCenter: num2 = collectBounds.Center.X; num3 = collectBounds.Corner1.Y + 0.5 * y2; break; case AttachmentPoint.BottomRight: num2 = collectBounds.Corner2.X - 0.5 * width; num3 = collectBounds.Corner1.Y + 0.5 * y2; break; default: num2 = collectBounds.Center.X; num3 = collectBounds.Center.Y; break; } short lineWeight = drawContext.GetLineWeight((DxfEntity)text); Matrix4D matrix4D = drawContext.GetTransformer().Matrix *text.Transform; WW.Math.Point2D point = new WW.Math.Point2D(num2 - 0.5 * width - num1, num3 - 0.5 * y2 - num1); double x2 = width + 2.0 * num1; double y3 = y2 + 2.0 * num1; this.method_4(false, (Interface12) new Class341((ArgbColor)color, (Interface23) new Class535(true, new Vector4D[4] { matrix4D.TransformTo4D(point), matrix4D.TransformTo4D(point + new Vector2D(x2, 0.0)), matrix4D.TransformTo4D(point + new Vector2D(x2, y3)), matrix4D.TransformTo4D(point + new Vector2D(0.0, y3)) }), true, lineWeight)); } this.method_3(chunks, (DxfEntity)text, drawContext); }
//右边扩展线 public static DxfModel getRightExtensionLeader(double textHeight, double startDeep, double endHeight, DxfModel model, string graphicTranslation, string graphicCoreExtration, double extensionLineHeight, double thick, double TtextHeight, double formerExtensionLineHeight) { string str = getRadomData(6); //DxfModel model = new DxfModel(DxfVersion.Dxf14); //先在两条扩展线之间加一条链接的直线 DxfLineType line11Type = new DxfLineType("line1" + endHeight + str); model.LineTypes.Add(line11Type); DxfLine drillHoleStadHeightLine = new DxfLine(); drillHoleStadHeightLine.Start = new Point3D(55, -endHeight - 23, 0d); drillHoleStadHeightLine.End = new Point3D(64, -endHeight - 23, 0d); drillHoleStadHeightLine.LineType = line11Type; model.Entities.Add(drillHoleStadHeightLine); DxfLineType line12Type = new DxfLineType("line2" + endHeight + str); model.LineTypes.Add(line12Type); DxfLine drillHoleStadHeightLine2 = new DxfLine(); drillHoleStadHeightLine2.Start = new Point3D(44, -endHeight - 23, 0d); drillHoleStadHeightLine2.End = new Point3D(53, -endHeight - 23, 0d); drillHoleStadHeightLine2.LineType = line12Type; model.Entities.Add(drillHoleStadHeightLine2); //竖直分线 DxfLineType line13Type = new DxfLineType("verticalLine1" + endHeight + str); model.LineTypes.Add(line13Type); DxfLine drillHoleStadHeightLine3 = new DxfLine(); drillHoleStadHeightLine3.Start = new Point3D(53, -startDeep - 23, 0d); drillHoleStadHeightLine3.End = new Point3D(53, -endHeight - 23, 0d); drillHoleStadHeightLine3.LineType = line13Type; model.Entities.Add(drillHoleStadHeightLine3); DxfLineType line14Type = new DxfLineType("verticalLine2" + endHeight + str); model.LineTypes.Add(line14Type); DxfLine drillHoleStadHeightLine4 = new DxfLine(); drillHoleStadHeightLine4.Start = new Point3D(55, -startDeep - 23, 0d); drillHoleStadHeightLine4.End = new Point3D(55, -endHeight - 23, 0d); drillHoleStadHeightLine4.LineType = line14Type; model.Entities.Add(drillHoleStadHeightLine4); DxfLeader leader = new DxfLeader(model); leader.ArrowHeadEnabled = false; leader.Vertices.AddRange( new Point3D[] { new Point3D(64, -endHeight - 23, 0), new Point3D(66, extensionLineHeight, 0), new Point3D(119, extensionLineHeight, 0) } ); model.Entities.Add(leader); //为直线时候,远大于的时候,可以将描述文字放在花纹的中间 double middleHeight = formerExtensionLineHeight - extensionLineHeight;//上下上下两条扩展线之间的距离 if (((textHeight * 2 + 3) <= middleHeight)) { double lastLine = extensionLineHeight + 1 + middleHeight / 2; // double lastLine = -endHeight - 23 + middleHeight / 2 + textHeight / 2; //地层描述 graphicTranslation = " " + graphicTranslation; graphicTranslation = BreakLongString(graphicTranslation, 28); DxfMText graphicTranslationText = new DxfMText( @"" + graphicTranslation, // - textHeight + textHeight new Point3D(67d, lastLine, 0d), 1.5d ); model.Entities.Add(graphicTranslationText); } else //有多行描述,折线 { //地层描述 graphicTranslation = " " + graphicTranslation; graphicTranslation = BreakLongString(graphicTranslation, 28); DxfMText graphicTranslationText = new DxfMText( @"" + graphicTranslation, // - textHeight + textHeight new Point3D(67d, extensionLineHeight + textHeight + 1, 0d), 1.5d ); model.Entities.Add(graphicTranslationText); } //岩芯采取率 DxfMText graphicCoreExtrationText = new DxfMText( @"" + graphicCoreExtration, new Point3D(106d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicCoreExtrationText); return(model); //DxfWriter.Write("Leader Example.dxf", model, false); }
public void Visit(DxfMText mtext) { this.method_0((DxfEntity)mtext); }
public void Visit(DxfMText mtext) { this.bool_0 = true; }
public Class305(DxfMText text) : base((DxfEntity)text) { }
public Class937(DxfMText text) { this.dxfMText_0 = text; }
public void CreateMText(DxfMText text) { this.class925_0.Add((IWireframeDrawable2) new WireframeGraphics2Cache.Class937(text)); }
public void CreateMText(DxfMText text, DrawContext.Wireframe drawContext) { this.iwireframeGraphicsFactory_0.CreateMText(text, drawContext); }
/// <summary> /// 方法,绘制单个钻孔柱状图 /// </summary> /// <param name="_drawIndex">柱状图编号,从0开始,用于绘制多个柱状图时计算其摆放位置</param> /// <param name="_projectName">工程名称</param> /// <param name="_companyName">公司名称</param> /// <param name="_zk">钻孔数据</param> /// <param name="_scaleList">比例尺列表</param> /// <param name="_style1">钻孔柱状图的文字样式</param> /// <param name="_style2">剖面图钻孔的文字样式</param> public void DrawZk(int _drawIndex, string _projectName, string[] _company, Borehole _zk, List <double> _scaleList, DxfTextStyle _style1, DxfTextStyle _style2) { // 当钻孔内没有分层时退出 if (_zk.Layers.Count == 0) { return; } // 计算图形横向偏移量,用于绘制多个柱状图时的空间摆放距离 double xDis = _drawIndex * 195; // 绘制钻孔柱状图框架 AddRectangle(0 + xDis, 0, 195 + xDis, 280); AddRectangle(10 + xDis, 20, 185 + xDis, 261); Model.Entities[Model.Entities.Count - 1].LineWeight = 30; double[,] pointKJ = new double[25, 4] { { 10, 254, 185, 254 }, { 10, 247, 57, 247 }, { 63, 247, 185, 247 }, { 10, 240, 185, 240 }, { 10, 220, 185, 220 }, { 131.5, 233, 185, 233 }, { 132.5, 225, 150.5, 225 }, { 152.5, 225, 170.5, 225 }, { 172.5, 225, 184, 225 }, { 30, 261, 30, 240 }, { 57, 254, 57, 240 }, { 63, 254, 63, 240 }, { 90, 261, 90, 240 }, { 110, 261, 110, 240 }, { 137, 254, 137, 240 }, { 157, 254, 157, 240 }, { 22, 240, 22, 20 }, { 30, 240, 30, 20 }, { 42, 240, 42, 20 }, { 52, 240, 52, 20 }, { 62, 240, 62, 20 }, { 77, 240, 77, 20 }, { 131.5, 240, 131.5, 20 }, { 151.5, 240, 151.5, 20 }, { 171.5, 240, 171.5, 20 } }; for (int i = 0; i < 25; i++) { AddLine(pointKJ[i, 0] + xDis, pointKJ[i, 1], pointKJ[i, 2] + xDis, pointKJ[i, 3]); } string[] textKJ = new string[31] { "工程名称", "钻孔编号", "孔口高程", "勘察单位", "钻孔深度", "钻孔日期", "初见水位", "稳定水位", "地\n质\n年\n代", "及\n成\n因", "层\n \n序", "层\n底\n标\n高\n(m)", "层\n底\n深\n度\n(m)", "分\n层\n厚\n度\n(m)", "岩 土 描 述", "标贯/动探", "取 样", "注水试验", "击 数", "深 度(m)", "编 号", "深 度(m)", "渗透系数\n(cm/s)", "深度(m)", "钻 孔 柱 状 图", "制图:", "校核:", "审查:", "核定:", "X:", "Y:" }; double[,] ptextKJ = new double[31, 3] { { 20, 257.5, 20 }, { 20, 250.5, 20 }, { 20, 243.5, 20 }, { 100, 257.5, 20 }, { 100, 250.5, 20 }, { 100, 243.5, 20 }, { 147, 250.5, 20 }, { 147, 243.5, 20 }, { 13, 230, 6 }, { 19, 230, 6 }, { 26, 230, 8 }, { 36, 230, 12 }, { 47, 230, 10 }, { 57, 230, 10 }, { 104.25, 230, 54.5 }, { 141.5, 236.5, 20 }, { 161.5, 236.5, 20 }, { 178.25, 236.5, 13.5 }, { 141.5, 229, 20 }, { 141.5, 222.5, 20 }, { 161.5, 229, 20 }, { 161.5, 222.5, 20 }, { 178.25, 229, 13.5 }, { 178.25, 222.5, 13.5 }, { 97.5, 270, 31 }, { 32, 13, 10 }, { 70, 13, 10 }, { 106, 13, 10 }, { 144, 13, 10 }, { 65.5, 252, 5 }, { 65.5, 245, 5 } }; for (int i = 0; i < textKJ.Length; i++) { DxfMText t = AddMText(textKJ[i], ptextKJ[i, 0] + xDis, ptextKJ[i, 1], ptextKJ[i, 2], 2.5, _style1); if (i == 11 || i == 12 || i == 13 || i == 22) { t.LineSpacingFactor = 0.8; } } // 绘制表头信息 AddMText(_projectName, 60 + xDis, 257.5, 60, 2.5, _style1); AddMText(_zk.Name, 43.5 + xDis, 250.5, 27, 2.5, _style1); AddMText(_zk.Altitude.ToString("0.00") + " m", 43.5 + xDis, 243.5, 27, 2.5, _style1); AddMText(_company[0], 147.5 + xDis, 257.5, 75, 2.5, _style1); AddMText(_zk.Layers[_zk.Layers.Count - 1].Depth.ToString("0.00") + " m", 123.5 + xDis, 250.5, 27, 2.5, _style1); // 计算比例尺 double scale; if (_zk.Layers[_zk.Layers.Count - 1].Depth <= 20) { scale = 100; } else if (_zk.Layers[_zk.Layers.Count - 1].Depth <= 40) { scale = 200; } else if (_zk.Layers[_zk.Layers.Count - 1].Depth <= 100) { scale = 500; } else { scale = 1000; } AddMText("柱\n状\n图\n1:" + scale, 69.5 + xDis, 230, 12, 2.5, _style1); // 绘制分层 for (int i = 0; i < _zk.Layers.Count; i++) { // 分层线及深度标签 double drawY = 220 - _zk.Layers[i].Depth / scale * 1000; AddLine(10 + xDis, drawY, 131.5 + xDis, drawY); AddMText(_zk.Layers[i].Number, 26 + xDis, drawY + 3, 8, 2.5, _style1); AddMText((_zk.Altitude - _zk.Layers[i].Depth).ToString("0.00"), 36 + xDis, drawY + 3, 8, 2.5, _style1); AddMText(_zk.Layers[i].Depth.ToString("0.00"), 47 + xDis, drawY + 3, 8, 2.5, _style1); if (i > 0) { AddMText((_zk.Layers[i].Depth - _zk.Layers[i - 1].Depth).ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1); } else { AddMText(_zk.Layers[i].Depth.ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1); } // 地质填充 double hatchY1 = drawY; double hatchY2; if (i > 0) { hatchY2 = 220 - _zk.Layers[i - 1].Depth / scale * 1000; } else { hatchY2 = 220; } try { string s = _zk.Layers[i].Name; if (s.Contains("黏")) { s = s.Replace("黏", "粘"); } AddRecHatch(HatchTrans(s), 62 + xDis, hatchY1, 77 + xDis, hatchY2); } catch { AddRecHatch("SOLID", 62 + xDis, hatchY1, 77 + xDis, hatchY2); } // 岩土描述 double presY = hatchY2 - 0.7; DxfMText t = AddMText(_zk.Layers[i].Name + ":" + _zk.Layers[i].Description, 78 + xDis, presY, 54.5, 1.5, _style1); t.AttachmentPoint = AttachmentPoint.TopLeft; } // 绘制标贯/动探 for (int i = 0; i < _zk.NTests.Count; i++) { double drawY = 220 - _zk.NTests[i].Depth / scale * 1000; AddLine(131.5 + xDis, drawY, 151.5 + xDis, drawY); AddMText(_zk.NTests[i].Value.ToString("0"), 141.5 + xDis, drawY + 2, 20, 2.5, _style1); AddMText(_zk.NTests[i].Depth.ToString("0.00"), 141.5 + xDis, drawY - 2, 20, 2.5, _style1); } // 绘制取样 for (int i = 0; i < _zk.Samples.Count; i++) { double drawY = 220 - _zk.Samples[i].Depth * 1000 / scale; AddLine(151.5 + xDis, drawY, 171.5 + xDis, drawY); AddMText(_zk.Samples[i].Name, 161.5 + xDis, drawY + 2, 20, 2.5, _style1); AddMText(_zk.Samples[i].Depth.ToString("0.00"), 161.5 + xDis, drawY - 2, 20, 2.5, _style1); } // 绘制人员信息 AddMText(_company[2], 44 + xDis, 13, 10, 2.5, _style1); AddMText(_company[4], 82 + xDis, 13, 10, 2.5, _style1); AddMText(_company[5], 118 + xDis, 13, 10, 2.5, _style1); AddMText(_company[6], 156 + xDis, 13, 10, 2.5, _style1); // 绘制剖面图钻孔 double distanceY = 280; for (int i = 0; i < _scaleList.Count; i++) { // 计算绘图起始位置 distanceY = distanceY + 40 + _zk.Layers[_zk.Layers.Count - 1].Depth * 1000 / _scaleList[i]; // 绘制钻孔编号、孔口高程、钻孔轴线 AddLine(124 + xDis, distanceY + 10, 136 + xDis, distanceY + 10); AddMText(_zk.Name, 130 + xDis, distanceY + 13.5, 12, 4, _style2); AddMText(_zk.Altitude.ToString("0.00"), 130 + xDis, distanceY + 7, 12, 4, _style2); DxfPolyline2D l = AddLine(130 + xDis, distanceY, 130 + xDis, distanceY - _zk.Layers[_zk.Layers.Count - 1].Depth * 1000 / _scaleList[i]); l.LineWeight = 50; // 绘制分层 for (int j = 0; j < _zk.Layers.Count; j++) { double layerY = distanceY - _zk.Layers[j].Depth * 1000 / _scaleList[i]; double layerYold = distanceY; if (j > 0) { layerYold = distanceY - _zk.Layers[j - 1].Depth * 1000 / _scaleList[i]; } if (j < _zk.Layers.Count - 1) { AddLine(120 + xDis, layerY, 130 + xDis, layerY); } DxfMText text = AddMText(_zk.Layers[j].Depth.ToString("0.00") + "(" + (_zk.Altitude - _zk.Layers[j].Depth).ToString("0.00") + ")", 132 + xDis, layerY, 25, 3, _style2); text.AttachmentPoint = AttachmentPoint.MiddleLeft; try { string s = _zk.Layers[j].Name; if (s.Contains("黏")) { s = s.Replace("黏", "粘"); } AddRecHatch(HatchTrans(s), 120 + xDis, layerY, 130 + xDis, layerYold); } catch { AddRecHatch("SOLID", 120 + xDis, layerY, 130 + xDis, layerYold); } } // 绘制取样 for (int j = 0; j < _zk.Samples.Count; j++) { double sampleY = distanceY - _zk.Samples[j].Depth * 1000 / _scaleList[i]; if (_zk.Samples[j].IsDisturbed) { AddCircle(127.5 + xDis, sampleY, 1, false); } else { AddCircle(127.5 + xDis, sampleY, 1, true); } } // 绘制标贯/动探 for (int j = 0; j < _zk.NTests.Count; j++) { double bgY = distanceY - _zk.NTests[j].Depth * 1000 / _scaleList[i]; DxfMText text = AddMText(_zk.NTests[j].Type.ToString() + "=" + _zk.NTests[j].Value, 120.5 + xDis, bgY, 6, 2.5, _style2); text.AttachmentPoint = AttachmentPoint.MiddleLeft; } // 绘制比例尺标记 double scY = distanceY - _zk.Layers[_zk.Layers.Count - 1].Depth * 1000 / _scaleList[i] / 2; DxfMText t = AddMText("1:" + _scaleList[i], 20 + xDis, scY, 80, 20, _style2); t.AttachmentPoint = AttachmentPoint.MiddleLeft; } }
/// <summary> /// 方法,绘制单个静力触探曲线图 /// </summary> /// <param name="_drawIndex">曲线图编号,从0开始,用于绘制多个曲线图时计算其摆放位置</param> /// <param name="_projectName">工程名称</param> /// <param name="_companyName">公司名称</param> /// <param name="_jk">触探孔数据</param> /// <param name="_scaleList">比例尺列表</param> /// <param name="_style1">曲线图的文字样式</param> /// <param name="_style2">剖面图触探孔的文字样式</param> public void DrawJk(int _drawIndex, string _projectName, string[] _company, CPT _jk, List <double> _scaleList, DxfTextStyle _style1, DxfTextStyle _style2) { // 当触探孔内没有分层时退出 if (_jk.Layers.Count == 0) { return; } // 计算图形横向偏移量,用于绘制多个柱状图时的空间摆放距离 double xDis = _drawIndex * 195; // 绘制钻孔柱状图框架 AddRectangle(0 + xDis, 0, 195 + xDis, 280); AddRectangle(10 + xDis, 20, 185 + xDis, 261); Model.Entities[Model.Entities.Count - 1].LineWeight = 30; double[,] pointKJ = new double[28, 4] { { 10, 254, 185, 254 }, { 10, 247, 57, 247 }, { 63, 247, 185, 247 }, { 10, 240, 185, 240 }, { 10, 220, 185, 220 }, { 30, 261, 30, 240 }, { 57, 254, 57, 240 }, { 63, 254, 63, 240 }, { 90, 261, 90, 240 }, { 110, 261, 110, 240 }, { 137, 254, 137, 240 }, { 157, 254, 157, 240 }, { 22, 240, 22, 20 }, { 30, 240, 30, 20 }, { 42, 240, 42, 20 }, { 52, 240, 52, 20 }, { 62, 240, 62, 20 }, { 77, 240, 77, 20 }, { 87, 220, 87, 222 }, { 97, 220, 97, 222 }, { 107, 220, 107, 222 }, { 117, 220, 117, 222 }, { 127, 220, 127, 222 }, { 137, 220, 137, 222 }, { 147, 220, 147, 222 }, { 157, 220, 157, 222 }, { 167, 220, 167, 222 }, { 177, 220, 177, 222 } }; for (int i = 0; i < 28; i++) { AddLine(pointKJ[i, 0] + xDis, pointKJ[i, 1], pointKJ[i, 2] + xDis, pointKJ[i, 3]); } string[] textKJ = new string[32] { "工程名称", "钻孔编号", "孔口高程", "勘察单位", "钻孔深度", "钻孔日期", "初见水位", "稳定水位", "地\n质\n年\n代", "及\n成\n因", "层\n \n序", "层\n底\n标\n高\n(m)", "层\n底\n深\n度\n(m)", "分\n层\n厚\n度\n(m)", "比 贯 入 阻 力 (MPa)", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "静 力 触 探 曲 线 图", "制图:", "校核:", "审查:", "核定:", "X:", "Y:" }; double[,] ptextKJ = new double[32, 3] { { 20, 257.5, 20 }, { 20, 250.5, 20 }, { 20, 243.5, 20 }, { 100, 257.5, 20 }, { 100, 250.5, 20 }, { 100, 243.5, 20 }, { 147, 250.5, 20 }, { 147, 243.5, 20 }, { 13, 230, 6 }, { 19, 230, 6 }, { 26, 230, 8 }, { 36, 230, 12 }, { 47, 230, 10 }, { 57, 230, 10 }, { 131, 234.5, 108 }, { 87, 227, 2 }, { 97, 227, 2 }, { 107, 227, 2 }, { 117, 227, 2 }, { 127, 227, 2 }, { 137, 227, 2 }, { 147, 227, 2 }, { 157, 227, 2 }, { 167, 227, 2 }, { 177, 227, 2 }, { 97.5, 270, 175 }, { 32, 13, 10 }, { 70, 13, 10 }, { 106, 13, 10 }, { 144, 13, 10 }, { 65.5, 252, 5 }, { 65.5, 245, 5 } }; for (int i = 0; i < textKJ.Length; i++) { DxfMText t = AddMText(textKJ[i], ptextKJ[i, 0] + xDis, ptextKJ[i, 1], ptextKJ[i, 2], 2.5, _style1); if (i == 11 || i == 12 || i == 13) { t.LineSpacingFactor = 0.8; } } // 绘制表头信息 AddMText(_projectName, 60 + xDis, 257.5, 60, 2.5, _style1); AddMText(_jk.Name, 43.5 + xDis, 250.5, 27, 2.5, _style1); AddMText(_jk.Altitude.ToString("0.00") + " m", 43.5 + xDis, 243.5, 27, 2.5, _style1); AddMText(_company[0], 147.5 + xDis, 257.5, 75, 2.5, _style1); AddMText(_jk.Layers[_jk.Layers.Count - 1].Depth.ToString("0.00") + " m", 123.5 + xDis, 250.5, 27, 2.5, _style1); // 计算比例尺 double scale; if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 20) { scale = 100; } else if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 40) { scale = 200; } else if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 100) { scale = 500; } else { scale = 1000; } AddMText("柱\n状\n图\n1:" + scale, 69.5 + xDis, 230, 12, 2.5, _style1); // 绘制分层 for (int i = 0; i < _jk.Layers.Count; i++) { // 分层线及深度标签 double drawY = 220 - _jk.Layers[i].Depth / scale * 1000; AddLine(10 + xDis, drawY, 77 + xDis, drawY); AddMText(_jk.Layers[i].Number, 26 + xDis, drawY + 3, 8, 2.5, _style1); AddMText((_jk.Altitude - _jk.Layers[i].Depth).ToString("0.00"), 36 + xDis, drawY + 3, 8, 2.5, _style1); AddMText(_jk.Layers[i].Depth.ToString("0.00"), 47 + xDis, drawY + 3, 8, 2.5, _style1); if (i > 0) { AddMText((_jk.Layers[i].Depth - _jk.Layers[i - 1].Depth).ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1); } else { AddMText(_jk.Layers[i].Depth.ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1); } // 地质填充 double hatchY1 = drawY; double hatchY2; if (i > 0) { hatchY2 = 220 - _jk.Layers[i - 1].Depth / scale * 1000; } else { hatchY2 = 220; } try { string s = _jk.Layers[i].Name; if (s.Contains("黏")) { s = s.Replace("黏", "粘"); } AddRecHatch(HatchTrans(s), 62 + xDis, hatchY1, 77 + xDis, hatchY2); } catch { AddRecHatch("SOLID", 62 + xDis, hatchY1, 77 + xDis, hatchY2); } } // 绘制Ps曲线 int n1 = _jk.PsList.Count; DxfVertex2D[] pointList = new DxfVertex2D[n1]; for (int i = 0; i < n1; i++) { double drawY = 220 - Convert.ToDouble(i) / scale * 100; double drawX = 77 + _jk.PsList[i] * 10 + xDis; pointList[i] = new DxfVertex2D(drawX, drawY); } AddPline(pointList); // 绘制人员信息 AddMText(_company[2], 44 + xDis, 13, 10, 2.5, _style1); AddMText(_company[4], 82 + xDis, 13, 10, 2.5, _style1); AddMText(_company[5], 118 + xDis, 13, 10, 2.5, _style1); AddMText(_company[6], 156 + xDis, 13, 10, 2.5, _style1); // 绘制剖面静力触探曲线图 double distanceY = 280; for (int i = 0; i < _scaleList.Count; i++) { // 计算绘图起始位置 distanceY = distanceY + 40 + _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i]; // 绘制钻孔编号、孔口高程、钻孔轴线 AddLine(124 + xDis, distanceY + 10, 136 + xDis, distanceY + 10); AddMText(_jk.Name, 130 + xDis, distanceY + 13.5, 12, 4, _style2); AddMText(_jk.Altitude.ToString("0.00"), 130 + xDis, distanceY + 7, 12, 4, _style2); DxfPolyline2D l = AddLine(130 + xDis, distanceY, 130 + xDis, distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i]); l.LineWeight = 50; // 绘制分层 for (int j = 0; j < _jk.Layers.Count; j++) { double layerY = distanceY - _jk.Layers[j].Depth * 1000 / _scaleList[i]; double layerYold = distanceY; if (j > 0) { layerYold = distanceY - _jk.Layers[j - 1].Depth * 1000 / _scaleList[i]; } if (j < _jk.Layers.Count - 1) { AddLine(123 + xDis, layerY, 130 + xDis, layerY); } DxfMText text = AddMText(_jk.Layers[j].Depth.ToString("0.00") + "(" + (_jk.Altitude - _jk.Layers[j].Depth).ToString("0.00") + ")", 121 + xDis, layerY + 1.5, 33, 3, _style2); text.AttachmentPoint = AttachmentPoint.MiddleLeft; try { string s = _jk.Layers[j].Name; if (s.Contains("黏")) { s = s.Replace("黏", "粘"); } AddRecHatch(HatchTrans(s), 123 + xDis, layerY, 130 + xDis, layerYold); } catch { AddRecHatch("SOLID", 123 + xDis, layerY, 130 + xDis, layerYold); } } // 绘制Ps值曲线 int n2 = _jk.PsList.Count; DxfVertex2D[] pointList2 = new DxfVertex2D[n2]; for (int j = 0; j < n2; j++) { double drawY = distanceY - Convert.ToDouble(j) / _scaleList[i] * 100; double drawX = 130 + _jk.PsList[j] * 10 + xDis; pointList2[j] = new DxfVertex2D(drawX, drawY); } AddPline(pointList2); // 绘制Ps刻度 double kdY = distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i] - 15; AddLine(130 + xDis, kdY, 180 + xDis, kdY); AddLine(130 + xDis, kdY, 130 + xDis, kdY + 8); for (int j = 1; j <= 5; j++) { AddLine(130 + 10 * j + xDis, kdY, 130 + 10 * j + xDis, kdY + 2); AddMText(j.ToString(), 130 + 10 * j + xDis, kdY + 7, 2, 3, _style2); } // 绘制比例尺标记 double scY = distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i] / 2; DxfMText t = AddMText("1:" + _scaleList[i], 20 + xDis, scY, 80, 20, _style2); t.AttachmentPoint = AttachmentPoint.MiddleLeft; } }
public void CreateMText(DxfMText text) { throw new NotImplementedException(); }
static void FindEntities(DxfEntityCollection Entities) { foreach (var entityGroups in Entities) { if (typeof(DxfLine) != entityGroups.GetType() && typeof(DxfLwPolyline) != entityGroups.GetType() && typeof(DxfMText) != entityGroups.GetType() && typeof(DxfText) != entityGroups.GetType() && typeof(DxfCircle) != entityGroups.GetType() && typeof(DxfHatch) != entityGroups.GetType() && typeof(DxfInsert) != entityGroups.GetType() && typeof(DxfSpline) != entityGroups.GetType()) { // Console.WriteLine(entityGroups.GetType()); } dxfType.Add(entityGroups.GetType().Name); if (typeof(DxfLine) == entityGroups.GetType()) { dxfLine = entityGroups as DxfLine; int color; if (dxfLine.Color.ColorType.ToString() == "ByLayer") { color = dxfLine.Layer.Color.Rgb; } else { color = dxfLine.Color.Rgb; } CADLine cADLine = new CADLine { parentHandle = dxfLine.OwnerObjectSoftReference.Handle, type = dxfLine.GetType().Name, color = color, transform = dxfLine.Transform.DebugString, startPoint = dxfLine.Start.ToString(), endPoint = dxfLine.End.ToString(), lineWeight = dxfLine.LineWeight }; cadEntities.Add(cADLine); } if (typeof(DxfLwPolyline) == entityGroups.GetType()) { //Console.WriteLine(dxfLwPolyline); dxfLwPolyline = entityGroups as DxfLwPolyline; string[] arrVertices = new string[dxfLwPolyline.Vertices.Count]; for (int i = 0; i < dxfLwPolyline.Vertices.Count; i++) { arrVertices[i] = dxfLwPolyline.Vertices[i].ToString(); } int color; if (dxfLwPolyline.Color.ColorType.ToString() == "ByLayer") { color = dxfLwPolyline.Layer.Color.Rgb; } else { color = dxfLwPolyline.Color.Rgb; } CADLwPolyLine cADLwPolyLine = new CADLwPolyLine { parentHandle = dxfLwPolyline.OwnerObjectSoftReference.Handle, type = dxfLwPolyline.GetType().Name, color = color, transform = dxfLwPolyline.Transform.DebugString, vertices = arrVertices, closed = dxfLwPolyline.Closed.ToString(), }; cadEntities.Add(cADLwPolyLine); } if (typeof(DxfXLine) == entityGroups.GetType()) { dxfXLine = entityGroups as DxfXLine; } if (typeof(DxfSpline) == entityGroups.GetType()) { dxfSpline = entityGroups as DxfSpline; string[] arrFitPoints = new string[dxfSpline.FitPoints.Count]; for (int i = 0; i < dxfSpline.FitPoints.Count; i++) { arrFitPoints[i] = dxfSpline.FitPoints[i].ToString(); } int color; if (dxfSpline.Color.ColorType.ToString() == "ByLayer") { color = dxfSpline.Layer.Color.Rgb; } else { color = dxfSpline.Color.Rgb; } CADSpline cADSpline = new CADSpline { parentHandle = dxfSpline.OwnerObjectSoftReference.Handle, type = dxfSpline.GetType().Name, color = color, transform = dxfSpline.Transform.DebugString, fitPoints = arrFitPoints, }; cadEntities.Add(cADSpline); } if (typeof(DxfCircle) == entityGroups.GetType()) { dxfCircle = entityGroups as DxfCircle; int color; if (dxfCircle.Color.ColorType.ToString() == "ByLayer") { color = dxfCircle.Layer.Color.Rgb; } else { color = dxfCircle.Color.Rgb; } CADCircle cADCircle = new CADCircle { parentHandle = dxfCircle.OwnerObjectSoftReference.Handle, type = dxfCircle.GetType().Name, color = color, transform = dxfCircle.Transform.DebugString, center = dxfCircle.Center.ToString(), radius = dxfCircle.Radius }; cadEntities.Add(cADCircle); kcircle.Add(dxfCircle); } if (typeof(DxfArc) == entityGroups.GetType()) { dxfArc = entityGroups as DxfArc; int color; if (dxfArc.Color.ColorType.ToString() == "ByLayer") { color = dxfArc.Layer.Color.Rgb; } else { color = dxfArc.Color.Rgb; } CADArc cADArc = new CADArc { parentHandle = dxfArc.OwnerObjectSoftReference.Handle, type = dxfArc.GetType().Name, color = color, transform = dxfArc.Transform.DebugString, center = dxfArc.Center.ToString(), startAngle = dxfArc.StartAngle, endAngle = dxfArc.EndAngle, radius = dxfArc.Radius }; cadEntities.Add(cADArc); } if (typeof(DxfEllipse) == entityGroups.GetType()) { dxfEllipse = entityGroups as DxfEllipse; int color; if (dxfEllipse.Color.ColorType.ToString() == "ByLayer") { color = dxfEllipse.Layer.Color.Rgb; } else { color = dxfEllipse.Color.Rgb; } CADEllipse cADEllipse = new CADEllipse { parentHandle = dxfEllipse.OwnerObjectSoftReference.Handle, type = dxfEllipse.GetType().Name, color = color, transform = dxfEllipse.Transform.DebugString, center = dxfEllipse.Center.ToString(), majorAxisEndPoint = dxfEllipse.MajorAxisEndPoint.ToString(), minorAxisEndPoint = dxfEllipse.MinorAxisEndPoint.ToString(), startParameter = dxfEllipse.StartParameter, endParameter = dxfEllipse.EndParameter }; cadEntities.Add(cADEllipse); } if (typeof(DxfMText) == entityGroups.GetType()) { dxfMText = entityGroups as DxfMText; int color; if (dxfMText.Color.ColorType.ToString() == "ByLayer") { color = dxfMText.Layer.Color.Rgb; } else { color = dxfMText.Color.Rgb; } if (dxfMText.SimplifiedText == "C座一层平面图") { ktls.Add(dxfMText); } CADMText cADMText = new CADMText { parentHandle = dxfMText.OwnerObjectSoftReference.Handle, type = dxfMText.GetType().Name, color = color, transform = dxfMText.Transform.DebugString, simplifiedText = dxfMText.SimplifiedText.ToString(), fontStyle = dxfMText.Style.ToString(), size = dxfMText.Height, attachmentPoint = dxfMText.AttachmentPoint.ToString(), boxHeight = dxfMText.BoxHeight, boxWidth = dxfMText.BoxWidth }; cadEntities.Add(cADMText); if (dxfMText.SimplifiedText.ToString() == "图 纸 目 录") { //Console.WriteLine(222222); ktls.Add(dxfMText); } if (dxfMText.SimplifiedText.ToString() == "JS-T5-302") { //Console.WriteLine(222222); ktls.Add(dxfMText); } } if (typeof(DxfText) == entityGroups.GetType()) { dxfText = entityGroups as DxfText; int color; if (dxfText.Color.ColorType.ToString() == "ByLayer") { color = dxfText.Layer.Color.Rgb; } else { color = dxfText.Color.Rgb; } CADText cADText = new CADText { parentHandle = dxfText.OwnerObjectSoftReference.Handle, type = dxfText.GetType().Name, color = color, transform = dxfText.Transform.DebugString, simplifiedText = dxfText.SimplifiedText.ToString(), fontStyle = dxfText.Style.ToString(), size = dxfText.Height, alignMentPoint1 = dxfText.AlignmentPoint1.ToString(), rotationAngle = dxfText.Rotation, }; if (dxfText.SimplifiedText == "JS-T5-001 ") { ktest.Add(dxfText); } cadEntities.Add(cADText); } if (typeof(DxfInsert) == entityGroups.GetType()) { dxfInsert = entityGroups as DxfInsert; kins.Add(dxfInsert); if (dxfInsert.Block != null) { ulong count; if (dxfInsert.Block != null) { count = dxfInsert.Block.Handle; } else { count = 0; } CADInsert cADInsert = new CADInsert(); cADInsert.parentHandle = dxfInsert.OwnerObjectSoftReference.Handle; cADInsert.type = dxfInsert.GetType().Name; cADInsert.transform = dxfInsert.Transform.DebugString; cADInsert.insertPoint = dxfInsert.InsertionPoint.ToString(); cADInsert.rotationAngle = dxfInsert.Rotation; cADInsert.insertName = dxfInsert.Block.Name; cADInsert.nowHandle = count; cADInsert.insertScale = dxfInsert.ScaleFactor.ToString(); cadEntities.Add(cADInsert); FindEntities(dxfInsert.Block.Entities); } } if (typeof(DxfAttributeDefinition) == entityGroups.GetType()) { dxfAttributeDefinition = entityGroups as DxfAttributeDefinition; //Console.WriteLine(dxfAttributeDefinition); } if (typeof(DxfDimension.Linear) == entityGroups.GetType()) { Console.WriteLine(11111); } } }
//左边扩展线,需要判断地质时代这一行 /*string graphicCode;//地层编号 0 * string graphicMark;//地层代号 1,,为表格中的地层时代 * double graphicStartDeep;//开始深度 2 * double graphicEndDeep;//结束深度 3 * double graphicThick;//层厚 4 * double graphicButtomHeight;//层底标高 5 * string graphicTranslation;//地层描述 6 * string graphicCoreExtration;//岩芯采取率 12 * string graphicRemark;//备注 15*/ public double getLeftExtensionLeader(DxfModel model, string graphicMark, double graphicStartDeep, double graphicEndDeep, double graphicThick, double graphicButtomHeight, string graphicTranslation, string graphicCoreExtration, double formerExtensionLineHeight) { //theFormer是前一个花纹的描述高度,用来确定下一个花纹地层描述扩展线的位置 //DxfModel model = new DxfModel(DxfVersion.Dxf14); DxfLeader leader = new DxfLeader(model); leader.ArrowHeadEnabled = false; //计算地层表述字体的高度 double textHeight = calculateHeight(graphicTranslation); //用来确定扩展线的开始深度和结束深度比例换算后的值 double startDeep = calculateDataValue(graphicStartDeep); double endDeep = calculateDataValue(graphicEndDeep); double thick = calculateDataValue(graphicThick);//深度与字体高度的比较值,用来确定延长线的高度 int jugleData; double extensionLineHeight = 0; //扩展线高 double TtextHeight = formerExtensionLineHeight - 1.5; //填入表格文字高度的位置 switch (jugleData = jugleExtesionLineLocation(textHeight, thick, formerExtensionLineHeight, endDeep, startDeep, graphicTranslation)) { case 1: //折线 extensionLineHeight = formerExtensionLineHeight - textHeight - 3; //-1是字体与线之间的距离 break; case 2: //直线 extensionLineHeight = -endDeep - 23; break; case 3: extensionLineHeight = 2 + textHeight; //花纹高度高于字体高度 break; } if (graphicMark == "") { leader.Vertices.AddRange( new Point3D[] { new Point3D(9, extensionLineHeight, 0), new Point3D(42, extensionLineHeight, 0), new Point3D(44, -endDeep - 23, 0) } ); //层底深度 DxfMText graphicEndDeepText = new DxfMText( @"" + graphicEndDeep, new Point3D(11d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicEndDeepText); //层厚 DxfMText graphicThickText = new DxfMText( @"" + graphicThick, new Point3D(24d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicThickText); //层底标高 DxfMText graphicButtomHeightText = new DxfMText( @"" + graphicButtomHeight, new Point3D(33d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicButtomHeightText); } else { leader.Vertices.AddRange( new Point3D[] { new Point3D(0, extensionLineHeight, 0), new Point3D(42, extensionLineHeight, 0), new Point3D(44, -endDeep - 23, 0) } ); //地层代号 DxfMText graphicMarkText = new DxfMText( @"" + graphicMark, new Point3D(1d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicMarkText); //层底深度 DxfMText graphicEndDeepText = new DxfMText( @"" + graphicEndDeep, new Point3D(11d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicEndDeepText); //层厚 DxfMText graphicThickText = new DxfMText( @"" + graphicThick, new Point3D(24d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicThickText); //层底标高 DxfMText graphicButtomHeightText = new DxfMText( @"" + graphicButtomHeight, new Point3D(33d, extensionLineHeight + 2, 0d), 1.5d ); model.Entities.Add(graphicButtomHeightText); } getRightExtensionLeader(textHeight, startDeep, endDeep, model, graphicTranslation, graphicCoreExtration, extensionLineHeight, thick, TtextHeight, formerExtensionLineHeight); model.Entities.Add(leader); double forNext = extensionLineHeight; return(forNext);//返回上一条扩展线的最低位置 }
/// <summary> /// 创建一张表格的方法 /// </summary> public void createOneTable() { string str = getRadomData(6); model = new DxfModel(); //创建一个图层 DxfLayer layerTable = new DxfLayer("" + str + programName); model.Layers.Add(layerTable); //创建一个块 block = new DxfBlock("AcosticBoreHoleTable_Block" + str); model.Blocks.Add(block); DxfInsert insert = new DxfInsert(block, new Point3D(0, 0, 0)); insert.Layer = layerTable; model.Entities.Add(insert); { DxfTableStyle tableStyle1 = new DxfTableStyle("Single1 bordered" + str); tableStyle1.DataCellStyle.SetAllBordersBorderType(BorderType.Single); //tableStyle1.DataCellStyle.SetAllBordersColor(Colors.DarkGray); tableStyle1.TitleCellStyle.SetAllBordersBorderType(BorderType.Single); tableStyle1.HeaderCellStyle.SetAllBordersBorderType(BorderType.Single); //tableStyle1.HeaderCellStyle.ContentColor = Colors.DarkGray; model.TableStyles.Add(tableStyle1); DxfTable table1 = new DxfTable(tableStyle1); //表格插入点的位置 table1.InsertionPoint = new Point3D(0d, 0d, 0d); //设置表格的行数和列数 //各行高 table1.RowCount = 3; table1.ColumnCount = 10; table1.Rows.ElementAt <DxfTableRow>(0).Height = 18d; table1.Rows.ElementAt <DxfTableRow>(1).Height = 5d; table1.Rows.ElementAt <DxfTableRow>(2).Height = 255; //设置柱状图各列宽 table1.Columns.ElementAt <DxfTableColumn>(0).Width = 9; table1.Columns.ElementAt <DxfTableColumn>(1).Width = 13; table1.Columns.ElementAt <DxfTableColumn>(2).Width = 9; table1.Columns.ElementAt <DxfTableColumn>(3).Width = 13; table1.Columns.ElementAt <DxfTableColumn>(4).Width = 20; table1.Columns.ElementAt <DxfTableColumn>(5).Width = 40; table1.Columns.ElementAt <DxfTableColumn>(6).Width = 15; table1.Columns.ElementAt <DxfTableColumn>(7).Width = 20; table1.Columns.ElementAt <DxfTableColumn>(8).Width = 17; table1.Columns.ElementAt <DxfTableColumn>(9).Width = 16; DxfMText drillHoleStadHeight = new DxfMText( @"地" + '\n' + "层" + '\n' + "时" + '\n' + "代", new Point3D(2.5d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"层 底" + '\n' + "厚 度" + '\n' + "(米)", new Point3D(12.5d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 层 " + '\n' + " 厚 " + '\n' + "(米)", new Point3D(24d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"层 底" + '\n' + "标 高" + '\n' + "(米)", new Point3D(33d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 柱 状 剖 面" + '\n' + " (比例尺)" + '\n' + " 1:" + plottingScale, new Point3D(46d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 所 通 过 岩 层 的 描 述" + '\n', new Point3D(66d, -3.5d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"(颗粒成分、状态、 颜色、掺杂物等)", new Point3D(66d, -9d, 0d), 1.5d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 岩芯" + '\n' + "采取率" + '\n' + "(%)", new Point3D(106d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"原 位 测 试", new Point3D(121d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 采 " + '\n' + " 样 " + '\n' + "(米)", new Point3D(141d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @" 备 " + '\n' + '\n' + " 注 ", new Point3D(158d, -2d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); //列头的序号 drillHoleStadHeight = new DxfMText( @"1", new Point3D(3d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"2", new Point3D(14.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"3", new Point3D(25d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"4", new Point3D(37.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"5", new Point3D(52.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"6", new Point3D(85d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"7", new Point3D(109.5d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"8", new Point3D(127d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"9", new Point3D(148d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); drillHoleStadHeight = new DxfMText( @"10", new Point3D(165d, -19d, 0d), 2d ); block.Entities.Add(drillHoleStadHeight); block.Entities.Add(table1); } { //************table2*************tableStyle2************** //图头部分 DxfTableStyle dxfTableStyle2 = new DxfTableStyle("Single2 bordered" + str); dxfTableStyle2.DataCellStyle.SetAllBordersBorderType(BorderType.Single); dxfTableStyle2.DataCellStyle.SetAllBordersColor(Colors.DarkGray); dxfTableStyle2.TitleCellStyle.SetAllBordersBorderType(BorderType.Single); dxfTableStyle2.HeaderCellStyle.SetAllBordersBorderType(BorderType.Single); dxfTableStyle2.HeaderCellStyle.SetAllBordersColor(Colors.DarkGray); //有该行的时候两个表格不能同时生成???***但是没有该行生成的图形文件又不完整 model.TableStyles.Add(dxfTableStyle2); //定义一个拥有给定格式的表格 DxfTable table2 = new DxfTable(dxfTableStyle2); //表格插入点的位置 table2.InsertionPoint = new Point3D(-2d, 25d, 0d); table2.RowCount = 1; table2.ColumnCount = 1; table2.Rows.ElementAt <DxfTableRow>(0).Height = 305; foreach (DxfTableColumn column in table2.Columns) { column.Width = 176d; } block.Entities.Add(table2); } { //标题下划线 //定义线的长度 // A complex line type. DxfLineType lineType = new DxfLineType("titleLine" + str); model.LineTypes.Add(lineType); DxfLine line = new DxfLine(); line.Start = new Point3D(44d, 10d, 0d); line.End = new Point3D(113d, 10d, 0d); line.LineType = lineType; block.Entities.Add(line); //标题名 DxfMText mText = new DxfMText( @"钻孔柱状剖面图", new Point3D(46d, 18d, 0d), 6d ); block.Entities.Add(mText); } //定义标题栏中的其他部分 { //定义输入钻孔***X***坐标位置 DxfMText mText1 = new DxfMText( @"坐标 X=", new Point3D(135d, 20d, 0d), 2.5d ); block.Entities.Add(mText1); DxfLineType lineType1 = new DxfLineType("applicanceX" + str); model.LineTypes.Add(lineType1); DxfLine lineX = new DxfLine(); lineX.Start = new Point3D(149d, 17.5d, 0d); lineX.End = new Point3D(172d, 17.5d, 0d); lineX.LineType = lineType1; block.Entities.Add(lineX); DxfMText mText11 = new DxfMText( @"" + applicationCoordinateX, new Point3D(151d, 20d, 0d), 2d ); block.Entities.Add(mText11); //定义输入钻孔***Y***坐标位置********一块填写部分开始 DxfMText mText2 = new DxfMText( @"Y=", new Point3D(145d, 10d, 0d), 2.5d ); block.Entities.Add(mText2); DxfLineType lineType2 = new DxfLineType("applicanceY" + str); model.LineTypes.Add(lineType2); DxfLine lineY = new DxfLine(); lineY.Start = new Point3D(149d, 7.5d, 0d); lineY.End = new Point3D(172d, 7.5d, 0d); lineY.LineType = lineType2; block.Entities.Add(lineY); DxfMText mText21 = new DxfMText( @"" + applicationCoordinateY, new Point3D(151d, 10d, 0d), 2d ); block.Entities.Add(mText21); //********************************** 一块填写部分结束********************** } { //原位测试的长线条 DxfLineType drillCodeLineType = new DxfLineType("TestLine1" + str); model.LineTypes.Add(drillCodeLineType); DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(124d, -23d, 0d); drillCodeine.End = new Point3D(124d, -278d, 0d); drillCodeine.Color = EntityColors.Gray; drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); DxfLineType drillCodeLineType1 = new DxfLineType("TestLine2" + str); model.LineTypes.Add(drillCodeLineType1); DxfLine drillCodeine1 = new DxfLine(); drillCodeine1.Start = new Point3D(129d, -23d, 0d); drillCodeine1.End = new Point3D(129d, -278d, 0d); drillCodeine1.Color = EntityColors.Gray; drillCodeine1.LineType = drillCodeLineType1; block.Entities.Add(drillCodeine1); DxfLineType drillCodeLineType2 = new DxfLineType("TestLine3" + str); model.LineTypes.Add(drillCodeLineType2); DxfLine drillCodeine2 = new DxfLine(); drillCodeine2.Start = new Point3D(134d, -23d, 0d); drillCodeine2.End = new Point3D(134d, -278d, 0); drillCodeine2.Color = EntityColors.Gray; drillCodeine2.LineType = drillCodeLineType2; block.Entities.Add(drillCodeine2); } //需要填入表中的其他部分的内容 { //钻孔编号***************************************************************** DxfMText drillCodeText = new DxfMText( @"钻孔编号", new Point3D(0d, 5d, 0d), 2.5d ); block.Entities.Add(drillCodeText); DxfLineType drillCodeLineType = new DxfLineType("zkbhLine" + str); model.LineTypes.Add(drillCodeLineType); DxfLine drillCodeine = new DxfLine(); drillCodeine.Start = new Point3D(15d, 1d, 0d); drillCodeine.End = new Point3D(33d, 1d, 0d); drillCodeine.LineType = drillCodeLineType; block.Entities.Add(drillCodeine); DxfMText drillCodeWriteIn = new DxfMText( @"" + drillCode, new Point3D(17d, 4d, 0d), 2d ); block.Entities.Add(drillCodeWriteIn); //*********************************************************************** //钻孔位置*************************************************************** DxfMText drillLocationText = new DxfMText( @"钻孔位置", new Point3D(35d, 5d, 0d), 2.5d ); block.Entities.Add(drillLocationText); DxfLineType drillLocationLineType = new DxfLineType("drillLocationLine" + str); model.LineTypes.Add(drillLocationLineType); DxfLine drillLocationLine = new DxfLine(); drillLocationLine.Start = new Point3D(52d, 1, 0d); drillLocationLine.End = new Point3D(77d, 1d, 0d); drillLocationLine.LineType = drillLocationLineType; block.Entities.Add(drillLocationLine); DxfMText drillLocationWriteIn = new DxfMText( @"" + drillLocation + drillLocation1 + drillLocation2, new Point3D(54d, 4d, 0d), 2d ); block.Entities.Add(drillLocationWriteIn); //***************************************************************************** //********施钻起止日期********************************************************* DxfMText drillDate = new DxfMText( @"施钻起止日期", new Point3D(79d, 5d, 0d), 2.5d ); block.Entities.Add(drillDate); DxfLineType drillDateLineType = new DxfLineType("drillDateLine" + str); model.LineTypes.Add(drillDateLineType); DxfLine drillDateLine = new DxfLine(); drillDateLine.Start = new Point3D(101, 1d, 0d); drillDateLine.End = new Point3D(133, 1d, 0d); drillDateLine.LineType = drillDateLineType; block.Entities.Add(drillDateLine); DxfMText drillDateWriteIn = new DxfMText( @"" + drillStartTime + "--" + drillEndTime, new Point3D(102d, 4d, 0d), 2d ); block.Entities.Add(drillDateWriteIn); //*********************************************************************** //**********孔口标高***************************************************** DxfMText drillHoleStadHeight = new DxfMText( @"孔口标高", new Point3D(136d, 5d, 0d), 2.5d ); block.Entities.Add(drillHoleStadHeight); DxfLineType drillHoleStadHeightLineType = new DxfLineType("drillHoleStaHeight" + str); model.LineTypes.Add(drillHoleStadHeightLineType); DxfLine drillHoleStadHeightLine = new DxfLine(); drillHoleStadHeightLine.Start = new Point3D(151d, 1d, 0d); drillHoleStadHeightLine.End = new Point3D(172d, 1d, 0d); drillHoleStadHeightLine.LineType = drillHoleStadHeightLineType; block.Entities.Add(drillHoleStadHeightLine); DxfMText drillHoleStadHeightWriteIn = new DxfMText( @"" + drillHoleStadardHeight, new Point3D(152d, 4d, 0d), 2d ); block.Entities.Add(drillHoleStadHeightWriteIn); //********************************************************************************** } //addPattern(); addExtension();//设置值的同时画出扩展线 //文件存储路径以及文件名,因为钻孔编号是唯一的,所以钻孔柱状图根据钻孔编号命名,一个钻孔对应一个柱状图 string path = AppDomain.CurrentDomain.BaseDirectory + "Drill\\rockHistogram\\" + drillCode + ".dxf"; DirectoryInfo directoryInfo = new DirectoryInfo(path); //先判断当前文件若存在则删除 /* * if (directoryInfo.Exists) //若当前文件存在则先删除,再重新创建生成,这样可以在界面中进行多次成图 * { * directoryInfo.Delete(); * } */ DxfWriter.Write(path, model, true); //DxfWriter.Write("AcosticBoreholeTable.dxf", model); //return "AcosticBoreholeTable.dxf"; ConvertFigureFormat cf = new ConvertFigureFormat(); string filename = drillCode; string outfile = AppDomain.CurrentDomain.BaseDirectory + "Drill\\rockHistogram\\" + filename; cf.getDXFFormat(model, filename, outfile); }