프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / Drawing.vb @ 94c7557d

이력 | 보기 | 이력해설 | 다운로드 (30.7 KB)

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 String
460
    Private _HASINSTRUMENTLABEL As String
461
    Private _CURRENTPOINTMODEINDEX As String
462

    
463
    Private _DRAWCHECKED As Boolean
464

    
465
    Private _LOCATION_X As Double
466
    Private _LOCATION_Y As Double
467

    
468
    Private _LINENUMBER As LineNumber
469
    Private _MIRROR As Integer = 0
470

    
471
    Public Property ORIGINALPOINT As String
472
        Get
473
            Return _ORIGINALPOINT
474
        End Get
475
        Set(value As String)
476
            _ORIGINALPOINT = value
477
        End Set
478
    End Property
479

    
480
    Public Property CONNECTORS As List(Of Connector)
481
        Get
482
            Return _CONNECTORS
483
        End Get
484
        Set(value As List(Of Connector))
485
            _CONNECTORS = value
486
        End Set
487
    End Property
488

    
489
    Public Property LOCATION As String
490
        Get
491
            Return _LOCATION
492
        End Get
493
        Set(value As String)
494
            _LOCATION = value
495
        End Set
496
    End Property
497

    
498
    Public Property SIZE As String
499
        Get
500
            Return _SIZE
501
        End Get
502
        Set(value As String)
503
            _SIZE = value
504
        End Set
505
    End Property
506

    
507
    Public Property ANGLE As String
508
        Get
509
            Return _ANGLE
510
        End Get
511
        Set(value As String)
512
            _ANGLE = value
513
        End Set
514
    End Property
515

    
516
    Public Property PARENT As String
517
        Get
518
            Return _PARENT
519
        End Get
520
        Set(value As String)
521
            _PARENT = value
522
        End Set
523
    End Property
524

    
525
    Public Property CHILD As String
526
        Get
527
            Return _CHILD
528
        End Get
529
        Set(value As String)
530
            _CHILD = value
531
        End Set
532
    End Property
533

    
534
    Public Property HASINSTRUMENTLABEL As String
535
        Get
536
            Return _HASINSTRUMENTLABEL
537
        End Get
538
        Set(value As String)
539
            _HASINSTRUMENTLABEL = value
540
        End Set
541
    End Property
542

    
543
    Public Property CURRENTPOINTMODEINDEX As String
544
        Get
545
            Return _CURRENTPOINTMODEINDEX
546
        End Get
547
        Set(value As String)
548
            _CURRENTPOINTMODEINDEX = value
549
        End Set
550
    End Property
551

    
552
    Public Property DRAWCHECKED As Boolean
553
        Get
554
            Return _DRAWCHECKED
555
        End Get
556
        Set(value As Boolean)
557
            _DRAWCHECKED = value
558
        End Set
559
    End Property
560

    
561
    Public Property LOCATION_X As Double
562
        Get
563
            Return _LOCATION_X
564
        End Get
565
        Set(value As Double)
566
            _LOCATION_X = value
567
        End Set
568
    End Property
569

    
570
    Public Property LOCATION_Y As Double
571
        Get
572
            Return _LOCATION_Y
573
        End Get
574
        Set(value As Double)
575
            _LOCATION_Y = value
576
        End Set
577
    End Property
578

    
579
    Public Property LINENUMBER As LineNumber
580
        Get
581
            Return _LINENUMBER
582
        End Get
583
        Set(value As LineNumber)
584
            _LINENUMBER = value
585
        End Set
586
    End Property
587

    
588
    Public Property MIRROR As Integer
589
        Get
590
            Return _MIRROR
591
        End Get
592
        Set(value As Integer)
593
            _MIRROR = value
594
        End Set
595
    End Property
596

    
597
    Public Overrides Sub Modeling()
598

    
599
        Dim _Placement As Placement = New Placement
600
        Dim sysPath = SPPIDMAPPINGNAME
601

    
602
        SPPID_ITEM_OBJECT = Nothing
603

    
604
        If sysPath <> "" Then
605
            Dim connectSymbol As LMSymbol = Nothing
606

    
607
            For Each connector As Connector In CONNECTORS
608
                If String.IsNullOrEmpty(connector.CONNECTEDITEM) = False Or connector.CONNECTEDITEM <> "None" Then
609
                    Dim _sym As Symbol = FindObjectByUID(connector.CONNECTEDITEM)
610
                    If _sym IsNot Nothing Then
611
                        If _sym.SPPID_ITEM_OBJECT IsNot Nothing Then
612
                            connectSymbol = _sym.SPPID_ITEM_OBJECT
613
                            Exit For
614
                        End If
615
                    End If
616
                End If
617
            Next
618

    
619
            If connectSymbol IsNot Nothing Then
620
                SPPID_ITEM_OBJECT = _Placement.PIDPlaceSymbol(sysPath, LOCATION_X, LOCATION_Y, Rotation:=ANGLE, Mirror:=MIRROR, TargetItem:=connectSymbol)
621
            Else
622
                SPPID_ITEM_OBJECT = _Placement.PIDPlaceSymbol(sysPath, LOCATION_X, LOCATION_Y, Rotation:=ANGLE, Mirror:=MIRROR)
623
            End If
624

    
625
            SPPID_ITEM_OBJECT.Commit()
626
            Debug.WriteLine(LOCATION_X.ToString + "," + LOCATION_Y.ToString + "/" + UID + "/" + SIZE)
627
        End If
628
    End Sub
629

    
630
    Public Overrides Sub AfterSetting()
631
        '' Angle Setting
632
        If ANGLE = 1.57 Then
633
            ANGLE = 90 * Math.PI / 180
634
        ElseIf ANGLE = 3.14 Then
635
            ANGLE = Math.PI
636
        ElseIf ANGLE = 4.71 Then
637
            ANGLE = 270 * Math.PI / 180
638
        Else
639
            ANGLE = 0
640
        End If
641
        '' end
642

    
643
        '' Location Setting
644
        Dim OriginX As Double
645
        Dim OriginY As Double
646
        Main.ConvertPointBystring(_ORIGINALPOINT, OriginX, OriginY)
647
        Main.ConvertPointByImage(OriginX, OriginY, Main._IMG_X, Main._IMG_Y)
648
        _LOCATION_X = OriginX
649
        _LOCATION_Y = OriginY
650
        '' end
651

    
652
        '' SPPID Type Setting
653
        SPPID_TYPE = SPPID_ITEM_TYPE.SYMBOL
654
        '' end
655

    
656
    End Sub
657

    
658
    Public Overrides Sub SetAttribute()
659
        Throw New NotImplementedException()
660
    End Sub
661
End Class
662

    
663
Public Enum SlopType
664
    NONE
665
    VERTICAL
666
    HORIZONTAL
667
    SLOPE
668
End Enum
669

    
670
Public Class Line
671
    Inherits SPPID_ITEM
672

    
673
    Private _STARTPOINT As String
674
    Private _ENDPOINT As String
675
    Private _CONNECTORS As List(Of Connector)
676

    
677
    Private _LINENUMBER As LineNumber
678

    
679
    Private _LMCONNECTOR_MODELID As String
680

    
681
    Private _SLOPTYPE As SlopType
682

    
683
    Private _START_X As Double
684
    Private _START_Y As Double
685
    Private _END_X As Double
686
    Private _END_Y As Double
687

    
688
    Public Property STARTPOINT As String
689
        Get
690
            Return _STARTPOINT
691
        End Get
692
        Set(value As String)
693
            _STARTPOINT = value
694
        End Set
695
    End Property
696

    
697
    Public Property ENDPOINT As String
698
        Get
699
            Return _ENDPOINT
700
        End Get
701
        Set(value As String)
702
            _ENDPOINT = value
703
        End Set
704
    End Property
705

    
706
    Public Property CONNECTORS As List(Of Connector)
707
        Get
708
            Return _CONNECTORS
709
        End Get
710
        Set(value As List(Of Connector))
711
            _CONNECTORS = value
712
        End Set
713
    End Property
714

    
715
    Public Property LINENUMBER As LineNumber
716
        Get
717
            Return _LINENUMBER
718
        End Get
719
        Set(value As LineNumber)
720
            _LINENUMBER = value
721
        End Set
722
    End Property
723

    
724
    Public Property START_X As Double
725
        Get
726
            Return _START_X
727
        End Get
728
        Set(value As Double)
729
            _START_X = value
730
        End Set
731
    End Property
732

    
733
    Public Property START_Y As Double
734
        Get
735
            Return _START_Y
736
        End Get
737
        Set(value As Double)
738
            _START_Y = value
739
        End Set
740
    End Property
741

    
742
    Public Property END_X As Double
743
        Get
744
            Return _END_X
745
        End Get
746
        Set(value As Double)
747
            _END_X = value
748
        End Set
749
    End Property
750

    
751
    Public Property END_Y As Double
752
        Get
753
            Return _END_Y
754
        End Get
755
        Set(value As Double)
756
            _END_Y = value
757
        End Set
758
    End Property
759

    
760
    Public Property LMCONNECTOR_MODELID As String
761
        Get
762
            Return _LMCONNECTOR_MODELID
763
        End Get
764
        Set(value As String)
765
            _LMCONNECTOR_MODELID = value
766
        End Set
767
    End Property
768

    
769
    Public Property SLOPTYPE As SlopType
770
        Get
771
            Return _SLOPTYPE
772
        End Get
773
        Set(value As SlopType)
774
            _SLOPTYPE = value
775
        End Set
776
    End Property
777

    
778
    Public Overrides Sub Modeling()
779
        Throw New NotImplementedException()
780
    End Sub
781

    
782
    Public Overrides Sub AfterSetting()
783

    
784
        '' Point Setting
785
        Main.ConvertPointBystring(_STARTPOINT, _START_X, _START_Y)
786
        Main.ConvertPointByImage(_START_X, _START_Y, Main._IMG_X, Main._IMG_Y)
787
        Main.ConvertPointBystring(_ENDPOINT, _END_X, _END_Y)
788
        Main.ConvertPointByImage(_END_X, _END_Y, Main._IMG_X, Main._IMG_Y)
789
        '' end
790

    
791
        '' Slop Setting
792
        _SLOPTYPE = CalcSlop(New Pointd(_START_X, _START_Y), New Pointd(_END_X, _END_Y))
793
        '' end
794

    
795
        '' SPPID Type Setting
796
        SPPID_TYPE = SPPID_ITEM_TYPE.LINE
797
        '' end
798
    End Sub
799

    
800
    Private Function CalcSlop(ByVal point1 As Pointd, ByVal point2 As Pointd) As SlopType
801
        If point1.X - point2.X = 0 Then
802
            Return SlopType.VERTICAL
803
        Else
804
            Dim angle = Math.Atan(Math.Abs(point2.Y - point1.Y) / Math.Abs(point2.X - point1.X)) * 180 / Math.PI
805

    
806
            If angle < 20 Then
807
                Return SlopType.HORIZONTAL
808
            ElseIf angle > 70 Then
809
                Return SlopType.VERTICAL
810
            Else
811
                Return SlopType.SLOPE
812
            End If
813
        End If
814
    End Function
815

    
816
    Public Overrides Sub SetAttribute()
817
        Throw New NotImplementedException()
818
    End Sub
819
End Class
820

    
821
Public Class LineNumber
822
    Inherits SPPID_ITEM
823

    
824
    Private _ANGLE As String
825
    Private _LOCATION As String
826
    Private _LOCATION_X As Double
827
    Private _LOCATION_Y As Double
828
    Private _SYMBOLRUNITEMS As List(Of String)
829
    Private _LINERUNITEMS As List(Of String)
830
    Private _TEXT As String
831
    Private _CONNECTLINE As String
832
    Private _TARGETLINE As Line
833

    
834
    Public Property ANGLE As String
835
        Get
836
            Return _ANGLE
837
        End Get
838
        Set(value As String)
839
            _ANGLE = value
840
        End Set
841
    End Property
842

    
843
    Public Property SYMBOLRUNITEMS As List(Of String)
844
        Get
845
            Return _SYMBOLRUNITEMS
846
        End Get
847
        Set(value As List(Of String))
848
            _SYMBOLRUNITEMS = value
849
        End Set
850
    End Property
851

    
852
    Public Property LINERUNITEMS As List(Of String)
853
        Get
854
            Return _LINERUNITEMS
855
        End Get
856
        Set(value As List(Of String))
857
            _LINERUNITEMS = value
858
        End Set
859
    End Property
860

    
861
    Public Property TEXT As String
862
        Get
863
            Return _TEXT
864
        End Get
865
        Set(value As String)
866
            _TEXT = value
867
        End Set
868
    End Property
869

    
870
    Public Property CONNECTLINE As String
871
        Get
872
            Return _CONNECTLINE
873
        End Get
874
        Set(value As String)
875
            _CONNECTLINE = value
876
        End Set
877
    End Property
878

    
879
    Public Property TARGETLINE As Line
880
        Get
881
            Return _TARGETLINE
882
        End Get
883
        Set(value As Line)
884
            _TARGETLINE = value
885
        End Set
886
    End Property
887

    
888
    Public Property LOCATION_X As Double
889
        Get
890
            Return _LOCATION_X
891
        End Get
892
        Set(value As Double)
893
            _LOCATION_X = value
894
        End Set
895
    End Property
896

    
897
    Public Property LOCATION_Y As Double
898
        Get
899
            Return _LOCATION_Y
900
        End Get
901
        Set(value As Double)
902
            _LOCATION_Y = value
903
        End Set
904
    End Property
905

    
906
    Public Property LOCATION As String
907
        Get
908
            Return _LOCATION
909
        End Get
910
        Set(value As String)
911
            _LOCATION = value
912
        End Set
913
    End Property
914

    
915
    Public Overrides Sub AfterSetting()
916
        '' Angle Setting
917
        If ANGLE = 1.57 Then
918
            ANGLE = 90 * Math.PI / 180
919
        ElseIf ANGLE = 3.14 Then
920
            ANGLE = Math.PI
921
        ElseIf ANGLE = 4.71 Then
922
            ANGLE = 270 * Math.PI / 180
923
        Else
924
            ANGLE = 0
925
        End If
926
        '' end
927

    
928
        '' Location Setting
929
        Main.ConvertPointBystring(LOCATION, LOCATION_X, LOCATION_Y)
930
        Main.ConvertPointByImage(LOCATION_X, LOCATION_Y, Main._IMG_X, Main._IMG_Y)
931
        '' end
932

    
933
        '' SPPID Type Setting
934
        SPPID_TYPE = SPPID_ITEM_TYPE.LABEL
935
        '' end
936
    End Sub
937

    
938
    Public Overrides Sub Modeling()
939
        Try
940
            If TARGETLINE IsNot Nothing Then
941
                If String.IsNullOrEmpty(TARGETLINE.LMCONNECTOR_MODELID) = False Then
942
                    Dim _Placement As Placement = New Placement
943
                    Dim points(2) As Double
944
                    points(1) = LOCATION_X
945
                    points(2) = LOCATION_Y
946

    
947
                    Dim _lmPipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(TARGETLINE.LMCONNECTOR_MODELID)
948
                    If _lmPipeRun IsNot Nothing Then
949
                        For Each representation As LMRepresentation In _lmPipeRun.Representations
950
                            If representation.RepresentationType = "Connector" And representation.ItemStatus = "Active" Then
951
                                Dim _lmConnector As LMConnector = _Placement.PIDDataSource.GetConnector(representation.Id)
952
                                SPPID_ITEM_OBJECT = _Placement.PIDPlaceLabel(SPPIDMAPPINGNAME, points, Rotation:=ANGLE, LabeledItem:=_lmConnector.AsLMRepresentation, IsLeaderVisible:=True)
953
                                Exit For
954
                            End If
955
                        Next
956
                    End If
957
                End If
958
            End If
959
        Catch ex As Exception
960
            Console.WriteLine(ex.Message)
961
        End Try
962
    End Sub
963

    
964
    Public Overrides Sub SetAttribute()
965
        If TARGETLINE IsNot Nothing Then
966
            Dim _Placement As Placement = New Placement
967
            Dim _PipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(TARGETLINE.LMCONNECTOR_MODELID)
968

    
969
            For Each _attr As Attribute In ATTRIBUTES
970
                If String.IsNullOrEmpty(_attr.VALUE) Then
971
                    Continue For
972
                End If
973

    
974
                Try
975
                    _PipeRun.Attributes(_attr.NAME).Value = _attr.VALUE
976
                Catch ex As Exception
977
                    Console.WriteLine(_attr.NAME)
978
                End Try
979
            Next
980
            _PipeRun.Commit()
981

    
982
        End If
983
    End Sub
984
End Class
985

    
986
Public Class Text
987
    Inherits SPPID_ITEM
988

    
989
    Private _ANGLE As String
990
    Private _LOCATION As String
991
    Private _LOCATION_X As Double
992
    Private _LOCATION_Y As Double
993
    Private _TEXT As String
994
    Private _OWNER As String
995

    
996
    Public Property ANGLE As String
997
        Get
998
            Return _ANGLE
999
        End Get
1000
        Set(value As String)
1001
            _ANGLE = value
1002
        End Set
1003
    End Property
1004

    
1005
    Public Property LOCATION As String
1006
        Get
1007
            Return _LOCATION
1008
        End Get
1009
        Set(value As String)
1010
            _LOCATION = value
1011
        End Set
1012
    End Property
1013

    
1014
    Public Property LOCATION_X As Double
1015
        Get
1016
            Return _LOCATION_X
1017
        End Get
1018
        Set(value As Double)
1019
            _LOCATION_X = value
1020
        End Set
1021
    End Property
1022

    
1023
    Public Property LOCATION_Y As Double
1024
        Get
1025
            Return _LOCATION_Y
1026
        End Get
1027
        Set(value As Double)
1028
            _LOCATION_Y = value
1029
        End Set
1030
    End Property
1031

    
1032
    Public Property TEXT As String
1033
        Get
1034
            Return _TEXT
1035
        End Get
1036
        Set(value As String)
1037
            _TEXT = value
1038
        End Set
1039
    End Property
1040

    
1041
    Public Property OWNER As String
1042
        Get
1043
            Return _OWNER
1044
        End Get
1045
        Set(value As String)
1046
            _OWNER = value
1047
        End Set
1048
    End Property
1049

    
1050
    Public Overrides Sub AfterSetting()
1051
        '' Angle Setting
1052
        If ANGLE = 1.57 Then
1053
            ANGLE = 90 * Math.PI / 180
1054
        ElseIf ANGLE = 3.14 Then
1055
            ANGLE = Math.PI
1056
        ElseIf ANGLE = 4.71 Then
1057
            ANGLE = 270 * Math.PI / 180
1058
        Else
1059
            ANGLE = 0
1060
        End If
1061
        '' end
1062

    
1063
        '' Location Setting
1064
        Main.ConvertPointBystring(LOCATION, LOCATION_X, LOCATION_Y)
1065
        Main.ConvertPointByImage(LOCATION_X, LOCATION_Y, Main._IMG_X, Main._IMG_Y)
1066
        '' end
1067

    
1068
        '' SPPID Type Setting
1069
        SPPID_TYPE = SPPID_ITEM_TYPE.TEXT
1070
        '' end
1071
    End Sub
1072

    
1073

    
1074
    Public Overrides Sub Modeling()
1075
        Try
1076
            Dim _Placement As Placement = New Placement
1077
            If NAME = "TEXT" Then
1078
                Dim _lmSymbol As LMSymbol = _Placement.PIDPlaceSymbol(SPPIDMAPPINGNAME, LOCATION_X, LOCATION_Y, Rotation:=ANGLE)
1079
                SPPID_ITEM_OBJECT = _Placement.PIDDataSource.GetItemNote(_lmSymbol.ModelItemID)
1080
                SPPID_ITEM_OBJECT.Attributes("Note.Body").Value = TEXT
1081
            ElseIf NAME = "SIZE" Then
1082
                Dim _obj As Object = FindObjectByUID(OWNER)
1083
                If String.IsNullOrEmpty(OWNER) = False Then
1084
                    Dim points(2) As Double
1085
                    points(1) = LOCATION_X
1086
                    points(2) = LOCATION_Y
1087

    
1088
                    If TypeOf (_obj) Is Symbol Then
1089
                        Dim _symbol As Symbol = _obj
1090
                        Dim _lmSymbol As LMSymbol = _symbol.SPPID_ITEM_OBJECT
1091

    
1092
                        If _lmSymbol.FileName.ToString().Contains("Piping") Then
1093
                            SPPIDMAPPINGNAME = "\Piping\Labels - Piping Components\Nominal Diameter.sym"
1094
                        ElseIf _lmSymbol.FileName.ToString().Contains("Instrumentation") Then
1095
                            SPPIDMAPPINGNAME = "\Instrumentation\Labels - General Instrument\Nominal Diameter.sym"
1096
                        End If
1097

    
1098
                        SPPID_ITEM_OBJECT = _Placement.PIDPlaceLabel(SPPIDMAPPINGNAME, points, Rotation:=ANGLE, LabeledItem:=_lmSymbol.AsLMRepresentation, IsLeaderVisible:=True)
1099

    
1100
                    End If
1101
                End If
1102
            End If
1103
        Catch ex As Exception
1104
            Console.WriteLine(ex.Message)
1105
        End Try
1106
    End Sub
1107
    Public Overrides Sub SetAttribute()
1108
        Try
1109
            Dim _obj As Object = FindObjectByUID(OWNER)
1110
            If String.IsNullOrEmpty(OWNER) = False Then
1111
                Dim _Placement As Placement = New Placement
1112
                If NAME = "SIZE" Then
1113
                    If TypeOf (_obj) Is Symbol Then
1114
                        Try
1115
                            Dim _symbol As Symbol = _obj
1116
                            Dim _lmSymbol As LMSymbol = _symbol.SPPID_ITEM_OBJECT
1117

    
1118
                            If _lmSymbol.FileName.ToString().Contains("Piping") Then
1119
                                Dim _lmPipingComp As LMPipingComp = _Placement.PIDDataSource.GetPipingComp(_lmSymbol.ModelItemID)
1120
                                If DBNull.Value.Equals(_lmPipingComp.Attributes("NominalDiameter").Value) Then
1121
                                    _lmPipingComp.Attributes("NominalDiameter").Value = TEXT
1122
                                    _lmPipingComp.Commit()
1123
                                End If
1124
                            ElseIf _lmSymbol.FileName.ToString().Contains("Instrumentation") Then
1125
                                Dim _lmInstrument As LMInstrument = _Placement.PIDDataSource.GetInstrument(_lmSymbol.ModelItemID)
1126
                                If DBNull.Value.Equals(_lmInstrument.Attributes("NominalDiameter").Value) Then
1127
                                    _lmInstrument.Attributes("NominalDiameter").Value = TEXT
1128
                                    _lmInstrument.Commit()
1129
                                End If
1130
                            End If
1131
                        Catch ex As Exception
1132
                            Console.WriteLine(ex.Message)
1133
                        End Try
1134

    
1135
                    ElseIf TypeOf (_obj) Is Line Then
1136
                        Try
1137
                            Dim _line As Line = _obj
1138
                            Dim _PipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(_line.LMCONNECTOR_MODELID)
1139

    
1140
                            If DBNull.Value.Equals(_PipeRun.NominalDiameter) Then
1141
                                _PipeRun.NominalDiameter = TEXT
1142
                                _PipeRun.Commit()
1143
                            End If
1144
                        Catch ex As Exception
1145
                            Console.WriteLine(ex.Message)
1146
                        End Try
1147
                    End If
1148
                End If
1149
            End If
1150

    
1151
        Catch ex As Exception
1152
            Console.WriteLine(ex.Message)
1153
        End Try
1154
    End Sub
1155
End Class
1156

    
1157
Public Class Attribute
1158
    Private _UID As String
1159
    Private _NAME As String
1160
    Private _VALUE As String
1161

    
1162
    Public Property UID As String
1163
        Get
1164
            Return _UID
1165
        End Get
1166
        Set(value As String)
1167
            _UID = value
1168
        End Set
1169
    End Property
1170

    
1171
    Public Property NAME As String
1172
        Get
1173
            Return _NAME
1174
        End Get
1175
        Set(value As String)
1176
            _NAME = value
1177
        End Set
1178
    End Property
1179

    
1180
    Public Property VALUE As String
1181
        Get
1182
            Return _VALUE
1183
        End Get
1184
        Set(value As String)
1185
            _VALUE = value
1186
        End Set
1187
    End Property
1188
End Class
1189

    
1190
Public Class Connector
1191
    Private _CONNECTEDITEM As String
1192
    Private _CONNECTPOINT As String
1193
    Private _SCENECONNECTPOINT As String
1194

    
1195
    Public Property CONNECTEDITEM As String
1196
        Get
1197
            Return _CONNECTEDITEM
1198
        End Get
1199
        Set(value As String)
1200
            _CONNECTEDITEM = value
1201
        End Set
1202
    End Property
1203

    
1204
    Public Property CONNECTPOINT As String
1205
        Get
1206
            Return _CONNECTPOINT
1207
        End Get
1208
        Set(value As String)
1209
            _CONNECTPOINT = value
1210
        End Set
1211
    End Property
1212

    
1213
    Public Property SCENECONNECTPOINT As String
1214
        Get
1215
            Return _SCENECONNECTPOINT
1216
        End Get
1217
        Set(value As String)
1218
            _SCENECONNECTPOINT = value
1219
        End Set
1220
    End Property
1221
End Class
클립보드 이미지 추가 (최대 크기: 500 MB)