public static void Draw(DxfDocument dxf, Location location) { Vector3f v1 = new Vector3f(location.X - 2.0f, location.Y - 4.0f, location.Z); Vector3f v2 = new Vector3f(location.X + 2.0f, location.Y + 4.0f, location.Z); Layer layer = new Layer("line"); Line line12 = new Line(v1, v2); line12.Layer = layer; dxf.AddEntity(line12); }
/// <summary> /// 风向绘制 /// </summary> /// <param name="dxf"></param> /// <param name="location"></param> /// <param name="isRight"></param> public static void Draw(DxfDocument dxf, Location location, bool isRight) { float factor = 0.5f; Vector3f v1 = new Vector3f(); Vector3f v2 = new Vector3f(); Vector3f v3 = new Vector3f(); Vector3f v4 = new Vector3f(); Vector3f v5 = new Vector3f(); Vector3f v6 = new Vector3f(); Vector3f v7 = new Vector3f(); if (isRight) { v1 = new Vector3f(10*factor + location.X, location.Y, location.Z); v2 = new Vector3f(location.X, location.Y + 10 * factor, location.Z); v3 = new Vector3f(location.X + 10 * factor, location.Y + 10 * factor, location.Z); v4 = new Vector3f(location.X + 20 * factor, location.Y + 15 * factor, location.Z); v5 = new Vector3f(location.X, location.Y + 20 * factor, location.Z); v6 = new Vector3f(location.X + 10 * factor, location.Y + 20 * factor, location.Z); v7 = new Vector3f(location.X + 10 * factor, location.Y + 30 * factor, location.Z); } else { v1 = new Vector3f(10 * factor + location.X, location.Y, location.Z); v2 = new Vector3f(location.X + 20 * factor, location.Y + 10 * factor, location.Z); v3 = new Vector3f(location.X + 10 * factor, location.Y + 10 * factor, location.Z); v4 = new Vector3f(location.X, location.Y + 15 * factor, location.Z); v5 = new Vector3f(location.X + 20 * factor, location.Y + 20 * factor, location.Z); v6 = new Vector3f(location.X + 10 * factor, location.Y + 20 * factor, location.Z); v7 = new Vector3f(location.X + 10 * factor, location.Y + 30 * factor, location.Z); } Layer layer = new Layer("line"); Line line23 = new Line(v2, v3); line23.Layer = layer; dxf.AddEntity(line23); Line line56 = new Line(v5, v6); line56.Layer = layer; dxf.AddEntity(line56); Line line14 = new Line(v1, v4); line14.Layer = layer; dxf.AddEntity(line14); Line line74 = new Line(v7, v4); line74.Layer = layer; dxf.AddEntity(line74); Line line25 = new Line(v2, v5); line25.Layer = layer; dxf.AddEntity(line25); Line line71 = new Line(v7, v1); line71.Layer = layer; dxf.AddEntity(line71); }
public static void Draw(DxfDocument dxf, Location location,List<string> configurations) { Vector3f confStrVector3f = new Vector3f(location.X + 5.0f, location.Y - 5.0f, location.Z); TextStyle style = new TextStyle("True type font", "Arial.ttf"); Text text1 = new Text("CONFIGURATION: NOTE: Assembly drawing for overall dimesions, actual door size and handle position may vary", confStrVector3f, 2.0f, style); Layer layer = new Layer("text"); text1.Layer = layer; //text1.Layer.Color.Index = 8; text1.Alignment = TextAlignment.TopLeft; dxf.AddEntity(text1); for (int i = 0; i < configurations.Count(); i++) { Vector3f confVector3f = new Vector3f(location.X+10.0f, location.Y - 5.0f * (i + 2), location.Z); Text text = new Text(configurations[i], confVector3f, 2.0f, style); text.Layer = layer; //text.Layer.Color.Index = 8; text.Alignment = TextAlignment.TopLeft; dxf.AddEntity(text); } }
//画两个门无门闩的设备 public static void writeDoubleDoorRectangle(DxfDocument doc,Location location,string [] text,float height,float width,float outer_mid_space,float outer_in_space) { Layer doorLineLayer=new Layer("doorLineLayer"); Line outerLeftLine=new Line(new Vector3f(location.X+width/2-width/14,location.Y+outer_mid_space,location.Z),new Vector3f(location.X+width/2-width/14,location.Y+height-outer_mid_space,location.Z)); outerLeftLine.Layer = doorLineLayer; Line inLeftLine = new Line(new Vector3f(location.X + width / 2 - width / 14 + 0.5f, location.Y + outer_in_space, location.Z), new Vector3f(location.X + width / 2 - width / 14 + 0.5f, location.Y + height - outer_in_space, location.Z)); inLeftLine.Layer = doorLineLayer; Line inRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14, location.Y + outer_in_space, location.Z), new Vector3f(location.X + width / 2 + width / 14, location.Y + height - outer_in_space, location.Z)); inRightLine.Layer = doorLineLayer; Line outerRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + outer_mid_space, location.Z), new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + height - outer_mid_space, location.Z)); outerRightLine.Layer = doorLineLayer; doc.AddEntity(outerLeftLine); doc.AddEntity(inLeftLine); doc.AddEntity(inRightLine); doc.AddEntity(outerRightLine); writeDoorRectangle(doc, location,text, height, width, outer_mid_space, outer_in_space); }
/// <summary> /// 绘制订单信息块 /// </summary> /// <param name="dxf"></param> /// <param name="location"></param> /// <param name="boxWidth"></param> /// <param name="configurations"></param> public static void Draw(DxfDocument dxf, Location location,float boxWidth, OrderEntity orderEntity) { float factor = 0.6f; Vector3f v1 = new Vector3f(location.X,location.Y,location.Z); Vector3f v2 = new Vector3f(location.X + boxWidth, location.Y, location.Z); Vector3f v3 = new Vector3f(location.X + boxWidth, location.Y + 40.0f * factor, location.Z); Vector3f v4 = new Vector3f(location.X, location.Y + 40.0f * factor, location.Z); Vector3f v5 = new Vector3f(location.X, location.Y + 10.0f * factor, location.Z); Vector3f v6 = new Vector3f(location.X + boxWidth / 4, location.Y + 10.0f * factor, location.Z); Vector3f v7 = new Vector3f(location.X + boxWidth / 2, location.Y + 10.0f * factor, location.Z); Vector3f v8 = new Vector3f(location.X + boxWidth * 3 / 4, location.Y + 10.0f * factor, location.Z); Vector3f v9 = new Vector3f(location.X + boxWidth * 7 / 8, location.Y + 10.0f * factor, location.Z); Vector3f v10 = new Vector3f(location.X + boxWidth / 4, location.Y + 20.0f * factor, location.Z); Vector3f v11 = new Vector3f(location.X + boxWidth / 2, location.Y + 20.0f * factor, location.Z); Vector3f v12 = new Vector3f(location.X + boxWidth * 3 / 4, location.Y + 20.0f * factor, location.Z); Vector3f v13 = new Vector3f(location.X + boxWidth * 7 / 8, location.Y + 20.0f * factor, location.Z); Vector3f v14 = new Vector3f(location.X + boxWidth, location.Y + 20.0f * factor, location.Z); Vector3f v15 = new Vector3f(location.X + boxWidth / 4, location.Y + 40.0f * factor, location.Z); Vector3f v16 = new Vector3f(location.X + boxWidth * 3 / 4, location.Y + 40.0f * factor, location.Z); Vector3f v17 = new Vector3f(location.X + boxWidth / 4, location.Y, location.Z); Vector3f v18 = new Vector3f(location.X + boxWidth / 2, location.Y, location.Z); Vector3f v19 = new Vector3f(location.X + boxWidth * 3 / 4, location.Y, location.Z); Vector3f v20 = new Vector3f(location.X + boxWidth, location.Y + 10.0f * factor, location.Z); Layer layer = new Layer("line"); //横向四道 Line line12 = new Line(v1, v2); line12.Layer = layer; dxf.AddEntity(line12); Line line520 = new Line(v5, v20); line520.Layer = layer; dxf.AddEntity(line520); Line line1014 = new Line(v10, v14); line1014.Layer = layer; dxf.AddEntity(line1014); Line line43 = new Line(v4, v3); line43.Layer = layer; dxf.AddEntity(line43); //纵向6道 Line line41 = new Line(v4, v1); line41.Layer = layer; dxf.AddEntity(line41); Line line1517 = new Line(v15, v17); line1517.Layer = layer; dxf.AddEntity(line1517); Line line1118 = new Line(v11, v18); line1118.Layer = layer; dxf.AddEntity(line1118); Line line1619 = new Line(v16, v19); line1619.Layer = layer; dxf.AddEntity(line1619); Line line139 = new Line(v13, v9); line139.Layer = layer; dxf.AddEntity(line139); Line line32= new Line(v3, v2); line32.Layer = layer; dxf.AddEntity(line32); //文字 TextStyle style = new TextStyle("True type font", "Arial.ttf"); Vector3f vt1 = new Vector3f(v1.X + 1.0f, v1.Y + 2.5f, v1.Z); Text t1 = new Text("Celebrity 1.0.0", vt1, 2.0f, style); t1.Layer = layer; t1.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t1); Vector3f vt2 = new Vector3f(v17.X + 1.0f, v17.Y + 2.5f, v1.Z); Text t2 = new Text("PREPARER: "+orderEntity.Preparer, vt2, 2.0f, style); t2.Layer = layer; t1.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t2); Vector3f vt3 = new Vector3f(v18.X + 1.0f, v18.Y + 2.5f, v1.Z); Text t3 = new Text("ENGINEER: "+orderEntity.Engineer, vt3, 2.0f, style); t3.Layer = layer; t3.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t3); Vector3f vt4 = new Vector3f(v19.X + 1.0f, v19.Y + 2.5f, v1.Z); Text t4 = new Text("SHIP ORDER NO: "+orderEntity.ShipOrderNo, vt4, 2.0f, style); t4.Layer = layer; t4.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t4); Vector3f vt5 = new Vector3f(v4.X + 1.0f, v10.Y + 2.5f, v1.Z); Text t5= new Text(" AAON COIL PRODUCTS inc.", vt5, 3.0f, style); t5.Layer = layer; t5.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t5); Vector3f vt6 = new Vector3f(v5.X + 1.0f, v5.Y + 2.5f, v1.Z); Text t6 = new Text("LONGVIEW TEXAS", vt6, 2.0f, style); t6.Layer = layer; t6.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t6); Vector3f vt7 = new Vector3f(v6.X + 1.0f, v6.Y + 2.5f, v1.Z); Text t7 = new Text("PURCHASER: " + orderEntity.Purchaser, vt7, 2.0f, style); t7.Layer = layer; t7.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t7); Vector3f vt8 = new Vector3f(v7.X + 1.0f, v7.Y + 2.5f, v1.Z); Text t8 = new Text("PURCHASE ORDER: " + orderEntity.PurchaseOrder, vt8, 2.0f, style); t8.Layer = layer; t8.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t8); Vector3f vt9 = new Vector3f(v8.X + 1.0f, v8.Y + 2.5f, v1.Z); Text t9 = new Text("SERIAL NO: " + orderEntity.SeriaNo, vt9, 2.0f, style); t9.Layer = layer; t9.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t9); Vector3f vt10 = new Vector3f(v9.X + 1.0f, v9.Y + 2.5f, v1.Z); Text t10 = new Text("DATE: "+DateTime.Now.ToShortDateString(), vt10, 2.0f, style); t10.Layer = layer; t10.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t10); Vector3f vt11 = new Vector3f(v15.X + 1.0f, v15.Y - 7.5f, v1.Z); Text t11 = new Text("JOB NAME:", vt11, 2.0f, style); t11.Layer = layer; t11.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t11); Vector3f vt12 = new Vector3f(v10.X + 10.0f, v10.Y + 2.5f, v1.Z); Text t12 = new Text(orderEntity.JobName, vt12, 2.0f, style); t12.Layer = layer; t12.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t12); Vector3f vt13 = new Vector3f(v16.X + 1.0f, v16.Y - 7.5f, v1.Z); Text t13 = new Text("UNIT TAG:", vt13, 2.0f, style); t13.Layer = layer; t13.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t13); Vector3f vt14 = new Vector3f(v12.X + 20.0f, v12.Y + 2.5f, v1.Z); Text t14 = new Text(orderEntity.UnitTag, vt14, 2.0f, style); t14.Layer = layer; t14.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t14); }
//画完整的带支架的设备矩形框 public static void writeWholeMachine(DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth,string upOrDownLayer) { writeDoorRectangle(dxf,location,text,height,width,outer_mid_space,outer_in_space); //画小支架 if (upOrDownLayer.Equals("downLayer")) { //左下角 writeOuterDoorRectangle(dxf, new Location(location.X, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space); //右下角 writeOuterDoorRectangle(dxf, new Location(location.X + width + outer_mid_space - outer_in_space, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space); } }
//画完整的一个单门(门闩,把手,支架) public static void writeWholeSingleDoor(DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth,string upOrDownLayer) { writeDoorBarRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); float downLeftX=location.X+outer_mid_space-barWidth/2+(outer_in_space-outer_mid_space)/2; float downLeftY=location.Y + height / 4; writeRepresentDoorBarRectangle(dxf, new Location(downLeftX,downLeftY , location.Z), text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); float upLeftX = downLeftX; float upLeftY = location.Y + 3 * height / 4 - barHeight; writeRepresentDoorBarRectangle(dxf, new Location(upLeftX,upLeftY , location.Z), text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); //画小支架 if (upOrDownLayer.Equals("downLayer")) { //左下角 writeOuterDoorRectangle(dxf, new Location(location.X, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space); //右下角 writeOuterDoorRectangle(dxf, new Location(location.X + width + outer_mid_space - outer_in_space, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space); } //画门把手 Handle.Draw(dxf, new Location(location.X + 3 * width / 4, location.Y + 3 * height / 4 - barHeight, location.Z)); Handle.Draw(dxf, new Location(location.X + 3 * width / 4, location.Y + height / 4, location.Z)); }
public void Draw(DxfDocument dxf, Location location, float boxWidth, float boxHeight, List<PictureBoxInfo> pictureBoxInfoList,int coolingType) { DataManager dataManager=new DataManager(); //boxWidth = dataManager.getTotalWidth(pictureBoxInfoList); //得到框架信息 var boxEntity = dataCenter.BoxEntity; boxWidth = boxEntity.Width + 240.0f; boxHeight = boxEntity.TopViewHeight + boxEntity.UpHeight + boxEntity.DownHeight + 160.0f; /****************************************************************************/ //绘制最外框 /****************************************************************************/ Vector3f v1 = new Vector3f(location.X, location.Y, location.Z); Vector3f v2 = new Vector3f(location.X, location.Y - boxHeight, location.Z); Vector3f v3 = new Vector3f(location.X + boxWidth, location.Y - boxHeight, location.Z); Vector3f v4 = new Vector3f(location.X + boxWidth, location.Y, location.Z); //LinePointer.Draw(dxf, location); //Slash.Draw(dxf,new Location(v2.X,v2.Y,v2.Z)); //Fan.Draw(dxf, v2,v1,2); Layer layer = new Layer("outerline"); Line line12 = new Line(v1, v2); line12.Layer = layer; dxf.AddEntity(line12); Line line23 = new Line(v2, v3); line23.Layer = layer; dxf.AddEntity(line23); Line line34 = new Line(v3, v4); line34.Layer = layer; dxf.AddEntity(line34); Line line14 = new Line(v1, v4); line14.Layer = layer; dxf.AddEntity(line14); /****************************************************************************/ //绘制左上角的配置信息 /****************************************************************************/ Configuration.Draw(dxf, new Location(v1.X, v1.Y), dataCenter.Configurations); /****************************************************************************/ //绘制左下角的节信息 /****************************************************************************/ Section.Draw(dxf, new Location(v2.X, v2.Y), dataCenter.SectionEntity); /****************************************************************************/ //绘制底部的订单信息 /****************************************************************************/ Order.Draw(dxf, new Location(v2.X, v2.Y), boxWidth, dataCenter.OrderEntity); //俯视图左下角的坐标点 Location v5 = new Location(location.X + 120.0f, location.Y - boxEntity.TopViewHeight - 50.0f, location.Z); /****************************************************************************/ //绘制俯视图 /****************************************************************************/ //AssembleTopView.assembleTopView(pictureBoxInfoList, dxf, // v5, null, 50.0f, 18.0f, 2.0f, 2.86f, 2.0f, 2.0f); AssembleTopView.assembleTopView(pictureBoxInfoList, dxf, v5, dataCenter.topViewConfigure); //正视图左下角的坐标点 Location v6 = new Location(location.X + 120.0f, location.Y - boxEntity.TopViewHeight - 80.0f - boxEntity.UpHeight - boxEntity.DownHeight, location.Z); /****************************************************************************/ //绘制正视图 /****************************************************************************/ AssembleDetailMechine.assembleDetailMechine(pictureBoxInfoList, dxf, v6, dataCenter.detailMechineConfigure, coolingType); //正视图两边的风向箭头位置 //存在第一层 Location v7 = new Location(location.X + 70.0f, location.Y - 90.0f-boxEntity.TopViewHeight-boxEntity.UpHeight-boxEntity.DownHeight/2, location.Z); Location v8 = new Location(location.X + boxWidth - 50.0f, location.Y - 90.0f - boxEntity.TopViewHeight - boxEntity.UpHeight - boxEntity.DownHeight / 2, location.Z); /****************************************************************************/ //绘制正视图两边的风向箭头 /****************************************************************************/ Wind.Draw(dxf, v7, boxEntity.IsLeft); Wind.Draw(dxf, v8, boxEntity.IsLeft); //如果存在第二层 if (boxEntity.UpHeight != 0) { Location v9 = new Location(location.X + 70.0f, location.Y - 90.0f - boxEntity.TopViewHeight - boxEntity.UpHeight / 2, location.Z); Location v10 = new Location(location.X + boxWidth - 50.0f, location.Y - 90.0f - boxEntity.TopViewHeight - boxEntity.UpHeight / 2, location.Z); Wind.Draw(dxf, v9, !boxEntity.IsLeft); Wind.Draw(dxf, v10, !boxEntity.IsLeft); } }
//画带有四个小矩形的俯视图矩形 public static void writeTopViewRectangle(DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space) { //outer_in_space模拟height,outer_in_space - outer_mid_space模拟width //主要矩形 writeOuterDoorRectangle(dxf, location, height, width); //左上角矩形 writeOuterDoorRectangle(dxf, new Location(location.X, location.Y + height, location.Z), outer_in_space, outer_in_space - outer_mid_space); //右上角 writeOuterDoorRectangle(dxf, new Location(location.X + width - outer_in_space + outer_mid_space, location.Y + height, location.Z), outer_in_space, outer_in_space - outer_mid_space); //左下角 writeOuterDoorRectangle(dxf, new Location(location.X, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space); //右下角 writeOuterDoorRectangle(dxf, new Location(location.X + width - outer_in_space + outer_mid_space, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space); }
public DetailMechineConfigure getDetailMechineCnfigure(List<PictureBoxInfo> pictureBoxNameList, DxfDocument dxf, Location location) { return new DetailMechineConfigure(pictureBoxNameList, new string[] { "hello", "world", "helloworld" }, 44.0f, 18, 2.0f, 2.86f, 2.0f, 2.0f); }
/// <summary> /// 绘制左下角区域的Section块 /// </summary> /// <param name="dxf"></param> /// <param name="location"></param> /// <param name="configurations"></param> public static void Draw(DxfDocument dxf, Location location,SectionEntity sectionEntity) { float factor=0.6f; Vector3f v1 = new Vector3f(location.X, location.Y + 40.0f*factor, location.Z); Vector3f v2 = new Vector3f(location.X + 50.0f * factor, location.Y + 40.0f * factor, location.Z); Vector3f v3 = new Vector3f(location.X + 90.0f * factor, location.Y + 40.0f * factor, location.Z); Vector3f v4 = new Vector3f(location.X + 140.0f * factor, location.Y + 40.0f * factor, location.Z); Vector3f v5 = new Vector3f(location.X, location.Y + 50.0f * factor, location.Z); Vector3f v6 = new Vector3f(location.X + 140.0f * factor, location.Y + 50.0f * factor, location.Z); Vector3f v7 = new Vector3f(location.X, location.Y + 60.0f * factor, location.Z); Vector3f v8 = new Vector3f(location.X + 140.0f * factor, location.Y + 60.0f * factor, location.Z); Vector3f v9 = new Vector3f(location.X, location.Y + 70.0f * factor, location.Z); Vector3f v10 = new Vector3f(location.X + 50.0f * factor, location.Y + 70.0f * factor, location.Z); Vector3f v11 = new Vector3f(location.X + 90.0f * factor, location.Y + 70.0f * factor, location.Z); Vector3f v12 = new Vector3f(location.X + 140.0f * factor, location.Y + 70.0f * factor, location.Z); Layer layer = new Layer("line"); //横向四道 Line line14 = new Line(v1, v4); line14.Layer = layer; dxf.AddEntity(line14); Line line56 = new Line(v5, v6); line56.Layer = layer; dxf.AddEntity(line56); Line line78 = new Line(v7, v8); line78.Layer = layer; dxf.AddEntity(line78); Line line912 = new Line(v9, v12); line912.Layer = layer; dxf.AddEntity(line912); //纵向四道 Line line91 = new Line(v9, v1); line91.Layer = layer; dxf.AddEntity(line91); Line line210 = new Line(v2, v10); line210.Layer = layer; dxf.AddEntity(line210); Line line311 = new Line(v3, v11); line311.Layer = layer; dxf.AddEntity(line311); Line line412 = new Line(v4, v12); line412.Layer = layer; dxf.AddEntity(line412); TextStyle style = new TextStyle("True type font", "Arial.ttf"); Vector3f vt1 = new Vector3f(v1.X+1.0f, v1.Y+2.5f, v1.Z); Text t1 = new Text("COIL", vt1, 2.0f, style); t1.Layer = layer; t1.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t1); Vector3f vt2 = new Vector3f(v2.X + 1.0f, v2.Y + 2.5f, v2.Z); Text t2 = new Text("CLF", vt2, 2.0f, style); t2.Layer = layer; t2.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t2); Vector3f vt3 = new Vector3f(v3.X + 1.0f, v3.Y + 2.5f, v3.Z); Text t3 = new Text(sectionEntity.CoolValue, vt3, 2.0f, style); t3.Layer = layer; t3.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t3); Vector3f vt4 = new Vector3f(v5.X + 1.0f, v5.Y + 2.5f, v5.Z); Text t4 = new Text("FILTER", vt4, 2.0f, style); t4.Layer = layer; t4.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t4); Vector3f vt5 = new Vector3f(v2.X + 1.0f, v5.Y + 2.5f, v5.Z); Text t5 = new Text("FTA", vt5, 2.0f, style); t5.Layer = layer; t5.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t5); Vector3f vt6 = new Vector3f(v3.X + 1.0f, v5.Y + 2.5f, v5.Z); Text t6 = new Text(sectionEntity.FilterValue, vt6, 2.0f, style); t6.Layer = layer; t6.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t6); Vector3f vt7 = new Vector3f(v7.X + 1.0f, v7.Y + 2.5f, v7.Z); Text t7 = new Text("SECTION", vt7, 2.0f, style); t7.Layer = layer; t7.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t7); Vector3f vt8 = new Vector3f(v2.X + 1.0f, v7.Y + 2.5f, v7.Z); Text t8 = new Text("MODULE", vt8, 2.0f, style); t8.Layer = layer; t8.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t8); Vector3f vt9 = new Vector3f(v3.X + 1.0f, v7.Y + 2.5f, v7.Z); Text t9 = new Text("CLEARANCE", vt9, 2.0f, style); t9.Layer = layer; t9.Alignment = TextAlignment.TopLeft; dxf.AddEntity(t9); }
//画无门栓的矩形框 public static void writeDoorRectangle(DxfDocument doc, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space) { Layer doorRectangleLayer = new Layer("nonDoorBarLayer"); //最外围矩形 writeOuterDoorRectangle(doc,location,height,width); //中间矩形 Line midBottomLine=new Line(new Vector3f(location.X+outer_mid_space,location.Y+outer_mid_space,location.Z),new Vector3f(location.X+width-outer_mid_space,location.Y+outer_mid_space,location.Z)); midBottomLine.Layer=doorRectangleLayer; Line midLeftLine=new Line(new Vector3f(location.X+outer_mid_space,location.Y+outer_mid_space,location.Z),new Vector3f(location.X+outer_mid_space,location.Y+height-outer_mid_space,location.Z)); midLeftLine.Layer=doorRectangleLayer; Line midTopLine=new Line(new Vector3f(location.X+outer_mid_space,location.Y+height-outer_mid_space,location.Z),new Vector3f(location.X+width-outer_mid_space,location.Y+height-outer_mid_space,location.Z)); midTopLine.Layer=doorRectangleLayer; Line midRightLine = new Line(new Vector3f(location.X + width - outer_mid_space, location.Y + height - outer_mid_space, location.Z), new Vector3f(location.X + width - outer_mid_space, location.Y + outer_mid_space, location.Z)); midRightLine.Layer = doorRectangleLayer; doc.AddEntity(midBottomLine); doc.AddEntity(midLeftLine); doc.AddEntity(midTopLine); doc.AddEntity(midRightLine); //内部矩形 Line inBottomLine = new Line(new Vector3f(location.X + outer_in_space, location.Y + outer_in_space, location.Z), new Vector3f(location.X + width - outer_in_space, location.Y + outer_in_space, location.Z)); inBottomLine.Layer = doorRectangleLayer; Line inLeftLine = new Line(new Vector3f(location.X + outer_in_space, location.Y + outer_in_space, location.Z), new Vector3f(location.X + outer_in_space, location.Y + height - outer_in_space, location.Z)); inLeftLine.Layer = doorRectangleLayer; Line inTopLine = new Line(new Vector3f(location.X + outer_in_space, location.Y + height - outer_in_space, location.Z), new Vector3f(location.X + width - outer_in_space, location.Y + height - outer_in_space, location.Z)); inTopLine.Layer = doorRectangleLayer; Line inRightLine = new Line(new Vector3f(location.X + width - outer_in_space, location.Y + height - outer_in_space, location.Z), new Vector3f(location.X + width - outer_in_space, location.Y + outer_in_space, location.Z)); inRightLine.Layer = doorRectangleLayer; doc.AddEntity(inBottomLine); doc.AddEntity(inLeftLine); doc.AddEntity(inTopLine); doc.AddEntity(inRightLine); //门中文字 float textHeight=DoorInitHeightAndWidth.textHeight; for(int i=0;i<text.Length;i++){ Text doorRectangleText = new Text(text[i], new Vector3f(location.X + width / 3, location.Y + 3*height / 4- i * textHeight, location.Z), textHeight); doorRectangleText.Layer = doorRectangleLayer; doc.AddEntity(doorRectangleText); } }
//画两个门有门闩的设备 public static void writeDoubleDoorBarRectangle(DxfDocument doc, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space,float barHeight,float barWidth) { Layer doorLineLayer = new Layer("DoubleDoorBarRectangle"); Line outerLeftLine = new Line(new Vector3f(location.X + width / 2 - width / 14, location.Y + outer_mid_space, location.Z), new Vector3f(location.X + width / 2 - width / 14, location.Y + height - outer_mid_space, location.Z)); outerLeftLine.Layer = doorLineLayer; Line inLeftLine = new Line(new Vector3f(location.X + width / 2 - width / 14 + 0.5f, location.Y + outer_in_space, location.Z), new Vector3f(location.X + width / 2 - width / 14 + 0.5f, location.Y + height - outer_in_space, location.Z)); inLeftLine.Layer = doorLineLayer; Line inDownRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14, location.Y + outer_in_space, location.Z), new Vector3f(location.X + width / 2 + width / 14, location.Y + height/4, location.Z)); inDownRightLine.Layer = doorLineLayer; Line inMidRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14, location.Y + height / 4 + barHeight, location.Z), new Vector3f(location.X + width / 2 + width / 14, location.Y + 3 * height / 4 - barHeight, location.Z)); inMidRightLine.Layer = doorLineLayer; Line inUpRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14, location.Y + 3*height / 4, location.Z), new Vector3f(location.X + width / 2 + width / 14, location.Y + height-outer_in_space, location.Z)); inUpRightLine.Layer = doorLineLayer; Line outerDownRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + outer_mid_space, location.Z), new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + height/4, location.Z)); outerDownRightLine.Layer = doorLineLayer; Line outerMidRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + height/4+barHeight, location.Z), new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + 3*height / 4-barHeight, location.Z)); outerMidRightLine.Layer = doorLineLayer; Line outerUpRightLine = new Line(new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + 3*height / 4, location.Z), new Vector3f(location.X + width / 2 + width / 14 + 0.5f, location.Y + height-outer_in_space, location.Z)); outerUpRightLine.Layer = doorLineLayer; doc.AddEntity(outerLeftLine); doc.AddEntity(inLeftLine); doc.AddEntity(inDownRightLine); doc.AddEntity(inMidRightLine); doc.AddEntity(inUpRightLine); doc.AddEntity(outerDownRightLine); doc.AddEntity(outerMidRightLine); doc.AddEntity(outerUpRightLine); writeDoorBarRectangle(doc, location, text, height, width, outer_mid_space, outer_in_space,barHeight,barWidth); }
//画标注 public static void writeDimension(DxfDocument doc,Location firstLocation,Location secondLocation,float textHeight,float textWidth,float dimensionHeight,string dimensionDirection) { float numWidth; string strNumWidth = ""; Layer dimensionLayer=new Layer("dimensionLayer"); Line line1 = new Line(); Line line2 = new Line(); Line leftLine = new Line(); Line rightLine = new Line(); Line upLeftLine = new Line(); Line downLeftLine = new Line(); Line upRightLine = new Line(); Line downRightLine = new Line(); Text strText = new Text(); line1.Layer = dimensionLayer; line2.Layer = dimensionLayer; leftLine.Layer = dimensionLayer; rightLine.Layer = dimensionLayer; upLeftLine.Layer = dimensionLayer; downLeftLine.Layer = dimensionLayer; upRightLine.Layer = dimensionLayer; downRightLine.Layer = dimensionLayer; strText.Layer = dimensionLayer; if (dimensionDirection.Equals("top")) { line1.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y, firstLocation.Z); line1.EndPoint = new Vector3f(firstLocation.X, firstLocation.Y + dimensionHeight, firstLocation.Z); line2.StartPoint = new Vector3f(secondLocation.X,secondLocation.Y,secondLocation.Z); line2.EndPoint = new Vector3f(secondLocation.X,secondLocation.Y+dimensionHeight,secondLocation.Z); leftLine.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y + 7 * dimensionHeight / 8,firstLocation.Z); leftLine.EndPoint = new Vector3f(firstLocation.X+Math.Abs(firstLocation.X-secondLocation.X)/2-textWidth/2,firstLocation.Y+7*dimensionHeight/8, firstLocation.Z); upLeftLine.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y + 7 * dimensionHeight / 8,firstLocation.Z); upLeftLine.EndPoint = new Vector3f(firstLocation.X + 0.2f, firstLocation.Y + 7 * dimensionHeight / 8+0.2f,firstLocation.Z); downLeftLine.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y + 7 * dimensionHeight / 8, firstLocation.Z); downLeftLine.EndPoint = new Vector3f(firstLocation.X + 0.2f, firstLocation.Y + 7 * dimensionHeight / 8 - 0.2f, firstLocation.Z); upRightLine.StartPoint = new Vector3f(secondLocation.X, secondLocation.Y + 7 * dimensionHeight/8,secondLocation.Z); upRightLine.EndPoint = new Vector3f(secondLocation.X - 0.2f, secondLocation.Y + 7 * dimensionHeight / 8 + 0.2f, secondLocation.Z); downRightLine.StartPoint = new Vector3f(secondLocation.X,secondLocation.Y+7*dimensionHeight/8,secondLocation.Z); downRightLine.EndPoint = new Vector3f(secondLocation.X-0.2f,secondLocation.Y+7*dimensionHeight/8-0.2f,secondLocation.Z); rightLine.StartPoint = new Vector3f(secondLocation.X,secondLocation.Y+7*dimensionHeight/8,secondLocation.Z); rightLine.EndPoint = new Vector3f(secondLocation.X-Math.Abs(firstLocation.X-secondLocation.X)/2+textWidth/2,secondLocation.Y+7*dimensionHeight/8,secondLocation.Z); numWidth = secondLocation.X - firstLocation.X; strNumWidth = "" + numWidth; strText.BasePoint=new Vector3f(firstLocation.X+Math.Abs(firstLocation.X-secondLocation.X)/2-textWidth/2+0.2f,firstLocation.Y+7*dimensionHeight/8, firstLocation.Z); strText.Height=0.5f; strText.Value=strNumWidth; } else if(dimensionDirection.Equals("bottom")){ line1.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y, firstLocation.Z); line1.EndPoint = new Vector3f(firstLocation.X, firstLocation.Y - dimensionHeight, firstLocation.Z); line2.StartPoint = new Vector3f(secondLocation.X, secondLocation.Y, secondLocation.Z); line2.EndPoint = new Vector3f(secondLocation.X, secondLocation.Y - dimensionHeight, secondLocation.Z); leftLine.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y - 7 * dimensionHeight / 8, firstLocation.Z); leftLine.EndPoint = new Vector3f(firstLocation.X + Math.Abs(firstLocation.X - secondLocation.X) / 2 - textWidth / 2, firstLocation.Y - 7 * dimensionHeight / 8, firstLocation.Z); upLeftLine.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y - 7 * dimensionHeight / 8, firstLocation.Z); upLeftLine.EndPoint = new Vector3f(firstLocation.X + 0.2f, firstLocation.Y - 7 * dimensionHeight / 8 + 0.2f, firstLocation.Z); downLeftLine.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y - 7 * dimensionHeight / 8, firstLocation.Z); downLeftLine.EndPoint = new Vector3f(firstLocation.X + 0.2f, firstLocation.Y - 7 * dimensionHeight / 8 - 0.2f, firstLocation.Z); upRightLine.StartPoint = new Vector3f(secondLocation.X, secondLocation.Y - 7 * dimensionHeight / 8, secondLocation.Z); upRightLine.EndPoint = new Vector3f(secondLocation.X - 0.2f, secondLocation.Y - 7 * dimensionHeight / 8 + 0.2f, secondLocation.Z); downRightLine.StartPoint = new Vector3f(secondLocation.X, secondLocation.Y - 7 * dimensionHeight / 8, secondLocation.Z); downRightLine.EndPoint = new Vector3f(secondLocation.X - 0.2f, secondLocation.Y - 7 * dimensionHeight / 8 - 0.2f, secondLocation.Z); rightLine.StartPoint = new Vector3f(secondLocation.X, secondLocation.Y - 7 * dimensionHeight / 8, secondLocation.Z); rightLine.EndPoint = new Vector3f(secondLocation.X - Math.Abs(firstLocation.X - secondLocation.X) / 2 + textWidth / 2, secondLocation.Y - 7 * dimensionHeight / 8, secondLocation.Z); numWidth = secondLocation.X - firstLocation.X; strNumWidth = "" + numWidth; strText.BasePoint=new Vector3f(firstLocation.X+Math.Abs(firstLocation.X-secondLocation.X)/2-textWidth/2+0.2f,firstLocation.Y-7*dimensionHeight/8, firstLocation.Z); strText.Height=0.5f; strText.Value=strNumWidth; } else if(dimensionDirection.Equals("left")){ line1.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y, firstLocation.Z); line1.EndPoint = new Vector3f(firstLocation.X - dimensionHeight, firstLocation.Y, firstLocation.Z); line2.StartPoint = new Vector3f(secondLocation.X, secondLocation.Y, secondLocation.Z); line2.EndPoint = new Vector3f(secondLocation.X - dimensionHeight, secondLocation.Y, secondLocation.Z); leftLine.StartPoint = new Vector3f(firstLocation.X - 7 * dimensionHeight / 8, firstLocation.Y, firstLocation.Z); leftLine.EndPoint = new Vector3f(firstLocation.X - 7 * dimensionHeight / 8, firstLocation.Y + Math.Abs(firstLocation.Y - secondLocation.Y) / 2 - textWidth / 2, firstLocation.Z); upLeftLine.StartPoint = new Vector3f(firstLocation.X - 7 * dimensionHeight / 8, firstLocation.Y, firstLocation.Z); upLeftLine.EndPoint = new Vector3f(firstLocation.X - 7 * dimensionHeight / 8 - 0.2f, firstLocation.Y + 0.2f, firstLocation.Z); downLeftLine.StartPoint = new Vector3f(firstLocation.X - 7 * dimensionHeight / 8, firstLocation.Y, firstLocation.Z); downLeftLine.EndPoint = new Vector3f(firstLocation.X - 7 * dimensionHeight / 8 + 0.2f, firstLocation.Y+0.2f, firstLocation.Z); upRightLine.StartPoint = new Vector3f(secondLocation.X - 7 * dimensionHeight / 8, secondLocation.Y, secondLocation.Z); upRightLine.EndPoint = new Vector3f(secondLocation.X - 7 * dimensionHeight / 8 - 0.2f, secondLocation.Y - 0.2f, secondLocation.Z); downRightLine.StartPoint = new Vector3f(secondLocation.X - 7 * dimensionHeight / 8, secondLocation.Y, secondLocation.Z); downRightLine.EndPoint = new Vector3f(secondLocation.X - 7 * dimensionHeight / 8 + 0.2f, secondLocation.Y-0.2f, secondLocation.Z); rightLine.StartPoint = new Vector3f(secondLocation.X - 7 * dimensionHeight / 8, secondLocation.Y, secondLocation.Z); rightLine.EndPoint = new Vector3f(secondLocation.X - 7 * dimensionHeight / 8, secondLocation.Y - Math.Abs(firstLocation.Y - secondLocation.Y) / 2 + textWidth / 2, secondLocation.Z); numWidth = secondLocation.Y - firstLocation.Y; strNumWidth = "" + numWidth; strText.BasePoint = new Vector3f(firstLocation.X - 7 * dimensionHeight / 8, firstLocation.Y + Math.Abs(firstLocation.Y - secondLocation.Y) / 2 - textWidth / 2 + 0.2f, firstLocation.Z); strText.Height=0.5f; strText.Value=strNumWidth; } else if (dimensionDirection.Equals("right")) { line1.StartPoint = new Vector3f(firstLocation.X, firstLocation.Y, firstLocation.Z); line1.EndPoint = new Vector3f(firstLocation.X + dimensionHeight, firstLocation.Y, firstLocation.Z); line2.StartPoint = new Vector3f(secondLocation.X, secondLocation.Y, secondLocation.Z); line2.EndPoint = new Vector3f(secondLocation.X + dimensionHeight, secondLocation.Y, secondLocation.Z); leftLine.StartPoint = new Vector3f(firstLocation.X + 7 * dimensionHeight / 8, firstLocation.Y, firstLocation.Z); leftLine.EndPoint = new Vector3f(firstLocation.X + 7 * dimensionHeight / 8, firstLocation.Y + Math.Abs(firstLocation.Y - secondLocation.Y) / 2 - textWidth / 2, firstLocation.Z); upLeftLine.StartPoint = new Vector3f(firstLocation.X + 7 * dimensionHeight / 8, firstLocation.Y, firstLocation.Z); upLeftLine.EndPoint = new Vector3f(firstLocation.X + 7 * dimensionHeight / 8 - 0.2f, firstLocation.Y + 0.2f, firstLocation.Z); downLeftLine.StartPoint = new Vector3f(firstLocation.X + 7 * dimensionHeight / 8, firstLocation.Y, firstLocation.Z); downLeftLine.EndPoint = new Vector3f(firstLocation.X + 7 * dimensionHeight / 8 + 0.2f, firstLocation.Y + 0.2f, firstLocation.Z); upRightLine.StartPoint = new Vector3f(secondLocation.X + 7 * dimensionHeight / 8, secondLocation.Y, secondLocation.Z); upRightLine.EndPoint = new Vector3f(secondLocation.X + 7 * dimensionHeight / 8 - 0.2f, secondLocation.Y - 0.2f, secondLocation.Z); downRightLine.StartPoint = new Vector3f(secondLocation.X + 7 * dimensionHeight / 8, secondLocation.Y, secondLocation.Z); downRightLine.EndPoint = new Vector3f(secondLocation.X + 7 * dimensionHeight / 8 + 0.2f, secondLocation.Y - 0.2f, secondLocation.Z); rightLine.StartPoint = new Vector3f(secondLocation.X + 7 * dimensionHeight / 8, secondLocation.Y, secondLocation.Z); rightLine.EndPoint = new Vector3f(secondLocation.X + 7 * dimensionHeight / 8, secondLocation.Y - Math.Abs(firstLocation.Y - secondLocation.Y) / 2 + textWidth / 2, secondLocation.Z); numWidth = secondLocation.Y - firstLocation.Y; strNumWidth = "" + numWidth; strText.BasePoint=new Vector3f(firstLocation.X + 7 * dimensionHeight / 8, firstLocation.Y + Math.Abs(firstLocation.Y - secondLocation.Y) / 2 - textWidth / 2+0.2f, firstLocation.Z); strText.Height=0.5f; strText.Value=strNumWidth; } doc.AddEntity(line1); doc.AddEntity(line2); doc.AddEntity(leftLine); doc.AddEntity(rightLine); doc.AddEntity(upLeftLine); doc.AddEntity(downLeftLine); doc.AddEntity(upRightLine); doc.AddEntity(downRightLine); doc.AddEntity(strText); }
public static void assembleDetailMechine(List<PictureBoxInfo> imageNameList,DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth,string upOrDownLayer) { //List<Location> storeLocationList = new List<Location>(); if (storeLocationList.Count > 0) { storeLocationList.Clear(); } for (int i = 0; i < imageNameList.Count; i++) { string imageName=imageNameList.ElementAt(i).name; if (imageName.Equals("FTA") || imageName.Equals("FTC") || imageName.Equals("FTF") || imageName.Equals("FTH")) { if (i == 0) { DoorRectangle.writeWholeSingleDoor(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeSingleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.sinlgeheight, DoorInitHeightAndWidth.singlewidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.singlewidth, currentLocation.Y, currentLocation.Z)); } } else if(imageName.Equals("MBA")||imageName.Equals("MBB")||imageName.Equals("MBC")||imageName.Equals("MBD")||imageName.Equals("MBE")||imageName.Equals("MBF")||imageName.Equals("MBG")||imageName.Equals("MBH")||imageName.Equals("MBI")||imageName.Equals("MBJ")||imageName.Equals("MBK")) { if (i == 0) { DoorRectangle.writeWholeMachine(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeMachine(dxf, currentLocation, text, DoorInitHeightAndWidth.doubleheight, DoorInitHeightAndWidth.doublewidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.doublewidth, currentLocation.Y, currentLocation.Z)); } } else if(imageName.Equals("PHA")||imageName.Equals("PHB")||imageName.Equals("PHC")||imageName.Equals("PHD")) { if (i == 0) { DoorRectangle.writeWholeDoubleDoor(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeDoubleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.doubledoorheigt, DoorInitHeightAndWidth.doubledoorwidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.doubledoorwidth, location.Y, location.Z)); } } else if (imageName.Equals("HRA")) { if (i == 0) { DoorRectangle.writeWholeSingleDoor(dxf, location, text, 2*height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeSingleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.sinlgeheight*2, DoorInitHeightAndWidth.singlewidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.singlewidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("virtualHRA")) { if (i == 0) { // DoorRectangle.writeWholeSingleDoor(dxf, location, text, 2 * height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); // DoorRectangle.writeWholeSingleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.sinlgeheight * 2, DoorInitHeightAndWidth.singlewidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.singlewidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("CLB") || imageName.Equals("CLC") || imageName.Equals("CLF") || imageName.Equals("CLG") || imageName.Equals("CLI") || imageName.Equals("CLM")) { if (i == 0) { DoorRectangle.writeWholeDoubleDoor(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeDoubleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.doubledoorheigt, DoorInitHeightAndWidth.doubledoorwidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.doubledoorwidth, location.Y, location.Z)); } } else if (imageName.Equals("PEA") || imageName.Equals("PEC") || imageName.Equals("RFA") || imageName.Equals("SFA") || imageName.Equals("SFC") || imageName.Equals("SFD")) { if (i == 0) { DoorRectangle.writeWholeDoubleDoor(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeDoubleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.doubledoorheigt, DoorInitHeightAndWidth.doubledoorwidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.doubledoorwidth, location.Y, location.Z)); } } else if (imageName.Equals("BBA") || imageName.Equals("BBB") || imageName.Equals("BBC") || imageName.Equals("BBD") || imageName.Equals("BBE")) { if (i == 0) { DoorRectangle.writeWholeDoubleDoor(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeDoubleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.doubledoorheigt, DoorInitHeightAndWidth.doubledoorwidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.doubledoorwidth, location.Y, location.Z)); } } else if (imageName.Equals("TRA") || imageName.Equals("TRB") || imageName.Equals("TRC") || imageName.Equals("TRD") || imageName.Equals("TRE")) { if (i == 0) { DoorRectangle.writeWholeDoubleDoor(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeWholeDoubleDoor(dxf, currentLocation, text, DoorInitHeightAndWidth.doubledoorheigt, DoorInitHeightAndWidth.doubledoorwidth, outer_mid_space, outer_in_space, barHeight, barWidth, upOrDownLayer); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.doubledoorwidth, location.Y, location.Z)); } } } //画标注 Location firstLocation=location; Location secondLocation=new Location(location.X,location.Y+6,location.Z); DoorRectangle.writeDimension(dxf, location, secondLocation, 16, 3, 8, "left"); DoorRectangle.writeDimension(dxf, secondLocation, new Location(secondLocation.X, secondLocation.Y + 32, secondLocation.Z), 16, 3, 8, "left"); }
//上下层组装和单层组装函数 public static void assembleDetailMechine(List<PictureBoxInfo> imageNameList, DxfDocument dxf, Location location, DetailMechineConfigure dmc,int coolingType) { if (isTwoLayers(imageNameList)) { List<PictureBoxInfo> oneImageNameList = new List<PictureBoxInfo>(); List<PictureBoxInfo> twoImageNameList = new List<PictureBoxInfo>(); for (int i = 0, len = imageNameList.Count; i < len; i++) { if (i == 0) { if (imageNameList.ElementAt(i).name.Equals("HRA")) { //这里的virtralPictrueBox和realPictureBox中设置的Y坐标只是为后面onelist和twolist判断是其作用,其他没什么实质作用 PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); virtualPictureBox.name = "virtualHRA"; //主要为了记录虚拟的框的坐标,为了画dxf是提供依据 //virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y + 113 + 4, imageNameList.ElementAt(i).location.Z); virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y, imageNameList.ElementAt(i).location.Z); oneImageNameList.Add(virtualPictureBox); PictureBoxInfo realPictureBox = new PictureBoxInfo(); realPictureBox.name = imageNameList.ElementAt(i).name; realPictureBox.location = new Location(imageNameList.ElementAt(i).location.X,imageNameList.ElementAt(i).location.Y+113+4,imageNameList.ElementAt(i).location.Z); twoImageNameList.Add(realPictureBox); } else { oneImageNameList.Add(imageNameList.ElementAt(i)); } } else { if (oneImageNameList.ElementAt(0).location.Y == imageNameList.ElementAt(i).location.Y) { if (imageNameList.ElementAt(i).name.Equals("HRA")) { PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); virtualPictureBox.name = "virtualHRA"; virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y + 113 + 4, imageNameList.ElementAt(i).location.Z); oneImageNameList.Add(virtualPictureBox); twoImageNameList.Add(imageNameList.ElementAt(i)); } else { oneImageNameList.Add(imageNameList.ElementAt(i)); } } else { if (imageNameList.ElementAt(i).name.Equals("HRA")) { PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); virtualPictureBox.name = "virtualHRA"; virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y + 113 + 4, imageNameList.ElementAt(i).location.Z); twoImageNameList.Add(virtualPictureBox); oneImageNameList.Add(imageNameList.ElementAt(i)); } else { twoImageNameList.Add(imageNameList.ElementAt(i)); } } } } //判断上下层进行判断 if (oneImageNameList.Count > 0 && twoImageNameList.Count > 0) { //这里的location.Y 是前台组图的Y坐标,他和dxf的启示坐标刚好相反,在左上角 if (oneImageNameList.ElementAt(0).location.Y <twoImageNameList.ElementAt(0).location.Y) { //下层 assembleDetailMechine(twoImageNameList, dxf, location, dmc.text, dmc.height, dmc.width,dmc.outer_mid_space,dmc.outer_in_space, dmc.barHeight, dmc.barWidth,"downLayer"); writeTopOrBottomDimension(storeLocationList,dxf,"bottom"); writeRightDimension(storeLocationList, dxf, dmc.height, "rightDownLayer"); //上层 Location upLocation = TotalWidthAndHeight.getUpLayerLocation(twoImageNameList, oneImageNameList, coolingType); assembleDetailMechine(oneImageNameList, dxf, new Location(location.X+upLocation.X,location.Y+upLocation.Y,location.Z), dmc.text, dmc.height, dmc.width, dmc.outer_mid_space,dmc.outer_in_space, dmc.barHeight, dmc.barWidth,"upLayer"); writeRightDimension(storeLocationList, dxf, dmc.height, "rightUpLayer"); } else { //下层 assembleDetailMechine(oneImageNameList, dxf, location, dmc.text, dmc.height, dmc.width, dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth,"upLayer"); writeTopOrBottomDimension(storeLocationList, dxf, "bottom"); writeRightDimension(storeLocationList, dxf, dmc.height, "rightDownLayer"); //上层 Location upLocation = TotalWidthAndHeight.getUpLayerLocation(oneImageNameList,twoImageNameList, coolingType); assembleDetailMechine(twoImageNameList, dxf, new Location(location.X + upLocation.X, location.Y + upLocation.Y, location.Z), dmc.text, dmc.height, dmc.width, dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth,"upLayer"); writeRightDimension(storeLocationList, dxf, dmc.height, "rightUpLayer"); } } } //单层情况 else { assembleDetailMechine(imageNameList, dxf, location, dmc.text, dmc.height, dmc.width, dmc.outer_mid_space,dmc.outer_in_space, dmc.barHeight, dmc.barWidth,"downLayer"); writeTopOrBottomDimension(storeLocationList, dxf, "bottom"); writeRightDimension(storeLocationList, dxf, dmc.height, "rightDownLayer"); } }
public static void assembleTopView(List<PictureBoxInfo> imageNameList, DxfDocument dxf, Location location, TopViewConfigure tvc) { if (AssembleDetailMechine.isTwoLayers(imageNameList)) { List<PictureBoxInfo> oneImageNameList = new List<PictureBoxInfo>(); List<PictureBoxInfo> twoImageNameList = new List<PictureBoxInfo>(); for (int i = 0, len = imageNameList.Count; i < len; i++) { if (i == 0) { if (imageNameList.ElementAt(i).name.Equals("HRA")) { //这里的virtralPictrueBox和realPictureBox中设置的Y坐标只是为后面onelist和twolist判断是其作用,其他没什么实质作用 PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); virtualPictureBox.name = "virtualHRA"; //主要为了记录虚拟的框的坐标,为了画dxf是提供依据 //virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y + 113 + 4, imageNameList.ElementAt(i).location.Z); virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y, imageNameList.ElementAt(i).location.Z); oneImageNameList.Add(virtualPictureBox); PictureBoxInfo realPictureBox = new PictureBoxInfo(); realPictureBox.name = imageNameList.ElementAt(i).name; realPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y + 113 + 4, imageNameList.ElementAt(i).location.Z); twoImageNameList.Add(realPictureBox); } else { oneImageNameList.Add(imageNameList.ElementAt(i)); } } else { if (oneImageNameList.ElementAt(0).location.Y == imageNameList.ElementAt(i).location.Y) { if (imageNameList.ElementAt(i).name.Equals("HRA")) { PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); virtualPictureBox.name = "virtualHRA"; virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y + 113 + 4, imageNameList.ElementAt(i).location.Z); oneImageNameList.Add(virtualPictureBox); twoImageNameList.Add(imageNameList.ElementAt(i)); } else { oneImageNameList.Add(imageNameList.ElementAt(i)); } } else { if (imageNameList.ElementAt(i).name.Equals("HRA")) { PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); virtualPictureBox.name = "virtualHRA"; virtualPictureBox.location = new Location(imageNameList.ElementAt(i).location.X, imageNameList.ElementAt(i).location.Y + 113 + 4, imageNameList.ElementAt(i).location.Z); twoImageNameList.Add(virtualPictureBox); oneImageNameList.Add(imageNameList.ElementAt(i)); } else { twoImageNameList.Add(imageNameList.ElementAt(i)); } } } } if (oneImageNameList.Count > twoImageNameList.Count) { assembleTopView(oneImageNameList, dxf, location, tvc.text, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth); } else { assembleTopView(twoImageNameList, dxf, location, tvc.text, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth); } } else { assembleTopView(imageNameList, dxf, location, tvc.text, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth); } }
public static void assembleTopView(List<PictureBoxInfo> imageNameList, DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth) { List<Location> storeLocationList = new List<Location>(); for (int i = 0; i < imageNameList.Count; i++) { string imageName = imageNameList.ElementAt(i).name; if (imageName.Equals("FTA") || imageName.Equals("FTC") || imageName.Equals("FTF") || imageName.Equals("FTH")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvSinlgeHeight, DoorInitHeightAndWidth.tvSingleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvSingleWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("MBA") || imageName.Equals("MBB") || imageName.Equals("MBC") || imageName.Equals("MBD") || imageName.Equals("MBE") || imageName.Equals("MBF") || imageName.Equals("MBG") || imageName.Equals("MBH") || imageName.Equals("MBI") || imageName.Equals("MBJ") || imageName.Equals("MBK")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); ; DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvDoubleHeight, DoorInitHeightAndWidth.tvDoubleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvDoubleWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("PHA") || imageName.Equals("PHB") || imageName.Equals("PHC") || imageName.Equals("PHD")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); ; DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvDoubleDoorHeigt, DoorInitHeightAndWidth.tvDoubleDoorWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvDoubleDoorWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("HRA")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvSinlgeHeight, DoorInitHeightAndWidth.tvSingleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvSingleWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("virtualHRA")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvSinlgeHeight, DoorInitHeightAndWidth.tvSingleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvSingleWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("CLB") || imageName.Equals("CLC") || imageName.Equals("CLF") || imageName.Equals("CLG") || imageName.Equals("CLI") || imageName.Equals("CLM")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvSinlgeHeight, DoorInitHeightAndWidth.tvSingleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvSingleWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("PEA") || imageName.Equals("PEC") || imageName.Equals("RFA") || imageName.Equals("SFA") || imageName.Equals("SFC") || imageName.Equals("SFD")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvSinlgeHeight, DoorInitHeightAndWidth.tvSingleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvSingleWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("BBA") || imageName.Equals("BBB") || imageName.Equals("BBC") || imageName.Equals("BBD") || imageName.Equals("BBE")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvSinlgeHeight, DoorInitHeightAndWidth.tvSingleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvSingleWidth, currentLocation.Y, currentLocation.Z)); } } else if (imageName.Equals("TRA") || imageName.Equals("TRB") || imageName.Equals("TRC") || imageName.Equals("TRD") || imageName.Equals("TRE")) { if (i == 0) { DoorRectangle.writeTopViewRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space); storeLocationList.Add(location); storeLocationList.Add(new Location(location.X + width, location.Y, location.Z)); } else { Location currentLocation = storeLocationList.ElementAt(i); DoorRectangle.writeTopViewRectangle(dxf, currentLocation, text, DoorInitHeightAndWidth.tvSinlgeHeight, DoorInitHeightAndWidth.tvSingleWidth, outer_mid_space, outer_in_space); storeLocationList.Add(new Location(currentLocation.X + DoorInitHeightAndWidth.tvSingleWidth, currentLocation.Y, currentLocation.Z)); } } } //画标注 Location firstLocation = storeLocationList.ElementAt(0); DoorRectangle.writeDimension(dxf, new Location(firstLocation.X, firstLocation.Y - outer_in_space, firstLocation.Z), firstLocation, 16f, 1f, 5, "left"); DoorRectangle.writeDimension(dxf, firstLocation, new Location(firstLocation.X, firstLocation.Y + 5, firstLocation.Z), 16f, 1f, 5, "left"); DoorRectangle.writeDimension(dxf, new Location(firstLocation.X, firstLocation.Y + 5, firstLocation.Z), new Location(firstLocation.X, firstLocation.Y + 45, firstLocation.Z), 16f, 1f, 8, "left"); //top Location lastLocation = storeLocationList.ElementAt(storeLocationList.Count - 1); DoorRectangle.writeDimension(dxf, new Location(firstLocation.X, firstLocation.Y + height, firstLocation.Z), new Location(lastLocation.X, lastLocation.Y + height, firstLocation.Z), 16f, 1f, 10, "top"); //right DoorRectangle.writeDimension(dxf, new Location(lastLocation.X, lastLocation.Y + 10, firstLocation.Z), new Location(lastLocation.X, lastLocation.Y + 40, firstLocation.Z), 16f, 1f, 5f, "right"); DoorRectangle.writeDimension(dxf, new Location(lastLocation.X, lastLocation.Y, firstLocation.Z), new Location(lastLocation.X, lastLocation.Y + 10, firstLocation.Z), 16f, 1f, 5f, "right"); DoorRectangle.writeDimension(dxf, new Location(lastLocation.X, lastLocation.Y, firstLocation.Z), new Location(lastLocation.X, lastLocation.Y + height, firstLocation.Z), 16f, 1f, 10f, "right"); DoorRectangle.writeDimension(dxf, new Location(lastLocation.X, lastLocation.Y - 6, firstLocation.Z), new Location(lastLocation.X, lastLocation.Y, firstLocation.Z), 16f, 1f, 10f, "right"); DoorRectangle.writeDimension(dxf, new Location(lastLocation.X, lastLocation.Y - 6, firstLocation.Z), new Location(lastLocation.X, lastLocation.Y + height + outer_in_space, firstLocation.Z), 16f, 1f, 14f, "right"); }
public TopViewConfigure getTopViewConfigure(List<PictureBoxInfo> pictureBoxNameList, DxfDocument dxf, Location location) { return new TopViewConfigure(pictureBoxNameList, dxf, null, 50.0f, 18.0f, 2.0f, 2.86f, 2.0f, 2.0f); }
//最外围矩形 public static void writeOuterDoorRectangle(DxfDocument doc, Location location,float height, float width) { //最外围矩形 Layer doorRectangleLayer = new Layer("DoorRectangleLayer"); Line outerBottomLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X + width, location.Y, location.Z)); outerBottomLine.Layer = doorRectangleLayer; Line outerLeftLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X, location.Y + height, location.Z)); outerLeftLine.Layer = doorRectangleLayer; Line outerTopLine = new Line(new Vector3f(location.X, location.Y + height, location.Z), new Vector3f(location.X + width, location.Y + height, location.Z)); outerTopLine.Layer = doorRectangleLayer; Line outerRightLine = new Line(new Vector3f(location.X + width, location.Y + height, location.Z), new Vector3f(location.X + width, location.Y, location.Z)); outerRightLine.Layer = doorRectangleLayer; doc.AddEntity(outerBottomLine); doc.AddEntity(outerLeftLine); doc.AddEntity(outerTopLine); doc.AddEntity(outerRightLine); }
/// <summary> /// 门把手绘制 /// </summary> /// <param name="dxf"></param> /// <param name="location"></param> public static void Draw(DxfDocument dxf, Location location) { float factor = 0.05f; float distance = 30; //底部小圆的圆心 Vector3f sCircle = new Vector3f(location.X + 10 * factor, location.Y, location.Z); //上部同心圆圆心 Vector3f bCircle = new Vector3f(location.X + 10 * factor, location.Y + 5 * factor + distance*factor, location.Z); double alpha = Math.Asin(3 / distance); double beta = Math.Acos(0.8); Vector3f v1 = new Vector3f( location.X + 10 * factor - float.Parse((5 * factor * Math.Cos(alpha)).ToString()), location.Y + 5 * factor - float.Parse((5 * factor * Math.Sin(alpha)).ToString()), location.Z); Vector3f v2 = new Vector3f( location.X + 10 * factor + float.Parse((5 * factor * Math.Cos(alpha)).ToString()), location.Y + 5 * factor - float.Parse((5 * factor * Math.Sin(alpha)).ToString()), location.Z); Vector3f v4 = new Vector3f( location.X + 10 * factor -float.Parse((8*factor* Math.Cos(alpha)).ToString()), location.Y + 5 * factor + distance * factor - float.Parse((8 * factor * Math.Sin(alpha)).ToString()), location.Z ); Vector3f v5 = new Vector3f( location.X + 10 * factor + float.Parse((8*factor*Math.Cos(alpha)).ToString()), location.Y + 5 * factor + distance * factor - float.Parse((8 * factor * Math.Sin(alpha)).ToString()), location.Z ); Layer layer = new Layer("line"); Line line14 = new Line(v1, v4); line14.Layer = layer; line14.Layer.Color.Index = 6; dxf.AddEntity(line14); Line line25 = new Line(v2, v5); line25.Layer = new Layer("line"); line25.Layer = layer; dxf.AddEntity(line25); //arc Arc arc = new Arc( new Vector3f(location.X + 10 * factor, location.Y + 5 * factor, location.Z), 5 * factor, Convert.ToInt32(180 + alpha * 180 / Math.PI), Convert.ToInt32(360 - alpha * 180 / Math.PI)); arc.Layer = layer; dxf.AddEntity(arc); //arcup Arc arcup = new Arc( new Vector3f(location.X + 10 * factor, location.Y + 5 * factor + distance * factor, location.Z), 8 * factor, Convert.ToInt32(-alpha * 180 / Math.PI), Convert.ToInt32(180 + alpha * 180 / Math.PI)); arcup.Layer = layer; dxf.AddEntity(arcup); //arcround Arc arcround = new Arc( new Vector3f(location.X + 10 * factor, location.Y + 5 * factor + distance * factor, location.Z), 10 * factor, Convert.ToInt32(-(alpha +beta) * 180 / Math.PI), Convert.ToInt32(180 + (alpha +beta) * 180 / Math.PI)); arcround.Layer = layer; dxf.AddEntity(arcround); //circle Vector3f extrusion = new Vector3f(0, 0, 1); Vector3f centerWCS = new Vector3f(location.X+10*factor, location.Y+5*factor+distance*factor, location.Z); Vector3d centerOCS = MathHelper.Transform((Vector3d)centerWCS, (Vector3d)extrusion, MathHelper.CoordinateSystem.World, MathHelper.CoordinateSystem.Object); Circle circle = new Circle((Vector3f)centerOCS, 7*factor); circle.Layer = layer; circle.LineType = LineType.Continuous; circle.Normal = extrusion; dxf.AddEntity(circle); //上部同心圆圆心 Vector3f t1 = new Vector3f( location.X + 8 * factor, location.Y + 5 * factor + (distance - 7) * factor * 0.7f, location.Z); Vector3f t2 = new Vector3f( location.X + 8 * factor, location.Y + 5 * factor + (distance - 7) * factor * 0.5f, location.Z); Vector3f t3 = new Vector3f( location.X + 8 * factor, location.Y + 5 * factor + (distance - 7) * factor * 0.3f, location.Z); Vector3f t4 = new Vector3f( location.X + 8 * factor, location.Y + 5 * factor + (distance - 7) * factor * 0.1f, location.Z); //text TextStyle style = new TextStyle("True type font", "Arial.ttf"); Text text1 = new Text("A", t1, 0.2f, style); text1.Layer = layer; text1.Alignment = TextAlignment.TopLeft; dxf.AddEntity(text1); //text Text text2 = new Text("A", t2, 0.2f, style); text2.Layer = layer; text2.Alignment = TextAlignment.TopLeft; dxf.AddEntity(text2); //text Text text3 = new Text("O", t3, 0.2f, style); text3.Layer = layer; text3.Alignment = TextAlignment.TopLeft; dxf.AddEntity(text3); //text Text text4 = new Text("N", t4, 0.2f, style); text4.Layer = layer; text4.Alignment = TextAlignment.TopLeft; dxf.AddEntity(text4); }
//画表示门闩的小矩形 public static void writeRepresentDoorBarRectangle(DxfDocument doc, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth) { Layer representDoorBarRectangleLayer = new Layer("RepresentDoorBarRectangle"); Line bottomLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X + barWidth, location.Y, location.Z)); bottomLine.Layer = representDoorBarRectangleLayer; Line leftLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X, location.Y + barHeight, location.Z)); leftLine.Layer = representDoorBarRectangleLayer; Line topLine = new Line(new Vector3f(location.X, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth, location.Y + barHeight, location.Z)); topLine.Layer = representDoorBarRectangleLayer; Line rightLine = new Line(new Vector3f(location.X + barWidth, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth, location.Y, location.Z)); rightLine.Layer = representDoorBarRectangleLayer; //内部折线 Line upLine = new Line(new Vector3f(location.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, location.Y + barHeight / 2, location.Z)); upLine.Layer = representDoorBarRectangleLayer; Line midLine = new Line(new Vector3f(location.X + barWidth / 2 - (outer_in_space - outer_mid_space) / 2, location.Y + barHeight / 2, location.Z), new Vector3f(location.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2,location.Y+barHeight/2,location.Z)); midLine.Layer = representDoorBarRectangleLayer; Line downLine = new Line(new Vector3f(location.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2, location.Y + barHeight / 2, location.Z), new Vector3f(location.X+barWidth/2+(outer_in_space-outer_mid_space)/2, location.Y, location.Z)); downLine.Layer = representDoorBarRectangleLayer; doc.AddEntity(bottomLine); doc.AddEntity(leftLine); doc.AddEntity(topLine); doc.AddEntity(rightLine); doc.AddEntity(upLine); doc.AddEntity(midLine); doc.AddEntity(downLine); }