tx
2025-04-22 e0b138b3e057de6f57021e6c8963868f5c5acc5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
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);
            //}
 
 
        }
 
 
 
    }
}