mrDarker
2025-07-14 1c0ac1c7924efb8a2cb6962d3eda4126533a5ac8
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
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
#include "StdAfx.h"
#include "ResultFile.h"
 
CResultFile::CResultFile(void)
{
    m_pCurResult = NULL;
    m_bCut = m_bCorner = m_bDim = m_bSpline = m_bNotch = FALSE;
}
 
CResultFile::CResultFile(CResultData *pResult)
{
    m_bMakeResultFile = TRUE;
    m_gBase = g_pBase;
    m_pCurResult = pResult;
    if(m_pCurResult == NULL)
    {
        g_pLog->DisplayMessage(_T("Result Data Fail! : CurGlass is NULL"));        
        m_bMakeResultFile = FALSE;
    }
 
    if(m_gBase->m_strHPanelID.IsEmpty() == TRUE)
    {
        g_pLog->DisplayMessage(_T("Result Data Fail! : No PanelID"));        
        m_bMakeResultFile = FALSE;
    }
}
 
CResultFile::~CResultFile(void)
{
}
 
void CResultFile::SetInsParm(BOOL bCut,BOOL bCorner,BOOL bDim,BOOL bSpline,BOOL bNotch)
{
    m_bCut = bCut;
    m_bCorner = bCorner;
    m_bDim = bDim;
    m_bSpline = bSpline;
    m_bNotch = bNotch;
}
 
BOOL CResultFile::MakeResultFile(CString strFolder,CString strFolder_Notch,BOOL bFinalResult)//20140528
{
    if(m_bMakeResultFile == FALSE || m_pCurResult == NULL)
        return FALSE;
 
    CString            strGlassID,strPath;
    CString            strContents,strValue;
    CStdioFile        *pFile = NULL;
    CFileException    ex;
    CString            strHostID;
    CString            strContents_Notch, strPath_Notch;//20140528
    CStdioFile        *pFile_Notch = NULL;//20140528
    CFileException    ex_Notch;//20140528
 
    strGlassID = m_gBase->m_strHPanelID;    
    strPath.Format(_T("%s\\%s.csv"),strFolder,strGlassID);
    strPath_Notch.Format(_T("%s\\%s.csv"),strFolder_Notch,strGlassID);//20140528
    
    pFile = new CStdioFile();
    if (!pFile->Open(strPath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex))
    {
#ifdef _DEBUG
        TCHAR   szCause[255] = {0};
        ex.GetErrorMessage(szCause, 255);
        g_pLog->DisplayMessage(_T("Result Data Fail! : File Open Fail[%s]"),szCause);
#endif
        if (pFile) 
            delete pFile,pFile = NULL;    
    }
 
    pFile_Notch = new CStdioFile();//20140528
    if (!pFile_Notch->Open(strPath_Notch, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex_Notch))//20140528
    {
#ifdef _DEBUG
        TCHAR   szCause[255] = {0};
        ex_Notch.GetErrorMessage(szCause, 255);
        g_pLog->DisplayMessage(_T("Result Notch Data Fail! : File Open Fail[%s]"),szCause);
#endif
        if (pFile_Notch) 
            delete pFile_Notch,pFile_Notch = NULL;        
    }
 
    BOOL        bResult;//20140528
    bResult = MakeResultRaw(strContents,strContents_Notch,m_bCorner);//20140528
 
    if(strContents.GetLength() > 0 && pFile != NULL)
        pFile->WriteString(strContents);    
 
    if (pFile && pFile->m_hFile != CFile::hFileNull) 
        pFile->Close();    
    if (pFile) 
        delete pFile,pFile = NULL;    
 
    if(strContents_Notch.GetLength() > 0 && pFile_Notch != NULL)//20140528
        pFile_Notch->WriteString(strContents_Notch);    
 
    if (pFile_Notch && pFile_Notch->m_hFile != CFile::hFileNull) //20140528
        pFile_Notch->Close();    
    if (pFile_Notch) //20140528
        delete pFile_Notch,pFile_Notch = NULL;        
 
    return bResult;
}
 
void CResultFile::MakeChamferResult(CString &strContents,BOOL bCornerIns)
{
    double        *dRangeVal,dCutAvg;
    BOOL        bResult;
    CString        strResult,strValue;    
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_A];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_A];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_A][0];
 
//    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountCF < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
//    else strResult = _T("NG");    //20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Upper APos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Upper APos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Upper APos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[1]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_A];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_A];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_A][0];
//    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
//    else strResult = _T("NG");//20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Lower APos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Lower APos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Lower APos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[2]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_B];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_B];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_B][0];
//    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountCF < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
//    else strResult = _T("NG");//20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Upper BPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Upper BPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Upper BPos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[3]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_B];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_B];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_B][0];
//    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
    //    else strResult = _T("NG");//20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Lower BPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Lower BPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Lower BPos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[4]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_C];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_C];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_C][0];
    //    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
    //    else strResult = _T("NG");//20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Upper CPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Upper CPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Upper CPos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[5]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_C];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_C];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_C][0];
    //    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
    //    else strResult = _T("NG");//20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Lower CPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Lower CPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Lower CPos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[6]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_D];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_D];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_D][0];
    //    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
    //    else strResult = _T("NG");//20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Upper DPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Upper DPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Upper DPos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[7]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
 
    bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_D];
    dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_D];
    dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_D][0];
    //    if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
    if(bResult == FALSE)//20140603
        strResult = _T("NG");
    else if(bResult == TRUE) strResult = _T("OK");
    //    else strResult = _T("NG");//20140603
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Chamfer Lower DPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Chamfer Lower DPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
    else
        strValue.Format(_T("[Chamfer Lower DPos]\r\n*\r\n"));    
    strContents += strValue;
 
    g_pLog->DisplayMessage(_T("[8]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
 
    if(m_bCut == TRUE)
    {
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_A];
        strValue.Format(_T("[Chamfer Upper APos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
 
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_A];    
        strValue.Format(_T("[Chamfer Lower APos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
 
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_B];
        strValue.Format(_T("[Chamfer Upper BPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
 
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_B];    
        strValue.Format(_T("[Chamfer Lower BPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
 
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_C];    
        strValue.Format(_T("[Chamfer Upper CPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
 
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_C];    
        strValue.Format(_T("[Chamfer Lower CPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
 
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_D];    
        strValue.Format(_T("[Chamfer Upper DPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
 
        dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_D];    
        strValue.Format(_T("[Chamfer Lower DPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
        strContents += strValue;
    }
    else
    {        
        strValue.Format(_T("[Chamfer Upper APos Specific Area]\r\n*\r\n"));
        strContents += strValue;
    
        strValue.Format(_T("[Chamfer Lower APos Specific Area]\r\n*\r\n"));
        strContents += strValue;
 
        strValue.Format(_T("[Chamfer Upper BPos Specific Area]\r\n*\r\n"));
        strContents += strValue;
 
        strValue.Format(_T("[Chamfer Lower BPos Specific Area]\r\n*\r\n"));
        strContents += strValue;
 
        strValue.Format(_T("[Chamfer Upper CPos Specific Area]\r\n*\r\n"));
        strContents += strValue;
 
        strValue.Format(_T("[Chamfer Lower CPos Specific Area]\r\n*\r\n"));
        strContents += strValue;
 
        strValue.Format(_T("[Chamfer Upper DPos Specific Area]\r\n*\r\n"));
        strContents += strValue;
 
        strValue.Format(_T("[Chamfer Lower DPos Specific Area]\r\n*\r\n"));
        strContents += strValue;
    }
}
 
void CResultFile::MakeChamferDiagonalLineResult(CString &strContents)//20140622
{
    double        dDiagonalLineValue;
    BOOL        bResult;
    CString        strResult,strValue;    
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_A];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_A];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Upper APos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Upper APos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Upper APos]\r\n*\r\n"));    
    strContents += strValue;
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_A];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_A];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Lower APos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Lower APos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Lower APos]\r\n*\r\n"));    
    strContents += strValue;
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_B];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_B];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Upper BPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Upper BPos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Upper BPos]\r\n*\r\n"));    
    strContents += strValue;
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_B];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_B];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Lower BPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Lower BPos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Lower BPos]\r\n*\r\n"));    
    strContents += strValue;
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_C];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_C];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Upper CPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Upper CPos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Upper CPos]\r\n*\r\n"));    
    strContents += strValue;
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_C];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_C];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Lower CPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Lower CPos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Lower CPos]\r\n*\r\n"));    
    strContents += strValue;
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_D];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_D];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Upper DPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Upper DPos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Upper DPos]\r\n*\r\n"));    
    strContents += strValue;
 
    bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_D];
    dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_D];
    if(bResult == TRUE) strResult = _T("OK");
    else strResult = _T("NG");    
    if(m_bCut == FALSE) strResult = _T("*");
    strValue.Format(_T("[Diagonal Line Ins Lower DPos Result]\r\n%s\r\n"),strResult);    
    strContents += strValue;
    if(m_bCut == TRUE)
        strValue.Format(_T("[Diagonal Line Ins Lower DPos]\r\n%.3f\r\n"),dDiagonalLineValue);    
    else
        strValue.Format(_T("[Diagonal Line Ins Lower DPos]\r\n*\r\n"));    
    strContents += strValue;
}
 
void CResultFile::MakeDimensionResult(CString &strContents,BOOL bCornerIns)
{
    double        *dRangeVal;
    BOOL        bResult;
    CString        strResult,strValue;    
    double        dAvgDimen;
 
    if(m_bDim == TRUE)
    {
        dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_A][0];
        bResult = m_pCurResult->m_bDimensionRes[DIMENSION_A];
        dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_A];        
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Dimension APos Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Dimension APos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
 
        dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_B][0];
        bResult = m_pCurResult->m_bDimensionRes[DIMENSION_B];
        dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_B];
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Dimension BPos Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Dimension BPos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
 
        dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_C][0];
        bResult = m_pCurResult->m_bDimensionRes[DIMENSION_C];
        dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_C];
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Dimension CPos Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Dimension CPos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
 
        dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_D][0];
        bResult = m_pCurResult->m_bDimensionRes[DIMENSION_D];
        dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_D];
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Dimension DPos Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Dimension DPos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
    }
    else
    {
        strValue.Format(_T("[Dimension APos Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Dimension APos Size]\r\n*\r\n"));    
        strContents += strValue;
 
        strValue.Format(_T("[Dimension BPos Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Dimension BPos Size]\r\n*\r\n"));    
        strContents += strValue;
        
        strValue.Format(_T("[Dimension CPos Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Dimension CPos Size]\r\n*\r\n"));    
        strContents += strValue;
    
        strValue.Format(_T("[Dimension DPos Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Dimension DPos Size]\r\n*\r\n"));    
        strContents += strValue;
    }
}
 
void CResultFile::MakeSplineResult(CString &strContents)
{    
    double        dSpline,*dSpMaxDefect;
    double        *dRangeVal;
    BOOL        bResult;
    CString        strResult,strValue;    
 
    if(m_bSpline == TRUE)
    {
        dSpMaxDefect = m_pCurResult->m_dSplineMaxDefect;    
        dSpline = m_pCurResult->m_dSplineAvg[1][1];        // Left ÇϺÎ
        bResult = m_pCurResult->m_bSplineRes[1][1];
        dRangeVal = &m_pCurResult->m_dSplinePoint[1][1][0];
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Spline CCut Left Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Left Size]\r\n%.3f\r\n"),dSpline);    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Left MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[0]);    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Left Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
 
        dSpline = m_pCurResult->m_dSplineAvg[1][0];        // Left »óºÎ
        bResult = m_pCurResult->m_bSplineRes[1][0];
        dRangeVal = &m_pCurResult->m_dSplinePoint[1][0][0];
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Spline CCut Right Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Right Size]\r\n%.3f\r\n"),dSpline);    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Right MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[1]);    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Right Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
 
        dSpline = m_pCurResult->m_dSplineAvg[0][1];        // Right »óºÎ
        bResult = m_pCurResult->m_bSplineRes[0][1];    
        dRangeVal = &m_pCurResult->m_dSplinePoint[0][1][0];
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Spline RCut Left Result]\r\n%s\r\n"),strResult);
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Left Size]\r\n%.3f\r\n"),dSpline);    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Left MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[2]);    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Left Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
 
        dSpline = m_pCurResult->m_dSplineAvg[0][0];        // Right ÇϺÎ
        bResult = m_pCurResult->m_bSplineRes[0][0];    
        dRangeVal = &m_pCurResult->m_dSplinePoint[0][0][0];
        if(bResult == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Spline RCut Right Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Right Size]\r\n%.3f\r\n"),dSpline);    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Right MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[3]);    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Right Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);    
        strContents += strValue;
    }
    else
    {
        strValue.Format(_T("[Spline CCut Left Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Left Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Left MaxDefect]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Left Range]\r\n*\r\n"));    
        strContents += strValue;
        
        strValue.Format(_T("[Spline CCut Right Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Right Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Right MaxDefect]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline CCut Right Range]\r\n*\r\n"));    
        strContents += strValue;
    
        strValue.Format(_T("[Spline RCut Left Result]\r\n*\r\n"));
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Left Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Left MaxDefect]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Left Range]\r\n*\r\n"));    
        strContents += strValue;
    
        strValue.Format(_T("[Spline RCut Right Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Right Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Right MaxDefect]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Spline RCut Right Range]\r\n*\r\n"));    
        strContents += strValue;
    }
}
 
void CResultFile::MakeCornerResult(CString &strContents)
{
    //////////////////////////////////////////////////////////////////////////
    // Corner    
    CString        strResult,strValue;    
 
    if(m_bCorner == TRUE)
    {
        BOOL    bResultWidth = m_pCurResult->m_bCornerResWidth[1][1];    
        double    dCornerWidth = m_pCurResult->m_dCornerWidth[1][1];
        BOOL    bResultHeight = m_pCurResult->m_bCornerResHeight[1][1];    
        double    dCornerHeight = m_pCurResult->m_dCornerHeight[1][1];
        if(bResultWidth == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Left Upper Width Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Upper Width Size]\r\n%.3f\r\n"),dCornerWidth);    
        strContents += strValue;
        if(bResultHeight == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Left Upper Height Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Upper Height Size]\r\n%.3f\r\n"),dCornerHeight);    
        strContents += strValue;
 
        bResultWidth = m_pCurResult->m_bCornerResWidth[1][0];    
        dCornerWidth = m_pCurResult->m_dCornerWidth[1][0];
        bResultHeight = m_pCurResult->m_bCornerResHeight[1][0];    
        dCornerHeight = m_pCurResult->m_dCornerHeight[1][0];
        if(bResultWidth == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Right Upper Width Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Upper Width Size]\r\n%.3f\r\n"),dCornerWidth);    
        strContents += strValue;
        if(bResultHeight == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Right Upper Height Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Upper Height Size]\r\n%.3f\r\n"),dCornerHeight);    
        strContents += strValue;
 
        bResultWidth = m_pCurResult->m_bCornerResWidth[0][1];    
        dCornerWidth = m_pCurResult->m_dCornerWidth[0][1];
        bResultHeight = m_pCurResult->m_bCornerResHeight[0][1];    
        dCornerHeight = m_pCurResult->m_dCornerHeight[0][1];
        if(bResultWidth == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Left Lower Width Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Lower Width Size]\r\n%.3f\r\n"),dCornerWidth);    
        strContents += strValue;
        if(bResultHeight == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Left Lower Height Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Lower Height Size]\r\n%.3f\r\n"),dCornerHeight);    
        strContents += strValue;
 
        bResultWidth = m_pCurResult->m_bCornerResWidth[0][0];    
        dCornerWidth = m_pCurResult->m_dCornerWidth[0][0];
        bResultHeight = m_pCurResult->m_bCornerResHeight[0][0];    
        dCornerHeight = m_pCurResult->m_dCornerHeight[0][0];
        if(bResultWidth == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Right Lower Width Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Lower Width Size]\r\n%.3f\r\n"),dCornerWidth);    
        strContents += strValue;
        if(bResultHeight == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Corner Right Lower Height Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Lower Height Size]\r\n%.3f\r\n"),dCornerHeight);    
        strContents += strValue;
    }
    else
    {
        strValue.Format(_T("[Corner Left Upper Width Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Upper Width Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Upper Height Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Upper Height Size]\r\n*\r\n"));    
        strContents += strValue;
        
        strValue.Format(_T("[Corner Right Upper Width Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Upper Width Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Upper Height Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Upper Height Size]\r\n*\r\n"));    
        strContents += strValue;
        
        strValue.Format(_T("[Corner Left Lower Width Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Lower Width Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Lower Height Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Left Lower Height Size]\r\n*\r\n"));    
        strContents += strValue;
    
        strValue.Format(_T("[Corner Right Lower Width Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Lower Width Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Lower Height Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Corner Right Lower Height Size]\r\n*\r\n"));    
        strContents += strValue;
    }
}
 
void CResultFile::MakeNotchResult(CString &strContents)
{
    ////////////////////
    double dNotchAvgThick = 0.;
    BOOL bNotchAvgThick = FALSE;
    CString        strResult,strValue;    
 
    if(m_bNotch == TRUE)
    {
        dNotchAvgThick = m_pCurResult->m_dNCutThick[CAMDIR_TOP];
        bNotchAvgThick = m_pCurResult->m_bNCutThick[CAMDIR_TOP];
        if(bNotchAvgThick == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Notch Chamfer Top Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Notch Chamfer Top]\r\n%.3f\r\n"),dNotchAvgThick);    
        strContents += strValue;
 
        dNotchAvgThick = m_pCurResult->m_dNCutThick[CAMDIR_BOTTOM];
        bNotchAvgThick = m_pCurResult->m_bNCutThick[CAMDIR_BOTTOM];
        if(bNotchAvgThick == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Notch Chamfer Bottom Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Notch Chamfer Bottom]\r\n%.3f\r\n"),dNotchAvgThick);    
        strContents += strValue;    
 
        double dNotch=0.;
        BOOL bNotch = FALSE;
 
        dNotch = m_pCurResult->m_dNCutAvg[CAMDIR_TOP];
        bNotch = m_pCurResult->m_bNCutSize[CAMDIR_TOP];
        if(bNotch == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Notch Top Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Notch Top Size]\r\n%.3f\r\n"),dNotch);    
        strContents += strValue;
 
        dNotch = m_pCurResult->m_dNCutAvg[CAMDIR_BOTTOM];
        bNotch = m_pCurResult->m_bNCutSize[CAMDIR_BOTTOM];
        if(bNotch == TRUE) strResult = _T("OK");
        else strResult = _T("NG");
        strValue.Format(_T("[Notch Bottom Result]\r\n%s\r\n"),strResult);    
        strContents += strValue;
        strValue.Format(_T("[Notch Bottom Size]\r\n%.3f\r\n"),dNotch);    
        strContents += strValue;
 
        strValue.Format(_T("[Notch Dx Size]\r\n%d,%d,%d,%d\r\n"),(int)m_pCurResult->m_dNCutX[DIMENSION_A],(int)m_pCurResult->m_dNCutX[DIMENSION_B]
        ,(int)m_pCurResult->m_dNCutX[DIMENSION_C],(int)m_pCurResult->m_dNCutX[DIMENSION_D]);    
        strContents += strValue;
        strValue.Format(_T("[Notch Dy Size]\r\n%d,%d,%d,%d\r\n"),(int)m_pCurResult->m_dNCutY[DIMENSION_A],(int)m_pCurResult->m_dNCutY[DIMENSION_B]
        ,(int)m_pCurResult->m_dNCutY[DIMENSION_C],(int)m_pCurResult->m_dNCutY[DIMENSION_D]);    
        strContents += strValue;
 
        CString            strTmp,strPosTmp[3],strPos[3];
        for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
        {                        
            strPos[0] = strPos[1] = strPos[2] = _T("");
            int iR;
            for(iR=0;iR<RANGE_VAL_COUNT;iR++)
            {
                if(iR != RANGE_VAL_COUNT-1)
                {
                    strPosTmp[0].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].x);//20140528
                    strPosTmp[1].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].y);//20140528
                    strPosTmp[2].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange[0][iDim][iR]);//20140528
                }
                else
                {
                    strPosTmp[0].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].x);//20140528                                
                    strPosTmp[1].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].y);//20140528
                    strPosTmp[2].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange[0][iDim][iR]);//20140528
                }
                strPos[0] += strPosTmp[0];            
                strPos[1] += strPosTmp[1];
                strPos[2] += strPosTmp[2];                        
            }
 
            switch(iDim)
            {
            case 0: strTmp="A"; break;
            case 1: strTmp="B"; break;
            case 2: strTmp="C"; break;
            case 3: strTmp="D"; break;
            }
 
            strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[0];
            strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[1];
            strValue.Format(_T("[%s Notch Range Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[2];
        }    
    }
    else
    {
        strValue.Format(_T("[Notch Chamfer Top Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Notch Chamfer Top]\r\n*\r\n"));    
        strContents += strValue;
 
        strValue.Format(_T("[Notch Chamfer Bottom Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Notch Chamfer Bottom]\r\n*\r\n"));    
        strContents += strValue;    
 
        strValue.Format(_T("[Notch Top Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Notch Top Size]\r\n*\r\n"));    
        strContents += strValue;
 
        strValue.Format(_T("[Notch Bottom Result]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Notch Bottom Size]\r\n*\r\n"));    
        strContents += strValue;
 
        strValue.Format(_T("[Notch Dx Size]\r\n*\r\n"));    
        strContents += strValue;
        strValue.Format(_T("[Notch Dy Size]\r\n*\r\n"));    
        strContents += strValue;
 
        CString            strTmp,strPosTmp[3],strPos[3];
        for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
        {                        
            strPos[0] = strPos[1] = strPos[2] = _T("");
            int iR;
            for(iR=0;iR<RANGE_VAL_COUNT;iR++)
            {
                if(iR != RANGE_VAL_COUNT-1)
                {
                    strPosTmp[0].Format(_T("*,"));
                    strPosTmp[1].Format(_T("*,"));
                    strPosTmp[2].Format(_T("*,"));
                }
                else
                {
                    strPosTmp[0].Format(_T("*\r\n"));                                
                    strPosTmp[1].Format(_T("*\r\n"));
                    strPosTmp[2].Format(_T("*\r\n"));
                }
                strPos[0] += strPosTmp[0];            
                strPos[1] += strPosTmp[1];
                strPos[2] += strPosTmp[2];                        
            }
 
            switch(iDim)
            {
            case 0: strTmp=_T("A"); break;
            case 1: strTmp=_T("B"); break;
            case 2: strTmp=_T("C"); break;
            case 3: strTmp=_T("D"); break;
            case 4: strTmp=_T("A_DN"); break;
            case 5: strTmp=_T("B_DN"); break;
            case 6: strTmp=_T("C_DN"); break;
            case 7: strTmp=_T("D_DN"); break;
            }
 
            strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[0];
            strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[1];
            strValue.Format(_T("[%s Notch Range Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[2];
        }    
    }
}
 
void CResultFile::MakeNotchInsPointResult(CString &strContents)//20140528
{
    CString        strResult,strValue;    
    CString        strTmp,strPosTmp[8],strPos[8];
    CString        strInsCount;
    int            nDefaultNotchInsCount = 9;
    BOOL        bNCutRangeDim, bNCutRangeChamTop, bNCutRangeChamBot;
        
    if(m_bNotch == TRUE)
    {
        for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
        {                        
            strPos[0] = strPos[1] = strPos[2] = strPos[3] = strPos[4] = _T("");
            bNCutRangeDim = bNCutRangeChamTop = bNCutRangeChamBot = TRUE;
 
            int iR;
            for(iR=0;iR<m_pCurResult->m_nNotchInsCount[iDim];iR++)
            {
                if(iR != m_pCurResult->m_nNotchInsCount[iDim]-1)
                {
                    strPosTmp[0].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].x);
                    strPosTmp[1].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].y);
                    strPosTmp[2].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange[0][iDim][iR]);
                    strPosTmp[3].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange_Cham[0][iDim][iR]);
                    strPosTmp[4].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange_Cham[1][iDim][iR]);
                    strPosTmp[5].Format(_T("%d,"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].x);
                    strPosTmp[6].Format(_T("%d,"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].y);
                    strPosTmp[7].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange_Dy[0][iDim][iR]);
                }
                else
                {
                    strPosTmp[0].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].x);                                
                    strPosTmp[1].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].y);
                    strPosTmp[2].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange[0][iDim][iR]);
                    strPosTmp[3].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange_Cham[0][iDim][iR]);
                    strPosTmp[4].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange_Cham[1][iDim][iR]);
                    strPosTmp[5].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].x);                                
                    strPosTmp[6].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].y);
                    strPosTmp[7].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange_Dy[0][iDim][iR]);
                }
                strPos[0] += strPosTmp[0];            
                strPos[1] += strPosTmp[1];
                strPos[2] += strPosTmp[2];    
                strPos[3] += strPosTmp[3];    
                strPos[4] += strPosTmp[4];
                strPos[5] += strPosTmp[5];            
                strPos[6] += strPosTmp[6];
                strPos[7] += strPosTmp[7];
 
                bNCutRangeDim &= m_pCurResult->m_bNCutRange[0][iDim][iR];
                bNCutRangeChamTop &= m_pCurResult->m_bNCutRange_Cham[0][iDim][iR];
                bNCutRangeChamBot &= m_pCurResult->m_bNCutRange_Cham[1][iDim][iR];
            }
 
            switch(iDim)
            {
            case 0: strTmp="A"; break;
            case 1: strTmp="B"; break;
            case 2: strTmp="C"; break;
            case 3: strTmp="D"; break;
            }
 
            strValue.Format(_T("[%s Notch Range Count]\r\n"),strTmp);
            strContents += strValue;
            strInsCount.Format(_T("%d\r\n"),m_pCurResult->m_nNotchInsCount[iDim]);
            strContents += strInsCount;
            
            strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[0];
            strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[1];
 
            if(bNCutRangeDim == TRUE)
                strResult = _T("OK\r\n");
            else
                strResult = _T("NG\r\n");
            strValue.Format(_T("[%s Notch Range Dimension Result]\r\n"),strTmp);
            strContents += strValue;
            strContents += strResult;
 
            strValue.Format(_T("[%s Notch Range Dimension Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[2];
 
            if(bNCutRangeChamTop == TRUE)
                strResult = _T("OK\r\n");
            else
                strResult = _T("NG\r\n");
            strValue.Format(_T("[%s Notch Range Chamfer Top Result]\r\n"),strTmp);
            strContents += strValue;
            strContents += strResult;
 
            strValue.Format(_T("[%s Notch Range Chamfer Top Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[3];
 
            if(bNCutRangeChamBot == TRUE)
                strResult = _T("OK\r\n");
            else
                strResult = _T("NG\r\n");
            strValue.Format(_T("[%s Notch Range Chamfer Bot Result]\r\n"),strTmp);
            strContents += strValue;
            strContents += strResult;
 
            strValue.Format(_T("[%s Notch Range Chamfer Bot Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[4];
 
            strValue.Format(_T("[%s Notch Range Position X_Dy]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[5];
            strValue.Format(_T("[%s Notch Range Position Y_Dy]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[6];
 
            strValue.Format(_T("[%s Notch Range Dimension Value_Dy]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[7];
        }    
    }
    else
    {
        for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
        {                        
            strPos[0] = strPos[1] = strPos[2] = strPos[3] = strPos[4] = strPos[5] = strPos[6] = strPos[7] = _T("");
            int iR;
            for(iR=0;iR<nDefaultNotchInsCount;iR++)
            {
                if(iR != nDefaultNotchInsCount-1)
                {
                    strPosTmp[0].Format(_T("*,"));
                    strPosTmp[1].Format(_T("*,"));
                    strPosTmp[2].Format(_T("*,"));
                    strPosTmp[3].Format(_T("*,"));
                    strPosTmp[4].Format(_T("*,"));
                    strPosTmp[5].Format(_T("*,"));
                    strPosTmp[6].Format(_T("*,"));
                    strPosTmp[7].Format(_T("*,"));
                }
                else
                {
                    strPosTmp[0].Format(_T("*\r\n"));                                
                    strPosTmp[1].Format(_T("*\r\n"));
                    strPosTmp[2].Format(_T("*\r\n"));
                    strPosTmp[3].Format(_T("*\r\n"));
                    strPosTmp[4].Format(_T("*\r\n"));
                    strPosTmp[5].Format(_T("*\r\n"));
                    strPosTmp[6].Format(_T("*\r\n"));
                    strPosTmp[7].Format(_T("*\r\n"));
                }
                strPos[0] += strPosTmp[0];            
                strPos[1] += strPosTmp[1];
                strPos[2] += strPosTmp[2];    
                strPos[3] += strPosTmp[3];
                strPos[4] += strPosTmp[4];    
                strPos[5] += strPosTmp[5];
                strPos[6] += strPosTmp[6];
                strPos[7] += strPosTmp[7];
            }
 
            switch(iDim)
            {
            case DIMENSION_A: strTmp = _T("A"); break;
            case DIMENSION_B: strTmp = _T("B"); break;
            case DIMENSION_C: strTmp = _T("C"); break;
            case DIMENSION_D: strTmp = _T("D"); break;
            case DIMENSION_A_DN: strTmp = _T("A_DN"); break;
            case DIMENSION_B_DN: strTmp = _T("B_DN"); break;
            case DIMENSION_C_DN: strTmp = _T("C_DN"); break;
            case DIMENSION_D_DN: strTmp = _T("D_DN"); break;
            }
 
            strValue.Format(_T("[%s Notch Range Count]\r\n"),strTmp);
            strContents += strValue;
            strInsCount.Format(_T("%d\r\n"),nDefaultNotchInsCount);
            strContents += strInsCount;
 
            strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[0];
            strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[1];
            strValue.Format(_T("[%s Notch Range Dimension Result]\r\n"),strTmp);
            strContents += strValue;
            strContents += _T("*\r\n");
            strValue.Format(_T("[%s Notch Range Dimension Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[2];
            strValue.Format(_T("[%s Notch Range Chamfer Top Result]\r\n"),strTmp);
            strContents += strValue;
            strContents += _T("*\r\n");
            strValue.Format(_T("[%s Notch Range Chamfer Top Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[3];
            strValue.Format(_T("[%s Notch Range Chamfer Bot Result]\r\n"),strTmp);
            strContents += strValue;
            strContents += _T("*\r\n");
            strValue.Format(_T("[%s Notch Range Chamfer Bot Value]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[4];
            strValue.Format(_T("[%s Notch Range Position X_Dy]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[5];
            strValue.Format(_T("[%s Notch Range Position Y_Dy]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[6];
            strValue.Format(_T("[%s Notch Range Dimension Value_Dy]\r\n"),strTmp);
            strContents += strValue;
            strContents += strPos[7];
        }    
    }
}
 
void CResultFile::MakeEtcResult(CString &strContents)
{
    CString        strResult,strValue;    
 
    strValue.Format(_T("[Glass Size X]\r\n%.3f\r\n"),m_pCurResult->m_dGlassSize[0]);    
    strContents += strValue;
    strValue.Format(_T("[Glass Size Y]\r\n%.3f\r\n"),m_pCurResult->m_dGlassSize[1]);
    strContents += strValue;
    
    strValue.Format(_T("[A Left Line Margin]\r\n"));
    strContents += strValue;
    strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[0],m_pCurResult->m_nLeftLineMargin[1]);
    strContents += strValue;
 
    strValue.Format(_T("[B Left Line Margin]\r\n"));
    strContents += strValue;
    strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[2],m_pCurResult->m_nLeftLineMargin[3]);
    strContents += strValue;
 
    strValue.Format(_T("[C Left Line Margin]\r\n"));
    strContents += strValue;
    strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[4],m_pCurResult->m_nLeftLineMargin[5]);
    strContents += strValue;
 
    strValue.Format(_T("[D Left Line Margin]\r\n"));
    strContents += strValue;
    strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[6],m_pCurResult->m_nLeftLineMargin[7]);
    strContents += strValue;
}
 
BOOL CResultFile::MakeResultRaw(CString &strContents, CString &strContents_Notch, BOOL bCornerIns)//20140528
{
    CString        strValue;    
    
    strValue.Format(_T("[Host ID]\r\n%s\r\n"),m_gBase->m_strHPanelID);    
    strContents += strValue;    
 
    strValue.Format(_T("[Start Date]\r\n%s\r\n"),(m_pCurResult->m_strScanStartTime).Left(8));    
    strContents += strValue;
 
    strValue.Format(_T("[Start Time]\r\n%s\r\n"),(m_pCurResult->m_strScanStartTime).Mid(9,6));    
    strContents += strValue;
 
    strValue.Format(_T("[End Date]\r\n%s\r\n"),(m_pCurResult->m_strScanEndTime).Left(8));    
    strContents += strValue;
 
    strValue.Format(_T("[End Time]\r\n%s\r\n"),(m_pCurResult->m_strScanEndTime).Mid(9,6));    
    strContents += strValue;
 
    strValue.Format(_T("[Recipe Name]\r\n%s\r\n"),m_pCurResult->m_strRecipeName);    
    strContents += strValue;
 
    CString        strMachine = _T("RCut Machine");
    strValue.Format(_T("[Machine Name]\r\n%s\r\n"),strMachine);    
    strContents += strValue;        
    
    strContents_Notch = strContents;//20140528
    
    MakeChamferResult(strContents,bCornerIns);
    MakeChamferDiagonalLineResult(strContents);//20140622
    MakeDimensionResult(strContents,bCornerIns);
    MakeSplineResult(strContents);
    MakeCornerResult(strContents);
    MakeNotchResult(strContents);
    MakeEtcResult(strContents);
    MakeDefectRaw(strContents);
 
    MakeNotchInsPointResult(strContents_Notch);//20140528
    
    return TRUE;
}
 
void CResultFile::MakeDefectRaw(CString &strContents)
{
    if(m_pCurResult->m_pDefectIns == NULL || m_pCurResult->m_nDefectCnt <= 0)
        return;
        
    CString            strValue,strTmp;
 
    strValue.Format(_T("[Information of Detections]\r\n"));    
    strContents += strValue;
    
    int            iDefect = 0;
    CInspectDefect    *pDefect;
    DimensionDir    emDir;        
    MapDefectIt        it;
    
    for(it=m_pCurResult->m_pDefectIns->begin();it!=m_pCurResult->m_pDefectIns->end();it++,iDefect++)
    {        
        pDefect = static_cast<CInspectDefect*>(it->second);        
        if(pDefect == NULL)
            continue;
        
        strValue.Format(_T("%d,"),iDefect);
        strContents += strValue;
 
        emDir = (DimensionDir)pDefect->m_nSideLoc;        
        strContents += PANEL_SIDE[emDir];
 
        if(pDefect->m_nCameraDir == 0)
            strValue = _T("Top,");
        else
            strValue = _T("Bot,");
        strContents += strValue;
 
        strValue.Format(_T("%d,"),pDefect->m_nUMOriginX);
        strContents += strValue;
 
        strValue.Format(_T("%d,"),pDefect->m_nUMOriginY);
        strContents += strValue;
 
        strValue.Format(_T("%d,"),pDefect->m_nUMSize);
        strContents += strValue;
 
        strValue.Format(_T("%d,"),pDefect->m_sDefectPeak);
        strContents += strValue;
 
        strValue.Format(_T("%d,"),pDefect->m_nUMSizeX);
        strContents += strValue;
 
        strValue.Format(_T("%d,"),pDefect->m_nUMSizeY);
        strContents += strValue;
 
        strValue.Format(_T("%d,"),pDefect->m_nDefectRScale);
        strContents += strValue;
 
        switch(pDefect->m_sDefectLoc)
        {
        case 0: strValue.Format(_T("Crack")); break;            
        case 1: strValue.Format(_T("Broken")); break;                
        case 2: strValue.Format(_T("Chip")); break;            
        case 3: strValue.Format(_T("Chamfer")); break;            
        case 4: strValue.Format(_T("Burr")); break;        
        case 5: strValue.Format(_T("Thin")); break;
        case 6: strValue.Format(_T("Area")); break;
        case 7: strValue.Format(_T("NCut")); break;
        case 8: strValue.Format(_T("CCD Hole")); break;
        case 9: strValue.Format(_T("Profile")); break;
        default: strValue.Format(_T("Unknown")); break;            
        }
        strContents += strValue;        
        strContents += _T(",\r\n");
    }
}