using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
|
using WW.Cad.Base;
|
using WW.Cad.Drawing;
|
using WW.Cad.Drawing.GDI;
|
using WW.Cad.IO;
|
using WW.Cad.Model;
|
using WW.Math;
|
using WW.Cad.Model.Entities;
|
using WW.Actions;
|
using WW.Cad.Model.Tables;
|
using WW.Cad.Model.Objects;
|
|
namespace TProduct.PumpGraph.Dxf
|
{
|
public partial class LxpFeatChart10
|
{
|
private DxfText GetRatedFrameDxfText(double text, double y, string type)
|
{
|
if (text < 2)
|
{
|
text = Math.Round(text, 3);
|
}
|
else if (text < 10)
|
{
|
text = Math.Round(text, 2);
|
}
|
else if (text < 100)
|
{
|
text = Math.Round(text, 1);
|
}
|
else
|
{
|
text = Math.Round(text, 0);
|
}
|
double x = 625;
|
if (type == "NPSH")
|
{
|
x = 625 + 385 - 21;
|
}
|
else if (type == "E")
|
{
|
x = 625 + 310 - 21;
|
}
|
else if (type == "P")
|
{
|
x = 612 + 195 - 21;
|
}
|
else if (type == "N")
|
{
|
x = 625 + 105 - 21;
|
}
|
else if (type == "H")
|
{
|
x = 625 + 55 - 21;
|
}
|
else if (type == "Q")
|
{
|
x = 625 - 21;
|
}
|
string strAff = "";
|
if (type == "E")
|
{
|
strAff = "%";
|
}
|
//
|
double text_height = 11;
|
string strInfo = text.ToString();
|
DxfText txtLabel = null;
|
if (strInfo.Length == 1)
|
{
|
txtLabel = new DxfText(string.Format("{0}{1}", text, strAff), new Point3D(x + 8, y, 0d), text_height);
|
}
|
if (strInfo.Length == 2)
|
{
|
txtLabel = new DxfText(string.Format("{0}{1}", text, strAff), new Point3D(x + 6, y, 0d), text_height);
|
}
|
if (strInfo.Length == 3)
|
{
|
txtLabel = new DxfText(string.Format("{0}{1}", text, strAff), new Point3D(x + 4, y, 0d), text_height);
|
}
|
if (strInfo.Length == 4)
|
{
|
txtLabel = new DxfText(string.Format("{0}{1}", text, strAff), new Point3D(x + 2, y, 0d), text_height);
|
}
|
else
|
{
|
txtLabel = new DxfText(string.Format("{0}{1}", text, strAff), new Point3D(x, y, 0d), text_height);
|
}
|
|
txtLabel.Thickness = 0.4d;
|
if (this._frameTextFont != null)
|
txtLabel.Style = _frameTextFont;
|
txtLabel.Color = _frameTextColor;
|
txtLabel.Height = 8;
|
_dxfFileModel.Entities.Add(txtLabel);
|
return txtLabel;
|
}
|
|
//显示了一行
|
private void DrawViscoInfo ()
|
{
|
if (this._jieZhiInfo != null && this._jieZhiInfo.VisoCorrectCoeff != null)
|
{
|
StringBuilder sb = new StringBuilder();
|
sb.AppendFormat(string.Format(" {0} : {1}", "流量粘度修正系数", this._jieZhiInfo.VisoCorrectCoeff.KQ.ToString("0.000")));
|
sb.AppendFormat(string.Format(" {0} : {1}", "扬程粘度修正系数", this._jieZhiInfo.VisoCorrectCoeff.KH_Q10.ToString("0.000")));
|
sb.AppendFormat(string.Format(" {0} : {1}", "效率粘度修正系数", this._jieZhiInfo.VisoCorrectCoeff.KE.ToString("0.000")));
|
var txtLabelQ = new DxfText(sb.ToString(), new Point3D(255, 945, 0d), 10);
|
txtLabelQ.Thickness = 0.4d;
|
if (this._frameTextFont != null)
|
txtLabelQ.Style = _frameTextFont;
|
txtLabelQ.Height = 10;
|
_dxfFileModel.Entities.Add(txtLabelQ);
|
|
|
|
//格子线
|
var v_line_pt_s = new Point2D(230, 967);
|
var v_line_pt_e = new Point2D(230, 967-30);
|
var v_line = new DxfLine(v_line_pt_s, v_line_pt_e);
|
v_line.LineWeight = 5;
|
_dxfFileModel.Entities.Add(v_line);
|
|
var h_line_pt_s_1 = new Point2D(230, 937);
|
var h_line_pt_e_1 = new Point2D(680, 937);
|
var h_line_1 = new DxfLine(h_line_pt_s_1, h_line_pt_e_1);
|
h_line_1.LineWeight = 5;
|
_dxfFileModel.Entities.Add(h_line_1);
|
|
|
|
}
|
}
|
|
|
//显示了三行
|
private void DrawViscoInfo3Line()
|
{
|
if (this._jieZhiInfo != null && this._jieZhiInfo.VisoCorrectCoeff != null)
|
{
|
|
var txtLabelQ = new DxfText(string.Format("{0} : {1}", "流量粘度修正系数", this._jieZhiInfo.VisoCorrectCoeff.KQ.ToString("0.000")), new Point3D(555, 945, 0d), 8);
|
txtLabelQ.Thickness = 0.4d;
|
if (this._frameTextFont != null)
|
txtLabelQ.Style = _frameTextFont;
|
txtLabelQ.Color = _frameTextColor;
|
txtLabelQ.Height = 10;
|
_dxfFileModel.Entities.Add(txtLabelQ);
|
|
var txtLabelH = new DxfText(string.Format("{0} : {1}", "扬程粘度修正系数", this._jieZhiInfo.VisoCorrectCoeff.KH_Q10.ToString("0.000")), new Point3D(555, 920, 0d), 8);
|
txtLabelH.Thickness = 0.4d;
|
if (this._frameTextFont != null)
|
txtLabelH.Style = _frameTextFont;
|
txtLabelH.Color = _frameTextColor;
|
txtLabelH.Height = 10;
|
_dxfFileModel.Entities.Add(txtLabelH);
|
|
var txtLabelE = new DxfText(string.Format("{0} : {1}", "效率粘度修正系数", this._jieZhiInfo.VisoCorrectCoeff.KE.ToString("0.000")), new Point3D(555, 895, 0d), 8);
|
txtLabelE.Thickness = 0.4d;
|
if (this._frameTextFont != null)
|
txtLabelE.Style = _frameTextFont;
|
txtLabelE.Color = _frameTextColor;
|
txtLabelE.Height = 10;
|
_dxfFileModel.Entities.Add(txtLabelE);
|
|
//格子线
|
var v_line_pt_s = new Point2D(547, 967);
|
var v_line_pt_e = new Point2D(547, 888);
|
var v_line = new DxfLine(v_line_pt_s, v_line_pt_e);
|
v_line.Color = _frameTextColor;
|
_dxfFileModel.Entities.Add(v_line);
|
|
var h_line_pt_s_1 = new Point2D(547, 938);
|
var h_line_pt_e_1 = new Point2D(680, 938);
|
var h_line_1 = new DxfLine(h_line_pt_s_1, h_line_pt_e_1);
|
h_line_1.Color = _frameTextColor;
|
_dxfFileModel.Entities.Add(h_line_1);
|
|
|
var h_line_pt_s_2 = new Point2D(547, 938 - 25);
|
var h_line_pt_e_2 = new Point2D(680, 938 - 25);
|
var h_line_2 = new DxfLine(h_line_pt_s_2, h_line_pt_e_2);
|
h_line_2.Color = _frameTextColor;
|
_dxfFileModel.Entities.Add(h_line_2);
|
|
var h_line_pt_s_3 = new Point2D(547, 938 - 50);
|
var h_line_pt_e_3 = new Point2D(680, 938 - 50);
|
var h_line_3 = new DxfLine(h_line_pt_s_3, h_line_pt_e_3);
|
h_line_3.Color = _frameTextColor;
|
_dxfFileModel.Entities.Add(h_line_3);
|
}
|
}
|
|
|
|
//标题栏(替换)
|
private void DrawFrameTtileText_Relplace()
|
{
|
if (this._dwgObjectDict == null)
|
_dwgObjectDict = new Dictionary<string,string>();
|
|
Dictionary<string, string> dictFrameText = new Dictionary<string, string>();
|
dictFrameText["T_DATE"] = DateTime.Today.ToString("yyyy-MM-dd");
|
dictFrameText["T_RPM"] = this.RatedN.ToString();
|
|
if (this._dwgObjectDict.ContainsKey("ItemCode"))
|
{
|
dictFrameText["T_ITEMCODE"] = _dwgObjectDict["ItemCode"];
|
}
|
else
|
{
|
dictFrameText["T_ITEMCODE"] = "";
|
}
|
if (this._dwgObjectDict.ContainsKey("ProjectName"))
|
{
|
dictFrameText["T_PRJNAME"] = _dwgObjectDict["ProjectName"];
|
}
|
else
|
{
|
dictFrameText["T_PRJNAME"] = "";
|
}
|
if (this._dwgObjectDict.ContainsKey("ItemName"))
|
{
|
dictFrameText["T_ITEMNAME"] = _dwgObjectDict["ItemName"];
|
}
|
else
|
{
|
dictFrameText["T_ITEMNAME"] = "";
|
}
|
if (this._dwgObjectDict.ContainsKey("SelectEmployeeName"))
|
{
|
dictFrameText["T_AE"] = _dwgObjectDict["SelectEmployeeName"];
|
}
|
else
|
{
|
dictFrameText["T_AE"] = "";
|
}
|
if (this._dwgObjectDict.ContainsKey("CurrentCoprName"))
|
{
|
dictFrameText["T_CORPNAME"] = _dwgObjectDict["CurrentCoprName"];
|
}
|
else
|
{
|
dictFrameText["T_CORPNAME"] = "";
|
}
|
|
if (this._designPointStdUnit != null)
|
{
|
dictFrameText["T_WQ"] = this._designPointStdUnit.X.ToString();
|
dictFrameText["T_WH"] = this._designPointStdUnit.Y.ToString();
|
}
|
else
|
{
|
dictFrameText["T_WQ"] = "";
|
dictFrameText["T_WH"] = "";
|
}
|
if (this._workPointReal != null)
|
{
|
if (this._workPointReal.E > 0)
|
dictFrameText["T_WE"] = (Math.Round(this._workPointReal.E, 1)).ToString();
|
else
|
dictFrameText["T_WE"] = "";
|
|
if (this._workPointReal.P > 0)
|
dictFrameText["T_WP"] = (Math.Round(this._workPointReal.P, 1)).ToString();//双达功率保留1位小数
|
else
|
dictFrameText["T_WP"] = "";
|
|
if (this._workPointReal.NPSH > 0)
|
dictFrameText["T_NPSH"] = (Math.Round(this._workPointReal.NPSH, 1)).ToString("0.0");
|
else
|
dictFrameText["T_NPSH"] = " ";
|
}
|
|
if (this._dwgObjectDict.ContainsKey("入口口径"))
|
{
|
dictFrameText["T_IN"] = _dwgObjectDict["入口口径"];
|
}
|
else
|
{
|
dictFrameText["T_IN"] = "";
|
}
|
if (this._dwgObjectDict.ContainsKey("出口口径"))
|
{
|
dictFrameText["T_OUT"] = _dwgObjectDict["出口口径"];
|
}
|
else
|
{
|
dictFrameText["T_OUT"] = "";
|
}
|
|
if (this._dwgObjectDict.ContainsKey("叶轮级数"))
|
{
|
dictFrameText["T_STAGE"] = _dwgObjectDict["叶轮级数"];
|
}
|
else
|
{
|
dictFrameText["T_STAGE"] = " ";
|
}
|
|
dictFrameText["T_CURVECODE"] = this._productName;
|
|
dictFrameText["T_RO"] = "CW";
|
if (this._dwgObjectDict.ContainsKey("转向"))
|
{
|
if (_dwgObjectDict["转向"] == (Eventech.Model.eRotationDir.逆时针).ToString())
|
{
|
dictFrameText["T_RO"] = "CCW";
|
}
|
else
|
{
|
dictFrameText["T_RO"] = "CW";
|
}
|
}
|
|
|
ReplaceDictText(dictFrameText);
|
|
}
|
|
|
//标题栏(绘制)
|
private void DrawFrameTtileText_Draw()
|
{
|
|
var txtColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GreenColor;
|
_frameTextFont = _dxfFileModel.GetTextStyleWithName("HZ");//文件自带字体
|
|
//日期
|
DxfMText label_dt = new DxfMText(DateTime.Today.ToString("yyyy-MM-dd"), new Point3D(200, -164, 0d), 12);
|
label_dt.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_dt.Style = this._frameTextFont;
|
label_dt.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_dt);
|
|
|
DxfMText label_title_1 = new DxfMText("借(通)用件登记", new Point3D(-181, 24, 0d), 14);
|
label_title_1.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_1.Style = this._frameTextFont;
|
label_title_1.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_1);
|
|
DxfMText label_title_2 = new DxfMText("旧 底 图 总 号", new Point3D(-179, -113, 0d), 14);
|
label_title_2.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_2.Style = this._frameTextFont;
|
label_title_2.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_2);
|
|
|
DxfMText label_title_3 = new DxfMText("底 图 总 号", new Point3D(-180, -172, 0d), 14);
|
label_title_3.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_3.Style = this._frameTextFont;
|
label_title_3.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_3);
|
|
DxfMText label_title_4 = new DxfMText("标 记", new Point3D(-96, -193, 0d), 14);
|
label_title_4.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_4.Style = this._frameTextFont;
|
label_title_4.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_4);
|
|
DxfMText label_title_5 = new DxfMText("设 计", new Point3D(-91, -226, 0d), 14);
|
label_title_5.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_5.Style = this._frameTextFont;
|
label_title_5.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_5);
|
|
DxfMText label_title_6 = new DxfMText("校 对", new Point3D(-91, -258, 0d), 14);
|
label_title_6.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_6.Style = this._frameTextFont;
|
label_title_6.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_6);
|
|
DxfMText label_title_7 = new DxfMText("审 核", new Point3D(-91, -288, 0d), 14);
|
label_title_7.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_7.Style = this._frameTextFont;
|
label_title_7.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_7);
|
|
DxfMText label_title_8 = new DxfMText("工 艺", new Point3D(-91, -319, 0d), 14);
|
label_title_8.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_8.Style = this._frameTextFont;
|
label_title_8.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_8);
|
|
|
DxfMText label_title_9 = new DxfMText("处 数", new Point3D(-52, -195, 0d), 14);
|
label_title_9.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_9.Style = this._frameTextFont;
|
label_title_9.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_9);
|
|
DxfMText label_title_10 = new DxfMText("分 区", new Point3D(6, -193, 0d), 14);
|
label_title_10.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_10.Style = this._frameTextFont;
|
label_title_10.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_10);
|
|
DxfMText label_title_11 = new DxfMText("更改文件号", new Point3D(76, -196, 0d), 14);
|
label_title_11.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_11.Style = this._frameTextFont;
|
label_title_11.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_11);
|
|
|
DxfMText label_title_12 = new DxfMText("标准化", new Point3D(87, -228, 0d), 14);
|
label_title_12.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_12.Style = this._frameTextFont;
|
label_title_12.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_12);
|
|
DxfMText label_title_13 = new DxfMText("批 准", new Point3D(87, -321, 0d), 14);
|
label_title_13.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_13.Style = this._frameTextFont;
|
label_title_13.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_13);
|
|
DxfMText label_title_14 = new DxfMText("签 名", new Point3D(141, -196, 0d), 14);
|
label_title_14.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_14.Style = this._frameTextFont;
|
label_title_14.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_14);
|
|
DxfMText label_title_15 = new DxfMText("年、月、日", new Point3D(202, -195, 0d), 14);
|
label_title_15.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_15.Style = this._frameTextFont;
|
label_title_15.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_15);
|
|
DxfMText label_title_16 = new DxfMText("质 量", new Point3D(380, -236, 0d), 14);
|
label_title_16.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_16.Style = this._frameTextFont;
|
label_title_16.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_16);
|
|
DxfMText label_title_17 = new DxfMText("比 例", new Point3D(432, -236, 0d), 14);
|
label_title_17.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_17.Style = this._frameTextFont;
|
label_title_17.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_17);
|
|
|
DxfMText label_title_18 = new DxfMText("上海连成(集团)有限公司", new Point3D(578, -128, 0d), 30);
|
label_title_18.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_title_18.Style = this._frameTextFont;
|
label_title_18.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_title_18);
|
|
|
if (!string.IsNullOrEmpty(this.ProductName))
|
{
|
DxfMText label_dp_1 = new DxfMText(this.ProductName, new Point3D(343, -145, 0d), 25);
|
label_dp_1.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_dp_1.Style = this._frameTextFont;
|
label_dp_1.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_dp_1);
|
|
DxfMText label_dp_2 = new DxfMText(this.ProductName, new Point3D(11, 915, 0d), 20);
|
label_dp_2.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (this._frameTextFont != null)
|
label_dp_2.Style = this._frameTextFont;
|
label_dp_2.Color = txtColor;
|
_dxfFileModel.Entities.Add(label_dp_2);
|
}
|
|
//设计员签名
|
if (!string.IsNullOrEmpty(_designUserDrawSignal))
|
{
|
DxfMText axisLabel_Signal = new DxfMText(_designUserDrawSignal, new Point3D(137, -163, 0d), 12);
|
axisLabel_Signal.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (_frameTextFont != null)
|
axisLabel_Signal.Style = _frameTextFont;
|
axisLabel_Signal.Color = txtColor;
|
_dxfFileModel.Entities.Add(axisLabel_Signal);
|
}
|
|
//if (this._dwgObjectDict != null && this._dwgObjectDict.ContainsKey("CustomerName"))
|
//{
|
// label_dp = new DxfMText(_dwgObjectDict["CustomerName"], new Point3D(130, -278, 0d), 15);
|
// label_dp.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
// if (this._frameTextFont != null)
|
// label_dp.Style = this._frameTextFont;
|
// label_dp.Color = txtColor;
|
// _dxfFileModel.Entities.Add(label_dp);
|
//}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
}
|