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
|
{
|
//绘制区域
|
public void DrawRegion()
|
{
|
#region 最优区域(标注)
|
DxfDimensionStyle alternativedimenstionStyle = null;
|
if (this._isDispRegionPrefer && this._regionPointParas != null)
|
{
|
if (alternativedimenstionStyle == null)
|
{
|
WW.Cad.Model.Color deminColor = WW.Cad.Model.Color.CreateFromColorIndex(100); //CreateFromRgb(0, 255, 0);
|
var frameTextFont = _dxfFileModel.GetTextStyleWithName("PC_TEXTSTYLE");//文件自带字体
|
|
alternativedimenstionStyle = new DxfDimensionStyle(_dxfFileModel);
|
alternativedimenstionStyle.Name = "Architectural";//GB_LINEAR 文字在线上面 "Architectural" 文字在中间
|
//alternativedimenstionStyle.LinearUnitFormat = LinearUnitFormat.Engineering;
|
alternativedimenstionStyle.ArrowSize = 7.5d;
|
alternativedimenstionStyle.TextHeight = 15;
|
//alternativedimenstionStyle.FixedExtensionLineLength = 5;
|
alternativedimenstionStyle.ExtensionLineColor = deminColor;
|
alternativedimenstionStyle.ExtensionLineExtension = 2;
|
alternativedimenstionStyle.DimensionLineColor = deminColor;
|
alternativedimenstionStyle.TextColor = deminColor;
|
if (frameTextFont != null)
|
alternativedimenstionStyle.TextStyle = frameTextFont;
|
//alternativedimenstionStyle.TickSize = 10;
|
_dxfFileModel.DimensionStyles.Add(alternativedimenstionStyle);
|
|
}
|
|
DxfDimension.Linear dimension = new DxfDimension.Linear(alternativedimenstionStyle);
|
// dimension.HasTextRotation = false;
|
// dimension.TextRotation = 0;
|
// Touches bottom side of the circle.
|
dimension.ExtensionLine1StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.PerferRegionMin.Q), MapRealToPictH(this._regionPointParas.PerferRegionMin.H), 0);
|
// Touches top side of the circle.
|
dimension.ExtensionLine2StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.PerferRegionMax.Q), MapRealToPictH(this._regionPointParas.PerferRegionMax.H), 0);
|
//dimension.Color = GetEntityColor(System.Drawing.Color.Beige);
|
//dimension.DxfColor = GetEntityColor(System.Drawing.Color.Beige);
|
dimension.DimensionLineLocation = new Point3D((dimension.ExtensionLine1StartPoint.X + dimension.ExtensionLine2StartPoint.X) * 0.5, 880, 0);
|
// dimension.UseTextMiddlePoint = true;
|
//dimension.HorizontalDirection = 0;
|
|
dimension.Text = " 优先工作区 ";//
|
_dxfFileModel.Entities.Add(dimension);
|
|
//DxfVPort activeViewport = DxfVPort.CreateActiveVPort();
|
//activeViewport.Center = new Point2D(3, 2);
|
//activeViewport.Height = 15;
|
//_dxfFileModel.VPorts.Add(activeViewport);
|
}
|
#endregion
|
|
#region 运行区域(标注)
|
if (_isDispRegionAllow && this._regionPointParas != null)
|
{
|
if (alternativedimenstionStyle == null)
|
{
|
WW.Cad.Model.Color deminColor = WW.Cad.Model.Color.CreateFromColorIndex(100);
|
|
if (this._isMonoColor)
|
deminColor = WW.Cad.Model.Color.CreateFromColorIndex(7);
|
|
alternativedimenstionStyle = new DxfDimensionStyle(_dxfFileModel);
|
alternativedimenstionStyle.Name = "Architectural";
|
//alternativedimenstionStyle.LinearUnitFormat = LinearUnitFormat.Engineering;
|
alternativedimenstionStyle.ArrowSize = 7.5d;
|
alternativedimenstionStyle.TextHeight = 10;
|
//alternativedimenstionStyle.FixedExtensionLineLength = 5;
|
alternativedimenstionStyle.ExtensionLineColor = deminColor;
|
alternativedimenstionStyle.ExtensionLineExtension = 7;
|
alternativedimenstionStyle.DimensionLineColor = deminColor;
|
alternativedimenstionStyle.TextColor = deminColor;
|
//alternativedimenstionStyle.TickSize = 10;
|
_dxfFileModel.DimensionStyles.Add(alternativedimenstionStyle);
|
|
}
|
|
|
DxfDimension.Linear dimension = new DxfDimension.Linear(alternativedimenstionStyle);
|
// dimension.HasTextRotation = false;
|
// dimension.TextRotation = 0;
|
// Touches bottom side of the circle.
|
dimension.ExtensionLine1StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.AllowRegionMin.Q), MapRealToPictH(this._regionPointParas.AllowRegionMin.H), 0);
|
// Touches top side of the circle.
|
dimension.ExtensionLine2StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.AllowRegionMax.Q), MapRealToPictH(this._regionPointParas.AllowRegionMax.H), 0);
|
//dimension.Color = GetEntityColor(System.Drawing.Color.Beige);
|
//dimension.DxfColor = GetEntityColor(System.Drawing.Color.Beige);
|
dimension.DimensionLineLocation = new Point3D((dimension.ExtensionLine1StartPoint.X + dimension.ExtensionLine2StartPoint.X) * 0.5, 910, 0);
|
// dimension.UseTextMiddlePoint = true;
|
//dimension.HorizontalDirection = 0;
|
dimension.Text = " 允许工作区 ";
|
_dxfFileModel.Entities.Add(dimension);
|
|
//DxfVPort activeViewport = DxfVPort.CreateActiveVPort();
|
//activeViewport.Center = new Point2D(3, 2);
|
//activeViewport.Height = 15;
|
//_dxfFileModel.VPorts.Add(activeViewport);
|
}
|
#endregion
|
|
#region 最小流量线
|
if (_isDispRegionAllow && this._regionPointParas != null)
|
{
|
var regionAllowQ_pict = MapRealToPictQ(this._regionPointParas.AllowRegionMin.Q);
|
|
|
var curveColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(110);
|
//
|
var dxfLineDash = _dxfFileModel.LineTypes.Where(x => x.Name == "DASHED2").FirstOrDefault();//虚线
|
//延长线
|
DxfLine lineQ = new DxfLine(new Point2D(regionAllowQ_pict, this._diagramLeftTopPt_QH.Y), new Point2D(regionAllowQ_pict, -8));
|
lineQ.LineWeight = 40;
|
lineQ.Color = curveColor;
|
if (dxfLineDash != null)
|
lineQ.LineType = dxfLineDash;
|
_dxfFileModel.Entities.Add(lineQ);
|
|
//文字
|
var textFont = _dxfFileModel.GetTextStyleWithName("PC_TEXTSTYLE4");//文件自带字体
|
if (textFont == null)
|
textFont = _dxfFileModel.GetTextStyleWithName("Standard");//文件自带字体
|
|
Point3D pt_q_min = new Point3D();
|
pt_q_min.X = regionAllowQ_pict;
|
pt_q_min.Y = -30;
|
pt_q_min.Z = 0d;
|
DxfMText text_q_min = new DxfMText("Qmin", pt_q_min, 11);//\P表示回车
|
text_q_min.AttachmentPoint = AttachmentPoint.TopCenter;
|
text_q_min.Color = curveColor;
|
text_q_min.Style = textFont;
|
_dxfFileModel.Entities.Add(text_q_min);
|
}
|
#endregion
|
|
}
|
|
#region 工作点
|
private void DrawWorkPoint()
|
{
|
if (!_isDrawDesignPoint)
|
return;
|
if (this._designPointStdUnit != null)
|
{
|
Point2D centerPt = new Point2D();
|
centerPt.X = MapRealToPictQ(this._designPointStdUnit.X);
|
centerPt.Y = MapRealToPictH(this._designPointStdUnit.Y);
|
|
//插入块
|
var block = _dxfFileModel.Blocks.Where(x => x.Name == "性能曲线_BMS_工况点_V0").FirstOrDefault();
|
if (block != null)
|
{
|
var insert = new DxfInsert(block);
|
insert.ScaleFactor = new Vector3D(3.2, 3.2, 3.2);
|
insert.InsertionPoint = new WW.Math.Point3D(centerPt.X, centerPt.Y, 0);
|
_dxfFileModel.Entities.Add(insert);
|
_dxfFileModel.ResetHandles();
|
}
|
|
|
var dxfLineDash = _dxfFileModel.LineTypes.Where(x => x.Name == "DASHED2").FirstOrDefault();//虚线
|
|
var curveColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(10);
|
|
//延长线
|
DxfLine lineQ = new DxfLine(new Point2D(centerPt.X, centerPt.Y), new Point2D(centerPt.X, 0));
|
lineQ.LineWeight = 30;
|
lineQ.Color = curveColor;
|
if (dxfLineDash != null)
|
lineQ.LineType = dxfLineDash;
|
_dxfFileModel.Entities.Add(lineQ);
|
|
|
DxfLine lineH = new DxfLine(new Point2D(centerPt.X, centerPt.Y), new Point2D(0, centerPt.Y));
|
lineH.LineWeight = 30;
|
if (dxfLineDash != null)
|
lineH.LineType = dxfLineDash;
|
lineH.Color = curveColor;
|
_dxfFileModel.Entities.Add(lineH);
|
|
}
|
|
|
|
|
|
|
//if (_workPointReal != null && _workPointReal.Q > 0.1)
|
//{
|
// #region 工作点文字
|
// //double y_rated = -207;
|
// //DxfText axisLabel_q = GetRatedFrameDxfText(_workPointReal.Q, y_rated, "Q");
|
// //DxfText axisLabel_h = GetRatedFrameDxfText(_workPointReal.H, y_rated, "H");
|
// //if (this._workPointN > 10)
|
// //{
|
// // DxfText axisLabel_n = GetRatedFrameDxfText(_workPointN, y_rated, "N");
|
// //}
|
// //DxfText axisLabel_p = GetRatedFrameDxfText(_workPointReal.P, y_rated, "P");
|
// //DxfText axisLabel_e = GetRatedFrameDxfText(_workPointReal.E, y_rated, "E");
|
// //if (_workPointReal.NPSH > 0.01)
|
// //{
|
// // DxfText axisLabel_npsh = GetRatedFrameDxfText(_workPointReal.NPSH, y_rated, "NPSH");
|
// //}
|
|
// #endregion
|
//}
|
}
|
#endregion
|
|
#region 额定参数
|
private void DrawRatedParas()
|
{
|
if (_ratedParas == null)
|
return;
|
|
|
//
|
DrawRatedPointLine();
|
|
|
#region 额定点文字
|
double y_rated = -183;
|
|
DxfText axisLabel_q = GetRatedFrameDxfText(_ratedParas.Q, y_rated, "Q");
|
DxfText axisLabel_h = GetRatedFrameDxfText(_ratedParas.H, y_rated, "H");
|
|
if (this._ratedN > 10)
|
{
|
DxfText axisLabel_n = GetRatedFrameDxfText(_ratedN, y_rated, "N");
|
}
|
|
|
DxfText axisLabel_p = GetRatedFrameDxfText(_ratedParas.P, y_rated, "P");
|
DxfText axisLabel_e = GetRatedFrameDxfText(_ratedParas.E, y_rated, "E");
|
|
if (_ratedParas.NPSHr > 0.01)
|
{
|
DxfText axisLabel_npsh = GetRatedFrameDxfText(_ratedParas.NPSHr, y_rated, "NPSH");
|
}
|
|
#endregion
|
}
|
|
|
#endregion
|
}
|
}
|