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 LxpFeatChart6
|
{
|
private DxfMText CreateFrameDxfText(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);
|
}
|
|
string strAff = "";
|
//if (type == "E")//2020-02-24要求去掉
|
//{
|
// strAff = " %";
|
//}
|
//if (type == "NPSH")
|
//{
|
// strAff = " m";
|
//}
|
string strInfo = string.Format("{0}{1}", text, strAff);
|
return CreateFrameDxfText(strInfo, y, type);
|
}
|
|
private DxfMText CreateFrameDxfText(string text, double y, string type)
|
{
|
double x = -30;
|
if (type == "NPSH")
|
{
|
x = 295;
|
}
|
else if (type == "E")
|
{
|
x = 243;
|
}
|
else if (type == "P")
|
{
|
x = 135;
|
}
|
else if (type == "N")
|
{
|
x = 84;
|
}
|
else if (type == "H")
|
{
|
x = -15 + 48;
|
}
|
else if (type == "Q")
|
{
|
x = -15;
|
}
|
|
|
double text_height = 12;
|
DxfMText axisLabel = new DxfMText(text, new Point3D(x, y, 0d), text_height);//\P表示回车
|
axisLabel.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
//txtLabel.Thickness = 0.4d;
|
if (this._frameTextFont != null)
|
axisLabel.Style = _frameTextFont;
|
axisLabel.Color = _frameTextColor;
|
_dxfFileModel.Entities.Add(axisLabel);
|
return axisLabel;
|
}
|
|
|
|
//区域点点信息
|
private void DrawRegionPointInfo()
|
{
|
double y_rated = -170;
|
if (_workPointReal != null && _workPointReal.Q > 0.1)
|
{
|
#region 工作点文字
|
CreateFrameDxfText(_workPointReal.Q, y_rated, "Q");
|
CreateFrameDxfText(_workPointReal.H, y_rated, "H");
|
if (this._workSpeed > 10)
|
{
|
CreateFrameDxfText(_workSpeed, y_rated, "N");
|
}
|
|
CreateFrameDxfText(_workPointReal.P, y_rated, "P");
|
CreateFrameDxfText(_workPointReal.E, y_rated, "E");
|
if (_workPointReal.NPSH > 0.01)
|
{
|
CreateFrameDxfText(_workPointReal.NPSH, y_rated, "NPSH");
|
}
|
#endregion
|
}
|
else if(this._ratedParas != null)
|
{
|
CreateFrameDxfText(_ratedParas.Q, y_rated, "Q");
|
CreateFrameDxfText(_ratedParas.H, y_rated, "H");
|
if (this.RatedN > 10)
|
{
|
CreateFrameDxfText(RatedN, y_rated, "N");
|
}
|
|
CreateFrameDxfText(_ratedParas.P, y_rated, "P");
|
CreateFrameDxfText(_ratedParas.E, y_rated, "E");
|
if (_ratedParas.NPSHr > 0.01)
|
{
|
CreateFrameDxfText(_ratedParas.NPSHr, y_rated, "NPSH");
|
}
|
}
|
|
|
if (!string.IsNullOrEmpty(this._motorPower))
|
{
|
double text_height = 11;
|
DxfText txtLabel = new DxfText(this._motorPower.ToUpper().Replace("KW",""), new Point3D(185, y_rated, 0d), text_height);
|
// txtLabel.ObliqueAngle
|
txtLabel.Thickness = 0.4d;
|
if (this._frameTextFont != null)
|
txtLabel.Style = _frameTextFont;
|
txtLabel.Color = _frameTextColor;
|
txtLabel.Height = text_height;
|
_dxfFileModel.Entities.Add(txtLabel);
|
}
|
|
if (_regionPointParas == null)
|
return;
|
|
|
double y_min = y_rated + 30;
|
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMin.Q, y_min, "Q");
|
//CreateFrameDxfText(Math.Round(_regionPreferMin.Q / 3.6, 3), y_min, "Q2");
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMin.H, y_min, "H");
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMin.P, y_min, "P");
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMin.E, y_min, "E");
|
|
if (this._regionPointParas.PerferRegionMin.NPSH > 0.01)
|
{
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMin.NPSH, y_min, "NPSH");
|
}
|
|
|
|
|
double y_max = y_rated - 30;
|
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMax.Q, y_max, "Q");
|
//CreateFrameDxfText(Math.Round(_regionPreferMax.Q / 3.6, 3), y_max, "Q2");
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMax.H, y_max, "H");
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMax.P, y_max, "P");
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMax.E, y_max, "E");
|
|
if (this._regionPointParas.PerferRegionMax.NPSH > 0.01)
|
{
|
CreateFrameDxfText(this._regionPointParas.PerferRegionMax.NPSH, y_max, "NPSH");
|
}
|
|
}
|
|
|
|
|
//标题栏
|
private void DrawFrameTtileText()
|
{
|
|
|
|
Point2D _frameLeftBottomPt = new Point2D(-130, -253);
|
|
//日期
|
DxfText text_label_day = new DxfText(DateTime.Today.ToString("yyyy-MM-dd"), new Point3D(-5, -391, 0d), 12);
|
text_label_day.Thickness = 0.4d;
|
if (_frameTextFont != null)
|
text_label_day.Style = _frameTextFont;
|
text_label_day.Color = _frameTextColor;
|
text_label_day.Height = 12;
|
_dxfFileModel.Entities.Add(text_label_day);
|
|
|
|
//设计员签名
|
if (!string.IsNullOrEmpty(_designUserDrawSignal))
|
{
|
DxfMText axisLabel_Signal = new DxfMText(_designUserDrawSignal, new Point3D(10, -283, 0d), 12);
|
axisLabel_Signal.AttachmentPoint = AttachmentPoint.MiddleLeft;
|
if (_frameTextFont != null)
|
axisLabel_Signal.Style = _frameTextFont;
|
axisLabel_Signal.Color = _frameTextColor;
|
axisLabel_Signal.Height = 12;
|
_dxfFileModel.Entities.Add(axisLabel_Signal);
|
}
|
|
//工位编号
|
if (DwgObjectDict != null && DwgObjectDict.ContainsKey("ItemCode"))
|
{
|
DxfMText axisLabel_Signal = new DxfMText(DwgObjectDict["ItemCode"], new Point3D(10, -253, 0d), 12);
|
axisLabel_Signal.AttachmentPoint = AttachmentPoint.MiddleLeft;
|
if (_frameTextFont != null)
|
axisLabel_Signal.Style = _frameTextFont;
|
axisLabel_Signal.Color = _frameTextColor;
|
axisLabel_Signal.Height = 12;
|
_dxfFileModel.Entities.Add(axisLabel_Signal);
|
}
|
|
//工位名(设备名)
|
if (DwgObjectDict != null && DwgObjectDict.ContainsKey("ItemName"))
|
{
|
DxfMText axisLabel_Signal = new DxfMText(DwgObjectDict["ItemName"], new Point3D(175, -253, 0d), 12);
|
axisLabel_Signal.AttachmentPoint = AttachmentPoint.MiddleLeft;
|
if (_frameTextFont != null)
|
axisLabel_Signal.Style = _frameTextFont;
|
axisLabel_Signal.Color = _frameTextColor;
|
axisLabel_Signal.Height = 12;
|
_dxfFileModel.Entities.Add(axisLabel_Signal);
|
}
|
|
//项目名
|
if (_dwgObjectDict != null && _dwgObjectDict.ContainsKey("ProjectName"))
|
{
|
DxfMText axisLabel_Signal = new DxfMText(_dwgObjectDict["ProjectName"], new Point3D(400, -283, 0d), 12);
|
axisLabel_Signal.AttachmentPoint = AttachmentPoint.MiddleLeft;
|
if (_frameTextFont != null)
|
axisLabel_Signal.Style = _frameTextFont;
|
axisLabel_Signal.Color = _frameTextColor;
|
axisLabel_Signal.Height = 12;
|
_dxfFileModel.Entities.Add(axisLabel_Signal);
|
}
|
|
//客户名
|
if (_dwgObjectDict != null && _dwgObjectDict.ContainsKey("CustomerName"))
|
{
|
DxfMText axisLabel_Signal = new DxfMText(_dwgObjectDict["CustomerName"], new Point3D(400, -283 - 33, 0d), 12);
|
axisLabel_Signal.AttachmentPoint = AttachmentPoint.MiddleLeft;
|
if (_frameTextFont != null)
|
axisLabel_Signal.Style = _frameTextFont;
|
axisLabel_Signal.Color = _frameTextColor;
|
axisLabel_Signal.Height = 12;
|
_dxfFileModel.Entities.Add(axisLabel_Signal);
|
}
|
|
if (_dwgObjectDict != null && _dwgObjectDict.ContainsKey("ProductDrawNO"))
|
{
|
DxfMText axisLabel_Signal = new DxfMText(_dwgObjectDict["ProductDrawNO"], new Point3D(422, -252, 0d), 12);
|
axisLabel_Signal.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
if (_frameTextFont != null)
|
axisLabel_Signal.Style = _frameTextFont;
|
axisLabel_Signal.Color = _frameTextColor;
|
axisLabel_Signal.Height = 12;
|
_dxfFileModel.Entities.Add(axisLabel_Signal);
|
}
|
|
// 产品型号
|
if (!string.IsNullOrEmpty(_productName))
|
{
|
Point3D pt2 = new Point3D(230, -303, 0d);//居中就取中间位置
|
|
DxfMText axisLabel_name_2 = new DxfMText(_productName, pt2, 12);//\P表示回车//.Insert(_productName.Length / 2, @"\P")
|
if (_frameTextFont != null)
|
axisLabel_name_2.Style = _frameTextFont;
|
axisLabel_name_2.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
// axisLabel_name_2.ReferenceRectangleHeight = 40;
|
axisLabel_name_2.Color =_frameTextColor;
|
_dxfFileModel.Entities.Add(axisLabel_name_2);
|
}
|
|
|
// 产品型号
|
if (!string.IsNullOrEmpty(this._catalogName))
|
{
|
Point3D pt2 = new Point3D(166, -251, 0d);
|
|
DxfMText axisLabel_name_2 = new DxfMText(_catalogName.Replace("Vertical turbine /mixed flow pump","Vertical turbine"), pt2, 12);
|
if (_frameTextFont != null)
|
axisLabel_name_2.Style = _frameTextFont;
|
axisLabel_name_2.AttachmentPoint = AttachmentPoint.MiddleLeft;
|
axisLabel_name_2.Style.WidthFactor = 0.7;
|
axisLabel_name_2.Color = _frameTextColor;
|
_dxfFileModel.Entities.Add(axisLabel_name_2);
|
}
|
|
|
if (_dwgObjectDict != null && _dwgObjectDict.ContainsKey("JieZhiBiZhong"))
|
{
|
Point3D pt3 = new Point3D(486, -76, 0d);//居中就取中间位置
|
DxfMText axisLabel_name_3 = new DxfMText(_dwgObjectDict["JieZhiBiZhong"], pt3, 14);//\P表示回车
|
if (_frameTextFont != null)
|
axisLabel_name_3.Style = _frameTextFont;
|
axisLabel_name_3.AttachmentPoint = AttachmentPoint.MiddleCenter;
|
//axisLabel_name_3.ReferenceRectangleHeight = 40;
|
axisLabel_name_3.Color = _frameTextColor;
|
_dxfFileModel.Entities.Add(axisLabel_name_3);
|
}
|
|
//if (!string.IsNullOrEmpty(_corpName))
|
//{
|
// DxfText axisLabel_q = new DxfText(_corpName, new Point3D(143, 665, 0d), 9);
|
// axisLabel_q.Thickness = 0.4d;
|
// //axisLabel.Style = _defaultTextFont;
|
// axisLabel_q.Color = _frameTextColor;
|
// _dxfFileModel.Entities.Add(axisLabel_q);
|
//}
|
|
//if (!string.IsNullOrEmpty(_curveCode))
|
//{
|
// DxfText axisLabel_q = new DxfText(_curveCode, new Point3D(222, 526, 0d), 9);
|
// axisLabel_q.Thickness = 0.4d;
|
// //axisLabel.Style = _defaultTextFont;
|
// axisLabel_q.Color = _frameTextColor;
|
// _dxfFileModel.Entities.Add(axisLabel_q);
|
//}
|
|
|
}
|
|
|
|
}
|
}
|