SDC C-Project CF Review 프로그램
KEJ
2023-11-24 9020bfb6f86ff853d5d5b3cee882132a244232da
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
#include "StdAfx.h"
#include "CHReviewSetting/Sys_MotorManager.h"
 
CSys_MotorManager::CSys_MotorManager(void)
{
}
 
CSys_MotorManager::~CSys_MotorManager(void)
{
}
 
CMotorControlInfo* CSys_MotorManager::GetMotorInfo()
{
    return &m_motorInfo;
}
 
const CMotorControlInfo* CSys_MotorManager::GetMotorInfo() const
{
    return &m_motorInfo;
}
 
 
void CSys_MotorManager::SetProfile(CMacroFile& macroFile)
{
    CString strItem = _T("");
 
    // CMotorControlInfo
    // m_nIndex, m_strName, m_bUseThetaMotor;
    ///////////////////////////////////////////////////////////////////////////////////////////
    strItem.Format(_T("SYS_MOTOR_INDEX"));
    macroFile.SetItem(strItem, m_motorInfo.GetIndex());
 
    strItem.Format(_T("SYS_MOTOR_NAME"));
    macroFile.SetItem(strItem, m_motorInfo.GetName());
 
    strItem.Format(_T("SYS_MOTOR_USE_THETA_MOTOR"));
    macroFile.SetItem(strItem, m_motorInfo.GetUseThetaMotor());
    ///////////////////////////////////////////////////////////////////////////////////////////
    strItem.Format(_T("SYS_MOTOR_TYPE"));
    macroFile.SetItem(strItem, m_motorInfo.GetControllerType());
 
    strItem.Format(_T("SYS_MOTOR_PORT"));
    macroFile.SetItem(strItem, m_motorInfo.GetConnectionPort());
 
    strItem.Format(_T("SYS_MOTOR_ORIGIN_DIRECTION"));
    macroFile.SetItem(strItem, m_motorInfo.GetOriginDirection());
 
    strItem.Format(_T("SYS_MOTOR_AFM_DELAY_TIME"));
    macroFile.SetItem(strItem, m_motorInfo.GetAfDelayTime());
 
    strItem.Format(_T("SYS_MOTOR_SNAP_DELAY_TIME"));
    macroFile.SetItem(strItem, m_motorInfo.GetImageDelayTime());
 
    strItem.Format(_T("SYS_MOTOR_WSI_DELAY_TIME"));
    macroFile.SetItem(strItem, m_motorInfo.GetWsiDelayTime());
 
    strItem.Format(_T("SYS_MOTOR_AXIS_MOVE_COUNT"));
    macroFile.SetItem(strItem, m_motorInfo.GetMaxAxisMoveCount());
 
    strItem.Format(_T("SYS_MOTOR_START_XPOS"));
    macroFile.SetItem(strItem, m_motorInfo.GetStartMotorXpos());
 
    strItem.Format(_T("SYS_MOTOR_START_YPOS"));
    macroFile.SetItem(strItem, m_motorInfo.GetStartMotorYpos());
    // motor common addr
    //m_nAllAutoEnableAddr, m_nAllAutoStopAddr, (WSI, Review, Measure, AllAutoStop)ÀÇ ACK Addr, 
    ////////////////////////////////////////////////////////////////////////////////////////////////
    strItem.Format(_T("SYS_MOTOR_AUTO_ENABLE_ADDR"));
    macroFile.SetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoEnableAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_STOP_ADDR"));
    macroFile.SetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoStopAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_STOP_ACK_ADDR"));
    macroFile.SetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoStopAckAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_WSI_GO_ACK_ADDR"));
    macroFile.SetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoWsiGoAckAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_REVIEW_GO_ACK_ADDR"));
    macroFile.SetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoReviewGoAckAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_MEASURE_GO_ACK_ADDR"));
    macroFile.SetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoMeasureGoAckAddr);
    ////////////////////////////////////////////////////////////////////////////////////////////////
    strItem.Format(_T("SYS_MOTOR_NAME"));
    macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_strName);
 
    strItem.Format(_T("SYS_MOTOR_ALL_GO_ADDR"));
    macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAllAutoReviewGoAddr);
    
    strItem.Format(_T("SYS_MOTOR_ALL_MEASURE_GO_ADDR"));
    macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAllAutoMeasureGoAddr);
    
    strItem.Format(_T("SYS_MOTOR_ALL_WSI_GO_ADDR"));
    macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAllAutoWsiGoAddr);
    
    strItem.Format(_T("SYS_MOTOR_AFM_DELAY_TIME_ADDR"));
    macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAfDelayTimeAddr);
    
    strItem.Format(_T("SYS_MOTOR_SNAP_DELAY_TIME_ADDR"));
    macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nImageDelayTimeAddr);
 
    strItem.Format(_T("SYS_MOTOR_WSI_DELAY_TIME_ADDR"));
    macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nWsiDelayTimeAddr);
 
    strItem.Format(_T("SYS_MOTOR_USE_THETA_MOTOR_ADDR"));
    macroFile.SetItem(strItem, m_motorInfo.GetUseThetaMotor());
 
//strItem.Format(_T("SYS_MOTOR_USE_CHECK_MOTOR_OFFSET"));
//macroFile.SetItem(strItem, m_motorInfo..m_bUseCheckMotorOffset); 
 
//     strItem.Format(_T("SYS_MOTOR_OFFSET_X"));
//     macroFile.SetItem(strItem, m_motorInfo.m_dOffsetX);
// 
//     strItem.Format(_T("SYS_MOTOR_OFFSET_Y"));
//     macroFile.SetItem(strItem, m_motorInfo.m_dOffsetY);
// 
//     strItem.Format(_T("SYS_MOTOR_DIRECTION_X"));
//     macroFile.SetItem(strItem, m_motorInfo.GetMotorCommonAddr()->);
// 
//     strItem.Format(_T("SYS_MOTOR_DIRECTION_Y"));
//     macroFile.SetItem(strItem, m_motorInfo.m_ndirectionY);
 
    CMotorThetaAxisAddr *pThetaMotorAxisAddr = m_motorInfo.GetThetaMotorAxisAddr();
    if(pThetaMotorAxisAddr != NULL)
    {
        //m_nAxisIdx, m_nGantryIdx, m_lStatus, m_dPosition
        ///////////////////////////////////////////////////////////////////////
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_MOTOR_INDEX"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nGantryIdx); 
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_MOTOR_AXIS_INDEX"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nAxisIdx); 
 
        ///////////////////////////////////////////////////////////////////////
        strItem.Format(_T("SYS_MOTOR_THETA_MOTOR_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nManualGoAddr); 
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_NAME"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_strName);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_POSITION_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nPositionAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_STATUS_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nStatusAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MOVE_SPEED_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nMoveSpeedAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_ACCEL_TIME_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nAccelTimeAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_JOG_COMMAND_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nJogCommandAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_JOG_SPEED_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nJogSpeedAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MAX_JOG_SPEED"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_dMaxJogSpeed);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MIN_JOG_SPEED"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_dMinJogSpeed);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MOVE_POSITION_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_nMovePositionAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_PLUS_LIMIT_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_dPlusLimitPos);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MINUS_LIMIT_ADDR"));
        macroFile.SetItem(strItem, pThetaMotorAxisAddr->m_dMinusLimitPos);
    }
 
    // motor gantry addr
    int nGantryCount = m_motorInfo.GetMotorGantryAddrCount();
    strItem.Format(_T("SYS_MOTOR_GANTRY_COUNT"));
    macroFile.SetItem(strItem, nGantryCount);
 
    for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++)
    {
        CMotorGantryAddr *pMotorGantryAddr = m_motorInfo.GetMotorGantryAddr(nGantryIdx);
        if (pMotorGantryAddr==NULL) continue;
        //  m_nManualGoAckAddr, m_nAutoReviewGoAckAddr,  m_nAutoMeasureGoAckAddr, m_nAutoWsiGoAckAddr, m_nGantryIdx
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////
        strItem.Format(_T("SYS_MOTOR_GANTRY_MANUAL_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nManualGoAckAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_AUTO_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nAutoReviewGoAckAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_AUTO_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nAutoMeasureGoAckAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_AUTO_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nAutoWsiGoAckAddr);
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_INDEX_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nGantryIdx);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_NAME_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_strName);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MANUAL_GO_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nManualGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_AUTO_GO_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nAutoReviewGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MOVE_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nReviewMoveCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_TRIGGER_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nReviewTriggerCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_AUTO_GO_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nAutoMeasureGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_MOVE_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nMeasureMoveCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_TRIGGER_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nMeasureTriggerCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_AUTO_GO_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nAutoWsiGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_MOVE_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nWsiMoveCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_TRIGGER_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nWsiTriggerCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_SOFTWARE_TRIGGER_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem,pMotorGantryAddr->m_nSoftwareTriggerAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_SOFTWARE_TRIGGER_COMMAND_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem,pMotorGantryAddr->m_nSoftwareTriggerCmdAdr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_IMAGE_SNAP_COMPLETE_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem,pMotorGantryAddr->m_nImageSnapCompleteAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_COLLISION_X_ADDR_%02d"), nGantryIdx);
        macroFile.SetItem(strItem, pMotorGantryAddr->m_nCollisionXAddr);
 
        // motor axis addrf
        int nAxisCount = pMotorGantryAddr->GetMotorAxisAddrCount();
        strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_COUNT"), nGantryIdx);
        macroFile.SetItem(strItem, nAxisCount);
                
        for(int nAxisIdx = 0; nAxisIdx < nAxisCount; nAxisIdx++)
        {
            CMotorAxisAddr *pMotorAxisAddr = pMotorGantryAddr->GetMotorAxisAddr(nAxisIdx);
            if (pMotorAxisAddr==NULL) continue;
            // m_nAxisIdx, m_nGantryIdx, m_dPosition
 
            //////////////////////////////////////////////////////////////////////////////////////////////
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_INDEX_%02d"),nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem,pMotorAxisAddr->m_nAxisIdx);
 
            strItem.Format( _T("SYS_MOTOR_GANTRY_%02d_GANTRY_INDEX_%02d"),nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem,pMotorAxisAddr->m_nGantryIdx);
 
            //////////////////////////////////////////////////////////////////////////////////////////////
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_NAME_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_strName);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_POSITION_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nPositionAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_STATUS_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nStatusAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MOVE_SPEED_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nMoveSpeedAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_ACCEL_TIME_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nAccelTimeAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_JOG_COMMAND_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nJogCommandAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_JOG_SPEED_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nJogSpeedAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MAX_JOG_SPEED_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_dMaxJogSpeed);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MIN_JOG_SPEED_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_dMinJogSpeed);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MOVE_POSITION_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nMovePositionAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MOVE_POSITION_COMMON_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_nMovePositionCommonAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_PLUS_LIMIT_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_dPlusLimitPos);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MINUS_LIMIT_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.SetItem(strItem, pMotorAxisAddr->m_dMinusLimitPos);
 
        }
    }
}
 
void CSys_MotorManager::GetProfile(CMacroFile& macroFile)
{
    CString strItem = _T("");
    CString strBuffer = _T("");
 
    int nGetItem = 0;
    BOOL bGetItem = FALSE;
 
    ///////////////////////////////////////////////////////////////////////////////////////////
    strItem.Format(_T("SYS_MOTOR_INDEX"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetIndex(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_NAME"));
    macroFile.GetItem(strItem, strBuffer);
    m_motorInfo.SetName(strBuffer);
 
    strItem.Format(_T("SYS_MOTOR_USE_THETA_MOTOR"));
    macroFile.GetItem(strItem,bGetItem);
    m_motorInfo.SetUseThetaMotor(bGetItem);
    ///////////////////////////////////////////////////////////////////////////////////////////
 
    strItem.Format(_T("SYS_MOTOR_TYPE"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetControllerType(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_PORT"));
    macroFile.GetItem(strItem, strBuffer);
    m_motorInfo.SetConnectionPort(strBuffer);
 
    strItem.Format(_T("SYS_MOTOR_ORIGIN_DIRECTION"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetOriginDirection(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_AFM_DELAY_TIME"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetAfDelayTime(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_SNAP_DELAY_TIME"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetImageDelayTime(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_WSI_DELAY_TIME"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetWsiDelayTime(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_AXIS_MOVE_COUNT"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetMaxAxisMoveCount(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_START_XPOS"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetStartMotorXpos(nGetItem);
 
    strItem.Format(_T("SYS_MOTOR_START_YPOS"));
    macroFile.GetItem(strItem, nGetItem);
    m_motorInfo.SetStartMotorYpos(nGetItem);
 
 
    // motor common addr
    ////////////////////////////////////////////////////////////////////////////////////////////////
    strItem.Format(_T("SYS_MOTOR_AUTO_ENABLE_ADDR"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAllAutoEnableAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_STOP_ADDR"));
    macroFile.GetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoStopAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_STOP_ACK_ADDR"));
    macroFile.GetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoStopAckAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_WSI_GO_ACK_ADDR"));
    macroFile.GetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoWsiGoAckAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_REVIEW_GO_ACK_ADDR"));
    macroFile.GetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoReviewGoAckAddr);
 
    strItem.Format(_T("SYS_MOTOR_AUTO_MEASURE_GO_ACK_ADDR"));
    macroFile.GetItem(strItem,m_motorInfo.GetMotorCommonAddr()->m_nAllAutoMeasureGoAckAddr);
    ////////////////////////////////////////////////////////////////////////////////////////////////
 
    strItem.Format(_T("SYS_MOTOR_NAME"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_strName);
 
    strItem.Format(_T("SYS_MOTOR_ALL_GO_ADDR"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAllAutoReviewGoAddr);
 
    strItem.Format(_T("SYS_MOTOR_ALL_MEASURE_GO_ADDR"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAllAutoMeasureGoAddr);
 
    strItem.Format(_T("SYS_MOTOR_ALL_WSI_GO_ADDR"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAllAutoWsiGoAddr);
 
    strItem.Format(_T("SYS_MOTOR_AFM_DELAY_TIME_ADDR"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nAfDelayTimeAddr);
 
    strItem.Format(_T("SYS_MOTOR_SNAP_DELAY_TIME_ADDR"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nImageDelayTimeAddr);
 
    strItem.Format(_T("SYS_MOTOR_WSI_DELAY_TIME_ADDR"));
    macroFile.GetItem(strItem, m_motorInfo.GetMotorCommonAddr()->m_nWsiDelayTimeAddr);
        
    strItem.Format(_T("SYS_MOTOR_USE_THETA_MOTOR_ADDR"));
    macroFile.GetItem(strItem, bGetItem);
    m_motorInfo.SetUseThetaMotor(bGetItem);
 
//     strItem.Format(_T("SYS_MOTOR_USE_CHECK_MOTOR_OFFSET"));            
//     macroFile.GetItem(strItem, m_motorInfo.m_bUseCheckMotorOffset);
//     
//     strItem.Format(_T("SYS_MOTOR_OFFSET_X"));
//     macroFile.GetItem(strItem, m_motorInfo.m_dOffsetX);
// 
//     strItem.Format(_T("SYS_MOTOR_OFFSET_Y"));
//     macroFile.GetItem(strItem, m_motorInfo.m_dOffsetY);
// 
//     strItem.Format(_T("SYS_MOTOR_DIRECTION_X"));
//     macroFile.GetItem(strItem, m_motorInfo.m_ndirectionX);
// 
//     strItem.Format(_T("SYS_MOTOR_DIRECTION_Y"));
//     macroFile.GetItem(strItem, m_motorInfo.m_ndirectionY);    
// 
 
    CMotorThetaAxisAddr *pThetaMotorAxisAddr = m_motorInfo.GetThetaMotorAxisAddr();
    if(pThetaMotorAxisAddr != NULL)
    {
        ///////////////////////////////////////////////////////////////////////
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_MOTOR_INDEX"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nGantryIdx); 
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_MOTOR_AXIS_INDEX"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nAxisIdx); 
 
        ///////////////////////////////////////////////////////////////////////
        strItem.Format(_T("SYS_MOTOR_THETA_MOTOR_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nManualGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_NAME"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_strName);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_POSITION_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nPositionAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_STATUS_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nStatusAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MOVE_SPEED_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nMoveSpeedAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_ACCEL_TIME_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nAccelTimeAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_JOG_COMMAND_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nJogCommandAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_JOG_SPEED_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nJogSpeedAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MAX_JOG_SPEED"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_dMaxJogSpeed);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MIN_JOG_SPEED"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_dMinJogSpeed);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MOVE_POSITION_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_nMovePositionAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_PLUS_LIMIT_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_dPlusLimitPos);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_THETA_AXIS_MINUS_LIMIT_ADDR"));
        macroFile.GetItem(strItem, pThetaMotorAxisAddr->m_dMinusLimitPos);
    }
 
    // motor gantry addr
    int nGantryCount = 0;
    strItem.Format(_T("SYS_MOTOR_GANTRY_COUNT"));
    macroFile.GetItem(strItem, nGantryCount);
 
    m_motorInfo.SetMotorGantryAddrCount(nGantryCount);
 
    for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++)
    {
        CMotorGantryAddr *pMotorGantryAddr = m_motorInfo.GetMotorGantryAddr(nGantryIdx);
        if (pMotorGantryAddr==NULL) continue;
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////
        strItem.Format(_T("SYS_MOTOR_GANTRY_MANUAL_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nManualGoAckAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_AUTO_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nAutoReviewGoAckAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_AUTO_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nAutoMeasureGoAckAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_AUTO_GO_ACK_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nAutoWsiGoAckAddr);
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////
        strItem.Format(_T("SYS_MOTOR_GANTRY_INDEX_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nGantryIdx);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_NAME_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_strName);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MANUAL_GO_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nManualGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_AUTO_GO_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nAutoReviewGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MOVE_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nReviewMoveCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_TRIGGER_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nReviewTriggerCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_AUTO_GO_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nAutoMeasureGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_MOVE_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nMeasureMoveCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_MEASURE_TRIGGER_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nMeasureTriggerCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_AUTO_GO_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nAutoWsiGoAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_MOVE_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nWsiMoveCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_TRIGGER_COUNT_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nWsiTriggerCountAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_SOFTWARE_TRIGGER_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem,pMotorGantryAddr->m_nSoftwareTriggerAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_SOFTWARE_TRIGGER_COMMAND_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem,pMotorGantryAddr->m_nSoftwareTriggerCmdAdr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_IMAGE_SNAP_COMPLETE_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem,pMotorGantryAddr->m_nImageSnapCompleteAddr);
 
        strItem.Format(_T("SYS_MOTOR_GANTRY_OTHER_COLLISION_X_ADDR_%02d"), nGantryIdx);
        macroFile.GetItem(strItem, pMotorGantryAddr->m_nCollisionXAddr);
 
        // motor axis addr
        int nAxisCount = 0;
        strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_COUNT"), nGantryIdx);
        macroFile.GetItem(strItem, nAxisCount);
 
        pMotorGantryAddr->SetMotorAxisAddrCount(nAxisCount);
 
        for(int nAxisIdx = 0; nAxisIdx < nAxisCount; nAxisIdx++)
        {
            CMotorAxisAddr *pMotorAxisAddr = pMotorGantryAddr->GetMotorAxisAddr(nAxisIdx);
            if (pMotorAxisAddr==NULL) continue;
            //////////////////////////////////////////////////////////////////////////////////////////////
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_INDEX_%02d"),nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem,pMotorAxisAddr->m_nAxisIdx);
 
            strItem.Format( _T("SYS_MOTOR_GANTRY_%02d_GANTRY_INDEX_%02d"),nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem,pMotorAxisAddr->m_nGantryIdx);
 
            //////////////////////////////////////////////////////////////////////////////////////////////
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_NAME_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_strName);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_POSITION_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nPositionAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_STATUS_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nStatusAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MOVE_SPEED_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nMoveSpeedAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_ACCEL_TIME_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nAccelTimeAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_JOG_COMMAND_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nJogCommandAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_JOG_SPEED_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nJogSpeedAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MAX_JOG_SPEED_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_dMaxJogSpeed);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MIN_JOG_SPEED_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_dMinJogSpeed);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MOVE_POSITION_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nMovePositionAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MOVE_POSITION_COMMON_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_nMovePositionCommonAddr);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_PLUS_LIMIT_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_dPlusLimitPos);
 
            strItem.Format(_T("SYS_MOTOR_GANTRY_%02d_AXIS_MINUS_LIMIT_ADDR_%02d"), nGantryIdx, nAxisIdx);
            macroFile.GetItem(strItem, pMotorAxisAddr->m_dMinusLimitPos);
 
        }
    }
}