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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
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);
            //}
        
 
 
 
 
 
 
        }
 
 
 
    }
}