1
|
Imports SPPIDConverter
|
2
|
Imports SPPIDConverter.Main
|
3
|
Imports Plaice
|
4
|
Imports Llama
|
5
|
|
6
|
Public Class Drawing
|
7
|
|
8
|
Private _DWGNAME As String = ""
|
9
|
Private _SIZE As String = ""
|
10
|
Private _UNIT As String = ""
|
11
|
Private _LINE_NO As List(Of Line_no)
|
12
|
Private _TRIM_LINE_NO As List(Of Line_no)
|
13
|
Private _EQP_NO As List(Of Eqp_no)
|
14
|
|
15
|
'' 추가 수정 중
|
16
|
Private _SYMBOLS As List(Of Symbol)
|
17
|
Private _LINES As List(Of Line)
|
18
|
Private _LINENUMBERS As List(Of LineNumber)
|
19
|
Private _TRIMLINES As List(Of LineNumber)
|
20
|
Private _TEXTS As List(Of Text)
|
21
|
''
|
22
|
|
23
|
Public Property DwgName() As String
|
24
|
Get
|
25
|
Return _DWGNAME
|
26
|
End Get
|
27
|
Set(value As String)
|
28
|
_DWGNAME = value
|
29
|
End Set
|
30
|
End Property
|
31
|
|
32
|
Public Property Size() As String
|
33
|
Get
|
34
|
Return _SIZE
|
35
|
End Get
|
36
|
Set(value As String)
|
37
|
_SIZE = value
|
38
|
End Set
|
39
|
End Property
|
40
|
|
41
|
Public Property Unit() As String
|
42
|
Get
|
43
|
Return _UNIT
|
44
|
End Get
|
45
|
Set(value As String)
|
46
|
_UNIT = value
|
47
|
End Set
|
48
|
End Property
|
49
|
|
50
|
Public Property Line_nos As List(Of Line_no)
|
51
|
Get
|
52
|
Return _LINE_NO
|
53
|
End Get
|
54
|
Set(value As List(Of Line_no))
|
55
|
_LINE_NO = value
|
56
|
End Set
|
57
|
End Property
|
58
|
|
59
|
Public Property TrimLine_nos As List(Of Line_no)
|
60
|
Get
|
61
|
Return _TRIM_LINE_NO
|
62
|
End Get
|
63
|
Set(value As List(Of Line_no))
|
64
|
_TRIM_LINE_NO = value
|
65
|
End Set
|
66
|
End Property
|
67
|
|
68
|
Public Property Eqp_nos As List(Of Eqp_no)
|
69
|
Get
|
70
|
Return _EQP_NO
|
71
|
End Get
|
72
|
Set(value As List(Of Eqp_no))
|
73
|
_EQP_NO = value
|
74
|
End Set
|
75
|
End Property
|
76
|
|
77
|
Public Property LINES As List(Of Line)
|
78
|
Get
|
79
|
Return _LINES
|
80
|
End Get
|
81
|
Set(value As List(Of Line))
|
82
|
_LINES = value
|
83
|
End Set
|
84
|
End Property
|
85
|
|
86
|
Public Property LINENUMBERS As List(Of LineNumber)
|
87
|
Get
|
88
|
Return _LINENUMBERS
|
89
|
End Get
|
90
|
Set(value As List(Of LineNumber))
|
91
|
_LINENUMBERS = value
|
92
|
End Set
|
93
|
End Property
|
94
|
|
95
|
Public Property SYMBOLS As List(Of Symbol)
|
96
|
Get
|
97
|
Return _SYMBOLS
|
98
|
End Get
|
99
|
Set(value As List(Of Symbol))
|
100
|
_SYMBOLS = value
|
101
|
End Set
|
102
|
End Property
|
103
|
|
104
|
Public Property TRIMLINES As List(Of LineNumber)
|
105
|
Get
|
106
|
Return _TRIMLINES
|
107
|
End Get
|
108
|
Set(value As List(Of LineNumber))
|
109
|
_TRIMLINES = value
|
110
|
End Set
|
111
|
End Property
|
112
|
|
113
|
Public Property TEXTS As List(Of Text)
|
114
|
Get
|
115
|
Return _TEXTS
|
116
|
End Get
|
117
|
Set(value As List(Of Text))
|
118
|
_TEXTS = value
|
119
|
End Set
|
120
|
End Property
|
121
|
End Class
|
122
|
|
123
|
|
124
|
Public Class Line_no
|
125
|
Private _UID As String = ""
|
126
|
Private _TEXT As String = ""
|
127
|
Private _LOCATION As String = ""
|
128
|
Private _ANGLE As String = ""
|
129
|
Private _SYSTEMPATH As String = ""
|
130
|
|
131
|
Private _Line_Dt As DataTable
|
132
|
Private _Symbol_Dt As DataTable
|
133
|
Private _Attribute_Dt As DataTable
|
134
|
|
135
|
Private _Line As List(Of Line)
|
136
|
Private _Symbol As List(Of Symbol)
|
137
|
Private _Attribute As List(Of Attribute)
|
138
|
|
139
|
Public Property Uid() As String
|
140
|
Get
|
141
|
Return _UID
|
142
|
End Get
|
143
|
Set(value As String)
|
144
|
_UID = value
|
145
|
End Set
|
146
|
End Property
|
147
|
|
148
|
Public Property Text() As String
|
149
|
Get
|
150
|
Return _TEXT
|
151
|
End Get
|
152
|
Set(value As String)
|
153
|
_TEXT = value
|
154
|
End Set
|
155
|
End Property
|
156
|
|
157
|
Public Property Location() As String
|
158
|
Get
|
159
|
Return _LOCATION
|
160
|
End Get
|
161
|
Set(value As String)
|
162
|
_LOCATION = value
|
163
|
End Set
|
164
|
End Property
|
165
|
|
166
|
Public Property Angle() As String
|
167
|
Get
|
168
|
Return _ANGLE
|
169
|
End Get
|
170
|
Set(value As String)
|
171
|
_ANGLE = value
|
172
|
End Set
|
173
|
End Property
|
174
|
|
175
|
Public Property SystemPath() As String
|
176
|
Get
|
177
|
Return _SYSTEMPATH
|
178
|
End Get
|
179
|
Set(value As String)
|
180
|
_SYSTEMPATH = value
|
181
|
End Set
|
182
|
End Property
|
183
|
|
184
|
Public Property Dt_Line As DataTable
|
185
|
Get
|
186
|
Return _Line_Dt
|
187
|
End Get
|
188
|
Set(value As DataTable)
|
189
|
_Line_Dt = value
|
190
|
End Set
|
191
|
End Property
|
192
|
|
193
|
Public Property Dt_Symbol As DataTable
|
194
|
Get
|
195
|
Return _Symbol_Dt
|
196
|
End Get
|
197
|
Set(value As DataTable)
|
198
|
_Symbol_Dt = value
|
199
|
End Set
|
200
|
End Property
|
201
|
|
202
|
Public Property Dt_Attribute As DataTable
|
203
|
Get
|
204
|
Return _Attribute_Dt
|
205
|
End Get
|
206
|
Set(value As DataTable)
|
207
|
_Attribute_Dt = value
|
208
|
End Set
|
209
|
End Property
|
210
|
|
211
|
Public Property Line As List(Of Line)
|
212
|
Get
|
213
|
Return _Line
|
214
|
End Get
|
215
|
Set(value As List(Of Line))
|
216
|
_Line = value
|
217
|
End Set
|
218
|
End Property
|
219
|
|
220
|
Public Property Symbol As List(Of Symbol)
|
221
|
Get
|
222
|
Return _Symbol
|
223
|
End Get
|
224
|
Set(value As List(Of Symbol))
|
225
|
_Symbol = value
|
226
|
End Set
|
227
|
End Property
|
228
|
|
229
|
Public Property Attribute As List(Of Attribute)
|
230
|
Get
|
231
|
Return _Attribute
|
232
|
End Get
|
233
|
Set(value As List(Of Attribute))
|
234
|
_Attribute = value
|
235
|
End Set
|
236
|
End Property
|
237
|
|
238
|
End Class
|
239
|
Public Class Eqp_no
|
240
|
Private _UID As String = ""
|
241
|
Private _TEXT As String = ""
|
242
|
Private _LOCATION As String = ""
|
243
|
Private _ANGLE As String = ""
|
244
|
Private _SYSTEMPATH As String = ""
|
245
|
|
246
|
Private _Eqp_Dt As DataTable
|
247
|
Private _Attribute_Dt As DataTable
|
248
|
|
249
|
|
250
|
Public Property Uid() As String
|
251
|
Get
|
252
|
Return _UID
|
253
|
End Get
|
254
|
Set(value As String)
|
255
|
_UID = value
|
256
|
End Set
|
257
|
End Property
|
258
|
|
259
|
Public Property Text() As String
|
260
|
Get
|
261
|
Return _TEXT
|
262
|
End Get
|
263
|
Set(value As String)
|
264
|
_TEXT = value
|
265
|
End Set
|
266
|
End Property
|
267
|
|
268
|
Public Property Location() As String
|
269
|
Get
|
270
|
Return _LOCATION
|
271
|
End Get
|
272
|
Set(value As String)
|
273
|
_LOCATION = value
|
274
|
End Set
|
275
|
End Property
|
276
|
|
277
|
Public Property Angle() As String
|
278
|
Get
|
279
|
Return _ANGLE
|
280
|
End Get
|
281
|
Set(value As String)
|
282
|
_ANGLE = value
|
283
|
End Set
|
284
|
End Property
|
285
|
|
286
|
Public Property SystemPath() As String
|
287
|
Get
|
288
|
Return _SYSTEMPATH
|
289
|
End Get
|
290
|
Set(value As String)
|
291
|
_SYSTEMPATH = value
|
292
|
End Set
|
293
|
End Property
|
294
|
Public Property Dt_Equipment As DataTable
|
295
|
Get
|
296
|
Return _Eqp_Dt
|
297
|
End Get
|
298
|
Set(value As DataTable)
|
299
|
_Eqp_Dt = value
|
300
|
End Set
|
301
|
End Property
|
302
|
|
303
|
Public Property Dt_Attribute As DataTable
|
304
|
Get
|
305
|
Return _Attribute_Dt
|
306
|
End Get
|
307
|
Set(value As DataTable)
|
308
|
_Attribute_Dt = value
|
309
|
End Set
|
310
|
End Property
|
311
|
|
312
|
End Class
|
313
|
|
314
|
|
315
|
|
316
|
|
317
|
|
318
|
|
319
|
|
320
|
|
321
|
|
322
|
|
323
|
|
324
|
|
325
|
|
326
|
|
327
|
|
328
|
|
329
|
Public Enum SPPID_ITEM_TYPE
|
330
|
SYMBOL
|
331
|
LINE
|
332
|
LABEL
|
333
|
TEXT
|
334
|
End Enum
|
335
|
|
336
|
Public MustInherit Class SPPID_ITEM
|
337
|
Private _UID As String
|
338
|
Private _TYPE As String
|
339
|
Private _NAME As String
|
340
|
Private _SPPID_TYPE As SPPID_ITEM_TYPE
|
341
|
Private _SPPIDMAPPINGNAME As String
|
342
|
Private _GROUPING As Boolean = True
|
343
|
Private _AREA As String
|
344
|
Private _ATTRIBUTES As List(Of Attribute) = New List(Of Attribute)
|
345
|
Private _SPPID_ITEM_OBJECT As Object
|
346
|
|
347
|
Public Property UID As String
|
348
|
Get
|
349
|
Return _UID
|
350
|
End Get
|
351
|
Set(value As String)
|
352
|
_UID = value
|
353
|
End Set
|
354
|
End Property
|
355
|
|
356
|
Public Property TYPE As String
|
357
|
Get
|
358
|
Return _TYPE
|
359
|
End Get
|
360
|
Set(value As String)
|
361
|
_TYPE = value
|
362
|
End Set
|
363
|
End Property
|
364
|
|
365
|
Public Property NAME As String
|
366
|
Get
|
367
|
Return _NAME
|
368
|
End Get
|
369
|
Set(value As String)
|
370
|
_NAME = value
|
371
|
End Set
|
372
|
End Property
|
373
|
|
374
|
Public Property SPPID_TYPE As SPPID_ITEM_TYPE
|
375
|
Get
|
376
|
Return _SPPID_TYPE
|
377
|
End Get
|
378
|
Set(value As SPPID_ITEM_TYPE)
|
379
|
_SPPID_TYPE = value
|
380
|
End Set
|
381
|
End Property
|
382
|
|
383
|
Public Property SPPIDMAPPINGNAME As String
|
384
|
Get
|
385
|
Return _SPPIDMAPPINGNAME
|
386
|
End Get
|
387
|
Set(value As String)
|
388
|
_SPPIDMAPPINGNAME = value
|
389
|
End Set
|
390
|
End Property
|
391
|
|
392
|
Public Property GROUPING As Boolean
|
393
|
Get
|
394
|
Return _GROUPING
|
395
|
End Get
|
396
|
Set(value As Boolean)
|
397
|
_GROUPING = value
|
398
|
End Set
|
399
|
End Property
|
400
|
|
401
|
Public Property AREA As String
|
402
|
Get
|
403
|
Return _AREA
|
404
|
End Get
|
405
|
Set(value As String)
|
406
|
_AREA = value
|
407
|
End Set
|
408
|
End Property
|
409
|
|
410
|
Public Property ATTRIBUTES As List(Of Attribute)
|
411
|
Get
|
412
|
Return _ATTRIBUTES
|
413
|
End Get
|
414
|
Set(value As List(Of Attribute))
|
415
|
_ATTRIBUTES = value
|
416
|
End Set
|
417
|
End Property
|
418
|
|
419
|
Public Property SPPID_ITEM_OBJECT As Object
|
420
|
Get
|
421
|
Return _SPPID_ITEM_OBJECT
|
422
|
End Get
|
423
|
Set(value As Object)
|
424
|
_SPPID_ITEM_OBJECT = value
|
425
|
End Set
|
426
|
End Property
|
427
|
|
428
|
Public MustOverride Sub Modeling()
|
429
|
Public MustOverride Sub AfterSetting()
|
430
|
Public MustOverride Sub SetAttribute()
|
431
|
|
432
|
Public Function FindObjectByUID(ByVal UID As String) As Object
|
433
|
|
434
|
For Each item As Symbol In AutoModeling.CDrawing.SYMBOLS
|
435
|
If item.UID = UID Then
|
436
|
Return item
|
437
|
End If
|
438
|
Next
|
439
|
|
440
|
For Each item As Line In AutoModeling.CDrawing.LINES
|
441
|
If item.UID = UID Then
|
442
|
Return item
|
443
|
End If
|
444
|
Next
|
445
|
|
446
|
Return Nothing
|
447
|
End Function
|
448
|
End Class
|
449
|
|
450
|
Public Class Symbol
|
451
|
Inherits SPPID_ITEM
|
452
|
|
453
|
Private _ORIGINALPOINT As String
|
454
|
Private _CONNECTORS As List(Of Connector)
|
455
|
Private _LOCATION As String
|
456
|
Private _SIZE As String
|
457
|
Private _ANGLE As String
|
458
|
Private _PARENT As String
|
459
|
Private _CHILD As List(Of String) = New List(Of String)
|
460
|
Private _CHILD_SPPID_ITEM_OBJECT As List(Of Object) = New List(Of Object)
|
461
|
Private _HASINSTRUMENTLABEL As String
|
462
|
Private _CURRENTPOINTMODEINDEX As String
|
463
|
|
464
|
Private _DRAWCHECKED As Boolean
|
465
|
|
466
|
Private _LOCATION_X As Double
|
467
|
Private _LOCATION_Y As Double
|
468
|
|
469
|
Private _LINENUMBER As LineNumber
|
470
|
Private _MIRROR As Integer = 0
|
471
|
|
472
|
Public Property ORIGINALPOINT As String
|
473
|
Get
|
474
|
Return _ORIGINALPOINT
|
475
|
End Get
|
476
|
Set(value As String)
|
477
|
_ORIGINALPOINT = value
|
478
|
End Set
|
479
|
End Property
|
480
|
|
481
|
Public Property CONNECTORS As List(Of Connector)
|
482
|
Get
|
483
|
Return _CONNECTORS
|
484
|
End Get
|
485
|
Set(value As List(Of Connector))
|
486
|
_CONNECTORS = value
|
487
|
End Set
|
488
|
End Property
|
489
|
|
490
|
Public Property LOCATION As String
|
491
|
Get
|
492
|
Return _LOCATION
|
493
|
End Get
|
494
|
Set(value As String)
|
495
|
_LOCATION = value
|
496
|
End Set
|
497
|
End Property
|
498
|
|
499
|
Public Property SIZE As String
|
500
|
Get
|
501
|
Return _SIZE
|
502
|
End Get
|
503
|
Set(value As String)
|
504
|
_SIZE = value
|
505
|
End Set
|
506
|
End Property
|
507
|
|
508
|
Public Property ANGLE As String
|
509
|
Get
|
510
|
Return _ANGLE
|
511
|
End Get
|
512
|
Set(value As String)
|
513
|
_ANGLE = value
|
514
|
End Set
|
515
|
End Property
|
516
|
|
517
|
Public Property PARENT As String
|
518
|
Get
|
519
|
Return _PARENT
|
520
|
End Get
|
521
|
Set(value As String)
|
522
|
_PARENT = value
|
523
|
End Set
|
524
|
End Property
|
525
|
|
526
|
Public Property HASINSTRUMENTLABEL As String
|
527
|
Get
|
528
|
Return _HASINSTRUMENTLABEL
|
529
|
End Get
|
530
|
Set(value As String)
|
531
|
_HASINSTRUMENTLABEL = value
|
532
|
End Set
|
533
|
End Property
|
534
|
|
535
|
Public Property CURRENTPOINTMODEINDEX As String
|
536
|
Get
|
537
|
Return _CURRENTPOINTMODEINDEX
|
538
|
End Get
|
539
|
Set(value As String)
|
540
|
_CURRENTPOINTMODEINDEX = value
|
541
|
End Set
|
542
|
End Property
|
543
|
|
544
|
Public Property DRAWCHECKED As Boolean
|
545
|
Get
|
546
|
Return _DRAWCHECKED
|
547
|
End Get
|
548
|
Set(value As Boolean)
|
549
|
_DRAWCHECKED = value
|
550
|
End Set
|
551
|
End Property
|
552
|
|
553
|
Public Property LOCATION_X As Double
|
554
|
Get
|
555
|
Return _LOCATION_X
|
556
|
End Get
|
557
|
Set(value As Double)
|
558
|
_LOCATION_X = value
|
559
|
End Set
|
560
|
End Property
|
561
|
|
562
|
Public Property LOCATION_Y As Double
|
563
|
Get
|
564
|
Return _LOCATION_Y
|
565
|
End Get
|
566
|
Set(value As Double)
|
567
|
_LOCATION_Y = value
|
568
|
End Set
|
569
|
End Property
|
570
|
|
571
|
Public Property LINENUMBER As LineNumber
|
572
|
Get
|
573
|
Return _LINENUMBER
|
574
|
End Get
|
575
|
Set(value As LineNumber)
|
576
|
_LINENUMBER = value
|
577
|
End Set
|
578
|
End Property
|
579
|
|
580
|
Public Property MIRROR As Integer
|
581
|
Get
|
582
|
Return _MIRROR
|
583
|
End Get
|
584
|
Set(value As Integer)
|
585
|
_MIRROR = value
|
586
|
End Set
|
587
|
End Property
|
588
|
|
589
|
Public Property CHILD As List(Of String)
|
590
|
Get
|
591
|
Return _CHILD
|
592
|
End Get
|
593
|
Set(value As List(Of String))
|
594
|
_CHILD = value
|
595
|
End Set
|
596
|
End Property
|
597
|
|
598
|
Public Property CHILD_SPPID_ITEM_OBJECT As List(Of Object)
|
599
|
Get
|
600
|
Return _CHILD_SPPID_ITEM_OBJECT
|
601
|
End Get
|
602
|
Set(value As List(Of Object))
|
603
|
_CHILD_SPPID_ITEM_OBJECT = value
|
604
|
End Set
|
605
|
End Property
|
606
|
|
607
|
Public Overrides Sub Modeling()
|
608
|
|
609
|
Dim _Placement As Placement = New Placement
|
610
|
Dim sysPath = SPPIDMAPPINGNAME
|
611
|
|
612
|
SPPID_ITEM_OBJECT = Nothing
|
613
|
|
614
|
If sysPath <> "" Then
|
615
|
Dim connectSymbol As LMSymbol = Nothing
|
616
|
|
617
|
For Each connector As Connector In CONNECTORS
|
618
|
If String.IsNullOrEmpty(connector.CONNECTEDITEM) = False Or connector.CONNECTEDITEM <> "None" Then
|
619
|
Dim _sym As Symbol = FindObjectByUID(connector.CONNECTEDITEM)
|
620
|
If _sym IsNot Nothing Then
|
621
|
If _sym.SPPID_ITEM_OBJECT IsNot Nothing Then
|
622
|
connectSymbol = _sym.SPPID_ITEM_OBJECT
|
623
|
Exit For
|
624
|
End If
|
625
|
End If
|
626
|
End If
|
627
|
Next
|
628
|
|
629
|
If connectSymbol IsNot Nothing Then
|
630
|
SPPID_ITEM_OBJECT = _Placement.PIDPlaceSymbol(sysPath, LOCATION_X, LOCATION_Y, Rotation:=ANGLE, Mirror:=MIRROR, TargetItem:=connectSymbol)
|
631
|
Else
|
632
|
SPPID_ITEM_OBJECT = _Placement.PIDPlaceSymbol(sysPath, LOCATION_X, LOCATION_Y, Rotation:=ANGLE, Mirror:=MIRROR)
|
633
|
End If
|
634
|
|
635
|
'' Check Child
|
636
|
For Each _child As String In CHILD
|
637
|
Dim arrChild As String() = _child.Split(",")
|
638
|
Dim arrow As String = arrChild(0)
|
639
|
Dim mappingName As String = arrChild(1)
|
640
|
|
641
|
Dim childAngle As Double = 0
|
642
|
If arrow = "UP" Then
|
643
|
childAngle = 0
|
644
|
ElseIf arrow = "RIGHT" Then
|
645
|
childAngle = 90 * Math.PI / 180
|
646
|
ElseIf arrow = "DOWN" Then
|
647
|
childAngle = Math.PI
|
648
|
Else
|
649
|
childAngle = 270 * Math.PI / 180
|
650
|
End If
|
651
|
|
652
|
Dim _childLmSymbol As LMSymbol = _Placement.PIDPlaceSymbol(mappingName, LOCATION_X, LOCATION_Y, Mirror:=0, Rotation:=childAngle, TargetItem:=SPPID_ITEM_OBJECT)
|
653
|
CHILD_SPPID_ITEM_OBJECT.Add(_childLmSymbol)
|
654
|
Next
|
655
|
|
656
|
SPPID_ITEM_OBJECT.Commit()
|
657
|
Debug.WriteLine(LOCATION_X.ToString + "," + LOCATION_Y.ToString + "/" + UID + "/" + SIZE)
|
658
|
End If
|
659
|
End Sub
|
660
|
|
661
|
Public Overrides Sub AfterSetting()
|
662
|
'' Angle Setting
|
663
|
If ANGLE = 1.57 Then
|
664
|
ANGLE = 90 * Math.PI / 180
|
665
|
ElseIf ANGLE = 3.14 Then
|
666
|
ANGLE = Math.PI
|
667
|
ElseIf ANGLE = 4.71 Then
|
668
|
ANGLE = 270 * Math.PI / 180
|
669
|
Else
|
670
|
ANGLE = 0
|
671
|
End If
|
672
|
'' end
|
673
|
|
674
|
'' Location Setting
|
675
|
Dim OriginX As Double
|
676
|
Dim OriginY As Double
|
677
|
Main.ConvertPointBystring(_ORIGINALPOINT, OriginX, OriginY)
|
678
|
Main.ConvertPointByImage(OriginX, OriginY, Main._IMG_X, Main._IMG_Y)
|
679
|
_LOCATION_X = OriginX
|
680
|
_LOCATION_Y = OriginY
|
681
|
'' end
|
682
|
|
683
|
'' SPPID Type Setting
|
684
|
SPPID_TYPE = SPPID_ITEM_TYPE.SYMBOL
|
685
|
'' end
|
686
|
|
687
|
End Sub
|
688
|
|
689
|
Public Overrides Sub SetAttribute()
|
690
|
Throw New NotImplementedException()
|
691
|
End Sub
|
692
|
End Class
|
693
|
|
694
|
Public Enum SlopType
|
695
|
NONE
|
696
|
VERTICAL
|
697
|
HORIZONTAL
|
698
|
SLOPE
|
699
|
End Enum
|
700
|
|
701
|
Public Class Line
|
702
|
Inherits SPPID_ITEM
|
703
|
|
704
|
Private _STARTPOINT As String
|
705
|
Private _ENDPOINT As String
|
706
|
Private _CONNECTORS As List(Of Connector)
|
707
|
|
708
|
Private _LINENUMBER As LineNumber
|
709
|
|
710
|
Private _LMCONNECTOR_MODELID As String
|
711
|
|
712
|
Private _SLOPTYPE As SlopType
|
713
|
|
714
|
Private _START_X As Double
|
715
|
Private _START_Y As Double
|
716
|
Private _END_X As Double
|
717
|
Private _END_Y As Double
|
718
|
|
719
|
Public Property STARTPOINT As String
|
720
|
Get
|
721
|
Return _STARTPOINT
|
722
|
End Get
|
723
|
Set(value As String)
|
724
|
_STARTPOINT = value
|
725
|
End Set
|
726
|
End Property
|
727
|
|
728
|
Public Property ENDPOINT As String
|
729
|
Get
|
730
|
Return _ENDPOINT
|
731
|
End Get
|
732
|
Set(value As String)
|
733
|
_ENDPOINT = value
|
734
|
End Set
|
735
|
End Property
|
736
|
|
737
|
Public Property CONNECTORS As List(Of Connector)
|
738
|
Get
|
739
|
Return _CONNECTORS
|
740
|
End Get
|
741
|
Set(value As List(Of Connector))
|
742
|
_CONNECTORS = value
|
743
|
End Set
|
744
|
End Property
|
745
|
|
746
|
Public Property LINENUMBER As LineNumber
|
747
|
Get
|
748
|
Return _LINENUMBER
|
749
|
End Get
|
750
|
Set(value As LineNumber)
|
751
|
_LINENUMBER = value
|
752
|
End Set
|
753
|
End Property
|
754
|
|
755
|
Public Property START_X As Double
|
756
|
Get
|
757
|
Return _START_X
|
758
|
End Get
|
759
|
Set(value As Double)
|
760
|
_START_X = value
|
761
|
End Set
|
762
|
End Property
|
763
|
|
764
|
Public Property START_Y As Double
|
765
|
Get
|
766
|
Return _START_Y
|
767
|
End Get
|
768
|
Set(value As Double)
|
769
|
_START_Y = value
|
770
|
End Set
|
771
|
End Property
|
772
|
|
773
|
Public Property END_X As Double
|
774
|
Get
|
775
|
Return _END_X
|
776
|
End Get
|
777
|
Set(value As Double)
|
778
|
_END_X = value
|
779
|
End Set
|
780
|
End Property
|
781
|
|
782
|
Public Property END_Y As Double
|
783
|
Get
|
784
|
Return _END_Y
|
785
|
End Get
|
786
|
Set(value As Double)
|
787
|
_END_Y = value
|
788
|
End Set
|
789
|
End Property
|
790
|
|
791
|
Public Property LMCONNECTOR_MODELID As String
|
792
|
Get
|
793
|
Return _LMCONNECTOR_MODELID
|
794
|
End Get
|
795
|
Set(value As String)
|
796
|
_LMCONNECTOR_MODELID = value
|
797
|
End Set
|
798
|
End Property
|
799
|
|
800
|
Public Property SLOPTYPE As SlopType
|
801
|
Get
|
802
|
Return _SLOPTYPE
|
803
|
End Get
|
804
|
Set(value As SlopType)
|
805
|
_SLOPTYPE = value
|
806
|
End Set
|
807
|
End Property
|
808
|
|
809
|
Public Overrides Sub Modeling()
|
810
|
Throw New NotImplementedException()
|
811
|
End Sub
|
812
|
|
813
|
Public Overrides Sub AfterSetting()
|
814
|
|
815
|
'' Point Setting
|
816
|
Main.ConvertPointBystring(_STARTPOINT, _START_X, _START_Y)
|
817
|
Main.ConvertPointByImage(_START_X, _START_Y, Main._IMG_X, Main._IMG_Y)
|
818
|
Main.ConvertPointBystring(_ENDPOINT, _END_X, _END_Y)
|
819
|
Main.ConvertPointByImage(_END_X, _END_Y, Main._IMG_X, Main._IMG_Y)
|
820
|
'' end
|
821
|
|
822
|
'' Slop Setting
|
823
|
_SLOPTYPE = CalcSlop(New Pointd(_START_X, _START_Y), New Pointd(_END_X, _END_Y))
|
824
|
'' end
|
825
|
|
826
|
'' SPPID Type Setting
|
827
|
SPPID_TYPE = SPPID_ITEM_TYPE.LINE
|
828
|
'' end
|
829
|
End Sub
|
830
|
|
831
|
Private Function CalcSlop(ByVal point1 As Pointd, ByVal point2 As Pointd) As SlopType
|
832
|
If point1.X - point2.X = 0 Then
|
833
|
Return SlopType.VERTICAL
|
834
|
Else
|
835
|
Dim angle = Math.Atan(Math.Abs(point2.Y - point1.Y) / Math.Abs(point2.X - point1.X)) * 180 / Math.PI
|
836
|
|
837
|
If angle < 20 Then
|
838
|
Return SlopType.HORIZONTAL
|
839
|
ElseIf angle > 70 Then
|
840
|
Return SlopType.VERTICAL
|
841
|
Else
|
842
|
Return SlopType.SLOPE
|
843
|
End If
|
844
|
End If
|
845
|
End Function
|
846
|
|
847
|
Public Overrides Sub SetAttribute()
|
848
|
Throw New NotImplementedException()
|
849
|
End Sub
|
850
|
End Class
|
851
|
|
852
|
Public Class LineNumber
|
853
|
Inherits SPPID_ITEM
|
854
|
|
855
|
Private _ANGLE As String
|
856
|
Private _LOCATION As String
|
857
|
Private _LOCATION_X As Double
|
858
|
Private _LOCATION_Y As Double
|
859
|
Private _SYMBOLRUNITEMS As List(Of String)
|
860
|
Private _LINERUNITEMS As List(Of String)
|
861
|
Private _TEXT As String
|
862
|
Private _CONNECTLINE As String
|
863
|
Private _TARGETLINE As Line
|
864
|
|
865
|
Public Property ANGLE As String
|
866
|
Get
|
867
|
Return _ANGLE
|
868
|
End Get
|
869
|
Set(value As String)
|
870
|
_ANGLE = value
|
871
|
End Set
|
872
|
End Property
|
873
|
|
874
|
Public Property SYMBOLRUNITEMS As List(Of String)
|
875
|
Get
|
876
|
Return _SYMBOLRUNITEMS
|
877
|
End Get
|
878
|
Set(value As List(Of String))
|
879
|
_SYMBOLRUNITEMS = value
|
880
|
End Set
|
881
|
End Property
|
882
|
|
883
|
Public Property LINERUNITEMS As List(Of String)
|
884
|
Get
|
885
|
Return _LINERUNITEMS
|
886
|
End Get
|
887
|
Set(value As List(Of String))
|
888
|
_LINERUNITEMS = value
|
889
|
End Set
|
890
|
End Property
|
891
|
|
892
|
Public Property TEXT As String
|
893
|
Get
|
894
|
Return _TEXT
|
895
|
End Get
|
896
|
Set(value As String)
|
897
|
_TEXT = value
|
898
|
End Set
|
899
|
End Property
|
900
|
|
901
|
Public Property CONNECTLINE As String
|
902
|
Get
|
903
|
Return _CONNECTLINE
|
904
|
End Get
|
905
|
Set(value As String)
|
906
|
_CONNECTLINE = value
|
907
|
End Set
|
908
|
End Property
|
909
|
|
910
|
Public Property TARGETLINE As Line
|
911
|
Get
|
912
|
Return _TARGETLINE
|
913
|
End Get
|
914
|
Set(value As Line)
|
915
|
_TARGETLINE = value
|
916
|
End Set
|
917
|
End Property
|
918
|
|
919
|
Public Property LOCATION_X As Double
|
920
|
Get
|
921
|
Return _LOCATION_X
|
922
|
End Get
|
923
|
Set(value As Double)
|
924
|
_LOCATION_X = value
|
925
|
End Set
|
926
|
End Property
|
927
|
|
928
|
Public Property LOCATION_Y As Double
|
929
|
Get
|
930
|
Return _LOCATION_Y
|
931
|
End Get
|
932
|
Set(value As Double)
|
933
|
_LOCATION_Y = value
|
934
|
End Set
|
935
|
End Property
|
936
|
|
937
|
Public Property LOCATION As String
|
938
|
Get
|
939
|
Return _LOCATION
|
940
|
End Get
|
941
|
Set(value As String)
|
942
|
_LOCATION = value
|
943
|
End Set
|
944
|
End Property
|
945
|
|
946
|
Public Overrides Sub AfterSetting()
|
947
|
'' Angle Setting
|
948
|
If ANGLE = 1.57 Then
|
949
|
ANGLE = 90 * Math.PI / 180
|
950
|
ElseIf ANGLE = 3.14 Then
|
951
|
ANGLE = Math.PI
|
952
|
ElseIf ANGLE = 4.71 Then
|
953
|
ANGLE = 270 * Math.PI / 180
|
954
|
Else
|
955
|
ANGLE = 0
|
956
|
End If
|
957
|
'' end
|
958
|
|
959
|
'' Location Setting
|
960
|
Main.ConvertPointBystring(LOCATION, LOCATION_X, LOCATION_Y)
|
961
|
Main.ConvertPointByImage(LOCATION_X, LOCATION_Y, Main._IMG_X, Main._IMG_Y)
|
962
|
'' end
|
963
|
|
964
|
'' SPPID Type Setting
|
965
|
SPPID_TYPE = SPPID_ITEM_TYPE.LABEL
|
966
|
'' end
|
967
|
End Sub
|
968
|
|
969
|
Public Overrides Sub Modeling()
|
970
|
Try
|
971
|
If TARGETLINE IsNot Nothing Then
|
972
|
If String.IsNullOrEmpty(TARGETLINE.LMCONNECTOR_MODELID) = False Then
|
973
|
Dim _Placement As Placement = New Placement
|
974
|
Dim points(2) As Double
|
975
|
points(1) = LOCATION_X
|
976
|
points(2) = LOCATION_Y
|
977
|
|
978
|
Dim _lmPipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(TARGETLINE.LMCONNECTOR_MODELID)
|
979
|
If _lmPipeRun IsNot Nothing Then
|
980
|
For Each representation As LMRepresentation In _lmPipeRun.Representations
|
981
|
If representation.RepresentationType = "Connector" And representation.ItemStatus = "Active" Then
|
982
|
Dim _lmConnector As LMConnector = _Placement.PIDDataSource.GetConnector(representation.Id)
|
983
|
SPPID_ITEM_OBJECT = _Placement.PIDPlaceLabel(SPPIDMAPPINGNAME, points, Rotation:=ANGLE, LabeledItem:=_lmConnector.AsLMRepresentation, IsLeaderVisible:=True)
|
984
|
Exit For
|
985
|
End If
|
986
|
Next
|
987
|
End If
|
988
|
End If
|
989
|
End If
|
990
|
Catch ex As Exception
|
991
|
Console.WriteLine(ex.Message)
|
992
|
End Try
|
993
|
End Sub
|
994
|
|
995
|
Public Overrides Sub SetAttribute()
|
996
|
If TARGETLINE IsNot Nothing Then
|
997
|
Dim _Placement As Placement = New Placement
|
998
|
Dim _PipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(TARGETLINE.LMCONNECTOR_MODELID)
|
999
|
|
1000
|
For Each _attr As Attribute In ATTRIBUTES
|
1001
|
If String.IsNullOrEmpty(_attr.VALUE) Then
|
1002
|
Continue For
|
1003
|
End If
|
1004
|
|
1005
|
Try
|
1006
|
_PipeRun.Attributes(_attr.NAME).Value = _attr.VALUE
|
1007
|
Catch ex As Exception
|
1008
|
Console.WriteLine(_attr.NAME)
|
1009
|
End Try
|
1010
|
Next
|
1011
|
_PipeRun.Commit()
|
1012
|
|
1013
|
End If
|
1014
|
End Sub
|
1015
|
End Class
|
1016
|
|
1017
|
Public Class Text
|
1018
|
Inherits SPPID_ITEM
|
1019
|
|
1020
|
Private _ANGLE As String
|
1021
|
Private _LOCATION As String
|
1022
|
Private _LOCATION_X As Double
|
1023
|
Private _LOCATION_Y As Double
|
1024
|
Private _TEXT As String
|
1025
|
Private _OWNER As String
|
1026
|
|
1027
|
Public Property ANGLE As String
|
1028
|
Get
|
1029
|
Return _ANGLE
|
1030
|
End Get
|
1031
|
Set(value As String)
|
1032
|
_ANGLE = value
|
1033
|
End Set
|
1034
|
End Property
|
1035
|
|
1036
|
Public Property LOCATION As String
|
1037
|
Get
|
1038
|
Return _LOCATION
|
1039
|
End Get
|
1040
|
Set(value As String)
|
1041
|
_LOCATION = value
|
1042
|
End Set
|
1043
|
End Property
|
1044
|
|
1045
|
Public Property LOCATION_X As Double
|
1046
|
Get
|
1047
|
Return _LOCATION_X
|
1048
|
End Get
|
1049
|
Set(value As Double)
|
1050
|
_LOCATION_X = value
|
1051
|
End Set
|
1052
|
End Property
|
1053
|
|
1054
|
Public Property LOCATION_Y As Double
|
1055
|
Get
|
1056
|
Return _LOCATION_Y
|
1057
|
End Get
|
1058
|
Set(value As Double)
|
1059
|
_LOCATION_Y = value
|
1060
|
End Set
|
1061
|
End Property
|
1062
|
|
1063
|
Public Property TEXT As String
|
1064
|
Get
|
1065
|
Return _TEXT
|
1066
|
End Get
|
1067
|
Set(value As String)
|
1068
|
_TEXT = value
|
1069
|
End Set
|
1070
|
End Property
|
1071
|
|
1072
|
Public Property OWNER As String
|
1073
|
Get
|
1074
|
Return _OWNER
|
1075
|
End Get
|
1076
|
Set(value As String)
|
1077
|
_OWNER = value
|
1078
|
End Set
|
1079
|
End Property
|
1080
|
|
1081
|
Public Overrides Sub AfterSetting()
|
1082
|
'' Angle Setting
|
1083
|
If ANGLE = 1.57 Then
|
1084
|
ANGLE = 90 * Math.PI / 180
|
1085
|
ElseIf ANGLE = 3.14 Then
|
1086
|
ANGLE = Math.PI
|
1087
|
ElseIf ANGLE = 4.71 Then
|
1088
|
ANGLE = 270 * Math.PI / 180
|
1089
|
Else
|
1090
|
ANGLE = 0
|
1091
|
End If
|
1092
|
'' end
|
1093
|
|
1094
|
'' Location Setting
|
1095
|
Main.ConvertPointBystring(LOCATION, LOCATION_X, LOCATION_Y)
|
1096
|
Main.ConvertPointByImage(LOCATION_X, LOCATION_Y, Main._IMG_X, Main._IMG_Y)
|
1097
|
'' end
|
1098
|
|
1099
|
'' SPPID Type Setting
|
1100
|
SPPID_TYPE = SPPID_ITEM_TYPE.TEXT
|
1101
|
'' end
|
1102
|
End Sub
|
1103
|
|
1104
|
|
1105
|
Public Overrides Sub Modeling()
|
1106
|
Try
|
1107
|
Dim _Placement As Placement = New Placement
|
1108
|
If NAME = "TEXT" Then
|
1109
|
Dim _lmSymbol As LMSymbol = _Placement.PIDPlaceSymbol(SPPIDMAPPINGNAME, LOCATION_X, LOCATION_Y, Rotation:=ANGLE)
|
1110
|
SPPID_ITEM_OBJECT = _Placement.PIDDataSource.GetItemNote(_lmSymbol.ModelItemID)
|
1111
|
SPPID_ITEM_OBJECT.Attributes("Note.Body").Value = TEXT
|
1112
|
ElseIf NAME = "SIZE" Then
|
1113
|
Dim _obj As Object = FindObjectByUID(OWNER)
|
1114
|
If String.IsNullOrEmpty(OWNER) = False Then
|
1115
|
Dim points(2) As Double
|
1116
|
points(1) = LOCATION_X
|
1117
|
points(2) = LOCATION_Y
|
1118
|
|
1119
|
If TypeOf (_obj) Is Symbol Then
|
1120
|
Dim _symbol As Symbol = _obj
|
1121
|
Dim _lmSymbol As LMSymbol = _symbol.SPPID_ITEM_OBJECT
|
1122
|
|
1123
|
If _lmSymbol.FileName.ToString().Contains("Piping") Then
|
1124
|
SPPIDMAPPINGNAME = "\Piping\Labels - Piping Components\Nominal Diameter.sym"
|
1125
|
ElseIf _lmSymbol.FileName.ToString().Contains("Instrumentation") Then
|
1126
|
SPPIDMAPPINGNAME = "\Instrumentation\Labels - General Instrument\Nominal Diameter.sym"
|
1127
|
End If
|
1128
|
|
1129
|
SPPID_ITEM_OBJECT = _Placement.PIDPlaceLabel(SPPIDMAPPINGNAME, points, Rotation:=ANGLE, LabeledItem:=_lmSymbol.AsLMRepresentation, IsLeaderVisible:=True)
|
1130
|
|
1131
|
End If
|
1132
|
End If
|
1133
|
End If
|
1134
|
Catch ex As Exception
|
1135
|
Console.WriteLine(ex.Message)
|
1136
|
End Try
|
1137
|
End Sub
|
1138
|
Public Overrides Sub SetAttribute()
|
1139
|
Try
|
1140
|
Dim _obj As Object = FindObjectByUID(OWNER)
|
1141
|
If String.IsNullOrEmpty(OWNER) = False Then
|
1142
|
Dim _Placement As Placement = New Placement
|
1143
|
If NAME = "SIZE" Then
|
1144
|
If TypeOf (_obj) Is Symbol Then
|
1145
|
Try
|
1146
|
Dim _symbol As Symbol = _obj
|
1147
|
Dim _lmSymbol As LMSymbol = _symbol.SPPID_ITEM_OBJECT
|
1148
|
|
1149
|
If _lmSymbol.FileName.ToString().Contains("Piping") Then
|
1150
|
Dim _lmPipingComp As LMPipingComp = _Placement.PIDDataSource.GetPipingComp(_lmSymbol.ModelItemID)
|
1151
|
If DBNull.Value.Equals(_lmPipingComp.Attributes("NominalDiameter").Value) Then
|
1152
|
_lmPipingComp.Attributes("NominalDiameter").Value = TEXT
|
1153
|
_lmPipingComp.Commit()
|
1154
|
End If
|
1155
|
ElseIf _lmSymbol.FileName.ToString().Contains("Instrumentation") Then
|
1156
|
Dim _lmInstrument As LMInstrument = _Placement.PIDDataSource.GetInstrument(_lmSymbol.ModelItemID)
|
1157
|
If DBNull.Value.Equals(_lmInstrument.Attributes("NominalDiameter").Value) Then
|
1158
|
_lmInstrument.Attributes("NominalDiameter").Value = TEXT
|
1159
|
_lmInstrument.Commit()
|
1160
|
End If
|
1161
|
End If
|
1162
|
Catch ex As Exception
|
1163
|
Console.WriteLine(ex.Message)
|
1164
|
End Try
|
1165
|
|
1166
|
ElseIf TypeOf (_obj) Is Line Then
|
1167
|
Try
|
1168
|
Dim _line As Line = _obj
|
1169
|
Dim _PipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(_line.LMCONNECTOR_MODELID)
|
1170
|
|
1171
|
If DBNull.Value.Equals(_PipeRun.NominalDiameter) Then
|
1172
|
_PipeRun.NominalDiameter = TEXT
|
1173
|
_PipeRun.Commit()
|
1174
|
End If
|
1175
|
Catch ex As Exception
|
1176
|
Console.WriteLine(ex.Message)
|
1177
|
End Try
|
1178
|
End If
|
1179
|
End If
|
1180
|
End If
|
1181
|
|
1182
|
Catch ex As Exception
|
1183
|
Console.WriteLine(ex.Message)
|
1184
|
End Try
|
1185
|
End Sub
|
1186
|
End Class
|
1187
|
|
1188
|
Public Class Attribute
|
1189
|
Private _UID As String
|
1190
|
Private _NAME As String
|
1191
|
Private _VALUE As String
|
1192
|
|
1193
|
Public Property UID As String
|
1194
|
Get
|
1195
|
Return _UID
|
1196
|
End Get
|
1197
|
Set(value As String)
|
1198
|
_UID = value
|
1199
|
End Set
|
1200
|
End Property
|
1201
|
|
1202
|
Public Property NAME As String
|
1203
|
Get
|
1204
|
Return _NAME
|
1205
|
End Get
|
1206
|
Set(value As String)
|
1207
|
_NAME = value
|
1208
|
End Set
|
1209
|
End Property
|
1210
|
|
1211
|
Public Property VALUE As String
|
1212
|
Get
|
1213
|
Return _VALUE
|
1214
|
End Get
|
1215
|
Set(value As String)
|
1216
|
_VALUE = value
|
1217
|
End Set
|
1218
|
End Property
|
1219
|
End Class
|
1220
|
|
1221
|
Public Class Connector
|
1222
|
Private _CONNECTEDITEM As String
|
1223
|
Private _CONNECTPOINT As String
|
1224
|
Private _SCENECONNECTPOINT As String
|
1225
|
|
1226
|
Public Property CONNECTEDITEM As String
|
1227
|
Get
|
1228
|
Return _CONNECTEDITEM
|
1229
|
End Get
|
1230
|
Set(value As String)
|
1231
|
_CONNECTEDITEM = value
|
1232
|
End Set
|
1233
|
End Property
|
1234
|
|
1235
|
Public Property CONNECTPOINT As String
|
1236
|
Get
|
1237
|
Return _CONNECTPOINT
|
1238
|
End Get
|
1239
|
Set(value As String)
|
1240
|
_CONNECTPOINT = value
|
1241
|
End Set
|
1242
|
End Property
|
1243
|
|
1244
|
Public Property SCENECONNECTPOINT As String
|
1245
|
Get
|
1246
|
Return _SCENECONNECTPOINT
|
1247
|
End Get
|
1248
|
Set(value As String)
|
1249
|
_SCENECONNECTPOINT = value
|
1250
|
End Set
|
1251
|
End Property
|
1252
|
End Class
|