hytos / DTI_PID / SPPIDConverter / Drawing.vb @ a79d6d46
이력 | 보기 | 이력해설 | 다운로드 (32.1 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 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 result = FindObjectByUID(connector.CONNECTEDITEM) |
620 |
If TypeOf (result) Is Symbol Then |
621 |
Dim _sym As Symbol = result |
622 |
If _sym IsNot Nothing Then |
623 |
If _sym.SPPID_ITEM_OBJECT IsNot Nothing Then |
624 |
connectSymbol = _sym.SPPID_ITEM_OBJECT |
625 |
Exit For |
626 |
End If |
627 |
End If |
628 |
End If |
629 | |
630 |
End If |
631 |
Next |
632 | |
633 |
If connectSymbol IsNot Nothing Then |
634 |
SPPID_ITEM_OBJECT = _Placement.PIDPlaceSymbol(sysPath, LOCATION_X, LOCATION_Y, Rotation:=ANGLE, Mirror:=MIRROR, TargetItem:=connectSymbol) |
635 |
Else |
636 |
SPPID_ITEM_OBJECT = _Placement.PIDPlaceSymbol(sysPath, LOCATION_X, LOCATION_Y, Rotation:=ANGLE, Mirror:=MIRROR) |
637 |
End If |
638 | |
639 |
'' Check Child |
640 |
For Each _child As String In CHILD |
641 |
Dim arrChild As String() = _child.Split(",") |
642 |
Dim arrow As String = arrChild(0) |
643 |
Dim mappingName As String = arrChild(1) |
644 | |
645 |
Dim childAngle As Double = 0 |
646 |
If arrow = "UP" Then |
647 |
childAngle = 0 |
648 |
ElseIf arrow = "RIGHT" Then |
649 |
childAngle = 90 * Math.PI / 180 |
650 |
ElseIf arrow = "DOWN" Then |
651 |
childAngle = Math.PI |
652 |
Else |
653 |
childAngle = 270 * Math.PI / 180 |
654 |
End If |
655 | |
656 |
Dim _childLmSymbol As LMSymbol = _Placement.PIDPlaceSymbol(mappingName, LOCATION_X, LOCATION_Y, Mirror:=0, Rotation:=childAngle, TargetItem:=SPPID_ITEM_OBJECT) |
657 |
CHILD_SPPID_ITEM_OBJECT.Add(_childLmSymbol) |
658 |
Next |
659 | |
660 |
SPPID_ITEM_OBJECT.Commit() |
661 |
Debug.WriteLine(LOCATION_X.ToString + "," + LOCATION_Y.ToString + "/" + UID + "/" + SIZE) |
662 |
End If |
663 |
End Sub |
664 | |
665 |
Public Overrides Sub AfterSetting() |
666 |
'' Angle Setting |
667 |
If ANGLE = 1.57 Then |
668 |
ANGLE = 90 * Math.PI / 180 |
669 |
ElseIf ANGLE = 3.14 Then |
670 |
ANGLE = Math.PI |
671 |
ElseIf ANGLE = 4.71 Then |
672 |
ANGLE = 270 * Math.PI / 180 |
673 |
Else |
674 |
ANGLE = 0 |
675 |
End If |
676 |
'' end |
677 | |
678 |
'' Location Setting |
679 |
Dim OriginX As Double |
680 |
Dim OriginY As Double |
681 |
Main.ConvertPointBystring(_ORIGINALPOINT, OriginX, OriginY) |
682 |
Main.ConvertPointByImage(OriginX, OriginY, Main._IMG_X, Main._IMG_Y) |
683 |
_LOCATION_X = OriginX |
684 |
_LOCATION_Y = OriginY |
685 |
'' end |
686 | |
687 |
'' SPPID Type Setting |
688 |
SPPID_TYPE = SPPID_ITEM_TYPE.SYMBOL |
689 |
'' end |
690 | |
691 |
End Sub |
692 | |
693 |
Public Overrides Sub SetAttribute() |
694 |
Throw New NotImplementedException() |
695 |
End Sub |
696 |
End Class |
697 | |
698 |
Public Enum SlopType |
699 |
NONE |
700 |
VERTICAL |
701 |
HORIZONTAL |
702 |
SLOPE |
703 |
End Enum |
704 | |
705 |
Public Class Line |
706 |
Inherits SPPID_ITEM |
707 | |
708 |
Private _STARTPOINT As String |
709 |
Private _ENDPOINT As String |
710 |
Private _CONNECTORS As List(Of Connector) |
711 | |
712 |
Private _LINENUMBER As LineNumber |
713 | |
714 |
Private _LMCONNECTOR_MODELID As String |
715 | |
716 |
Private _SLOPTYPE As SlopType |
717 | |
718 |
Private _START_X As Double |
719 |
Private _START_Y As Double |
720 |
Private _END_X As Double |
721 |
Private _END_Y As Double |
722 | |
723 |
Public Property STARTPOINT As String |
724 |
Get |
725 |
Return _STARTPOINT |
726 |
End Get |
727 |
Set(value As String) |
728 |
_STARTPOINT = value |
729 |
End Set |
730 |
End Property |
731 | |
732 |
Public Property ENDPOINT As String |
733 |
Get |
734 |
Return _ENDPOINT |
735 |
End Get |
736 |
Set(value As String) |
737 |
_ENDPOINT = value |
738 |
End Set |
739 |
End Property |
740 | |
741 |
Public Property CONNECTORS As List(Of Connector) |
742 |
Get |
743 |
Return _CONNECTORS |
744 |
End Get |
745 |
Set(value As List(Of Connector)) |
746 |
_CONNECTORS = value |
747 |
End Set |
748 |
End Property |
749 | |
750 |
Public Property LINENUMBER As LineNumber |
751 |
Get |
752 |
Return _LINENUMBER |
753 |
End Get |
754 |
Set(value As LineNumber) |
755 |
_LINENUMBER = value |
756 |
End Set |
757 |
End Property |
758 | |
759 |
Public Property START_X As Double |
760 |
Get |
761 |
Return _START_X |
762 |
End Get |
763 |
Set(value As Double) |
764 |
_START_X = value |
765 |
End Set |
766 |
End Property |
767 | |
768 |
Public Property START_Y As Double |
769 |
Get |
770 |
Return _START_Y |
771 |
End Get |
772 |
Set(value As Double) |
773 |
_START_Y = value |
774 |
End Set |
775 |
End Property |
776 | |
777 |
Public Property END_X As Double |
778 |
Get |
779 |
Return _END_X |
780 |
End Get |
781 |
Set(value As Double) |
782 |
_END_X = value |
783 |
End Set |
784 |
End Property |
785 | |
786 |
Public Property END_Y As Double |
787 |
Get |
788 |
Return _END_Y |
789 |
End Get |
790 |
Set(value As Double) |
791 |
_END_Y = value |
792 |
End Set |
793 |
End Property |
794 | |
795 |
Public Property LMCONNECTOR_MODELID As String |
796 |
Get |
797 |
Return _LMCONNECTOR_MODELID |
798 |
End Get |
799 |
Set(value As String) |
800 |
_LMCONNECTOR_MODELID = value |
801 |
End Set |
802 |
End Property |
803 | |
804 |
Public Property SLOPTYPE As SlopType |
805 |
Get |
806 |
Return _SLOPTYPE |
807 |
End Get |
808 |
Set(value As SlopType) |
809 |
_SLOPTYPE = value |
810 |
End Set |
811 |
End Property |
812 | |
813 |
Public Overrides Sub Modeling() |
814 |
Throw New NotImplementedException() |
815 |
End Sub |
816 | |
817 |
Public Overrides Sub AfterSetting() |
818 | |
819 |
'' Point Setting |
820 |
Main.ConvertPointBystring(_STARTPOINT, _START_X, _START_Y) |
821 |
Main.ConvertPointByImage(_START_X, _START_Y, Main._IMG_X, Main._IMG_Y) |
822 |
Main.ConvertPointBystring(_ENDPOINT, _END_X, _END_Y) |
823 |
Main.ConvertPointByImage(_END_X, _END_Y, Main._IMG_X, Main._IMG_Y) |
824 |
'' end |
825 | |
826 |
'' Slop Setting |
827 |
_SLOPTYPE = CalcSlop(New Pointd(_START_X, _START_Y), New Pointd(_END_X, _END_Y)) |
828 |
'' end |
829 | |
830 |
'' SPPID Type Setting |
831 |
SPPID_TYPE = SPPID_ITEM_TYPE.LINE |
832 |
'' end |
833 |
End Sub |
834 | |
835 |
Private Function CalcSlop(ByVal point1 As Pointd, ByVal point2 As Pointd) As SlopType |
836 |
If point1.X - point2.X = 0 Then |
837 |
Return SlopType.VERTICAL |
838 |
Else |
839 |
Dim angle = Math.Atan(Math.Abs(point2.Y - point1.Y) / Math.Abs(point2.X - point1.X)) * 180 / Math.PI |
840 | |
841 |
If angle < 20 Then |
842 |
Return SlopType.HORIZONTAL |
843 |
ElseIf angle > 70 Then |
844 |
Return SlopType.VERTICAL |
845 |
Else |
846 |
Return SlopType.SLOPE |
847 |
End If |
848 |
End If |
849 |
End Function |
850 | |
851 |
Public Overrides Sub SetAttribute() |
852 |
Throw New NotImplementedException() |
853 |
End Sub |
854 |
End Class |
855 | |
856 |
Public Class LineNumber |
857 |
Inherits SPPID_ITEM |
858 | |
859 |
Private _ANGLE As String |
860 |
Private _LOCATION As String |
861 |
Private _LOCATION_X As Double |
862 |
Private _LOCATION_Y As Double |
863 |
Private _SYMBOLRUNITEMS As List(Of String) |
864 |
Private _LINERUNITEMS As List(Of String) |
865 |
Private _TEXT As String |
866 |
Private _CONNECTLINE As String |
867 |
Private _TARGETLINE As Line |
868 | |
869 |
Public Property ANGLE As String |
870 |
Get |
871 |
Return _ANGLE |
872 |
End Get |
873 |
Set(value As String) |
874 |
_ANGLE = value |
875 |
End Set |
876 |
End Property |
877 | |
878 |
Public Property SYMBOLRUNITEMS As List(Of String) |
879 |
Get |
880 |
Return _SYMBOLRUNITEMS |
881 |
End Get |
882 |
Set(value As List(Of String)) |
883 |
_SYMBOLRUNITEMS = value |
884 |
End Set |
885 |
End Property |
886 | |
887 |
Public Property LINERUNITEMS As List(Of String) |
888 |
Get |
889 |
Return _LINERUNITEMS |
890 |
End Get |
891 |
Set(value As List(Of String)) |
892 |
_LINERUNITEMS = value |
893 |
End Set |
894 |
End Property |
895 | |
896 |
Public Property TEXT As String |
897 |
Get |
898 |
Return _TEXT |
899 |
End Get |
900 |
Set(value As String) |
901 |
_TEXT = value |
902 |
End Set |
903 |
End Property |
904 | |
905 |
Public Property CONNECTLINE As String |
906 |
Get |
907 |
Return _CONNECTLINE |
908 |
End Get |
909 |
Set(value As String) |
910 |
_CONNECTLINE = value |
911 |
End Set |
912 |
End Property |
913 | |
914 |
Public Property TARGETLINE As Line |
915 |
Get |
916 |
Return _TARGETLINE |
917 |
End Get |
918 |
Set(value As Line) |
919 |
_TARGETLINE = value |
920 |
End Set |
921 |
End Property |
922 | |
923 |
Public Property LOCATION_X As Double |
924 |
Get |
925 |
Return _LOCATION_X |
926 |
End Get |
927 |
Set(value As Double) |
928 |
_LOCATION_X = value |
929 |
End Set |
930 |
End Property |
931 | |
932 |
Public Property LOCATION_Y As Double |
933 |
Get |
934 |
Return _LOCATION_Y |
935 |
End Get |
936 |
Set(value As Double) |
937 |
_LOCATION_Y = value |
938 |
End Set |
939 |
End Property |
940 | |
941 |
Public Property LOCATION As String |
942 |
Get |
943 |
Return _LOCATION |
944 |
End Get |
945 |
Set(value As String) |
946 |
_LOCATION = value |
947 |
End Set |
948 |
End Property |
949 | |
950 |
Public Overrides Sub AfterSetting() |
951 |
'' Angle Setting |
952 |
If ANGLE = 1.57 Then |
953 |
ANGLE = 90 * Math.PI / 180 |
954 |
ElseIf ANGLE = 3.14 Then |
955 |
ANGLE = Math.PI |
956 |
ElseIf ANGLE = 4.71 Then |
957 |
ANGLE = 270 * Math.PI / 180 |
958 |
Else |
959 |
ANGLE = 0 |
960 |
End If |
961 |
'' end |
962 | |
963 |
'' Location Setting |
964 |
Main.ConvertPointBystring(LOCATION, LOCATION_X, LOCATION_Y) |
965 |
Main.ConvertPointByImage(LOCATION_X, LOCATION_Y, Main._IMG_X, Main._IMG_Y) |
966 |
'' end |
967 | |
968 |
'' SPPID Type Setting |
969 |
SPPID_TYPE = SPPID_ITEM_TYPE.LABEL |
970 |
'' end |
971 |
End Sub |
972 | |
973 |
Public Overrides Sub Modeling() |
974 |
Try |
975 |
If TARGETLINE IsNot Nothing Then |
976 |
If String.IsNullOrEmpty(TARGETLINE.LMCONNECTOR_MODELID) = False Then |
977 |
Dim _Placement As Placement = New Placement |
978 |
Dim points(2) As Double |
979 |
points(1) = LOCATION_X |
980 |
points(2) = LOCATION_Y |
981 | |
982 |
Dim _lmPipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(TARGETLINE.LMCONNECTOR_MODELID) |
983 |
If _lmPipeRun IsNot Nothing Then |
984 |
For Each representation As LMRepresentation In _lmPipeRun.Representations |
985 |
If representation.RepresentationType = "Connector" And representation.ItemStatus = "Active" Then |
986 |
Dim _lmConnector As LMConnector = _Placement.PIDDataSource.GetConnector(representation.Id) |
987 |
SPPID_ITEM_OBJECT = _Placement.PIDPlaceLabel(SPPIDMAPPINGNAME, points, Rotation:=ANGLE, LabeledItem:=_lmConnector.AsLMRepresentation, IsLeaderVisible:=True) |
988 |
Exit For |
989 |
End If |
990 |
Next |
991 |
End If |
992 |
End If |
993 |
End If |
994 |
Catch ex As Exception |
995 |
Console.WriteLine(ex.Message) |
996 |
End Try |
997 |
End Sub |
998 | |
999 |
Public Overrides Sub SetAttribute() |
1000 |
If TARGETLINE IsNot Nothing Then |
1001 |
Dim _Placement As Placement = New Placement |
1002 |
Dim _PipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(TARGETLINE.LMCONNECTOR_MODELID) |
1003 | |
1004 |
For Each _attr As Attribute In ATTRIBUTES |
1005 |
If String.IsNullOrEmpty(_attr.VALUE) Then |
1006 |
Continue For |
1007 |
End If |
1008 | |
1009 |
Try |
1010 |
_PipeRun.Attributes(_attr.NAME).Value = _attr.VALUE |
1011 |
Catch ex As Exception |
1012 |
Console.WriteLine(_attr.NAME) |
1013 |
End Try |
1014 |
Next |
1015 |
_PipeRun.Commit() |
1016 | |
1017 |
End If |
1018 |
End Sub |
1019 |
End Class |
1020 | |
1021 |
Public Class Text |
1022 |
Inherits SPPID_ITEM |
1023 | |
1024 |
Private _ANGLE As String |
1025 |
Private _LOCATION As String |
1026 |
Private _LOCATION_X As Double |
1027 |
Private _LOCATION_Y As Double |
1028 |
Private _TEXT As String |
1029 |
Private _OWNER As String |
1030 | |
1031 |
Public Property ANGLE As String |
1032 |
Get |
1033 |
Return _ANGLE |
1034 |
End Get |
1035 |
Set(value As String) |
1036 |
_ANGLE = value |
1037 |
End Set |
1038 |
End Property |
1039 | |
1040 |
Public Property LOCATION As String |
1041 |
Get |
1042 |
Return _LOCATION |
1043 |
End Get |
1044 |
Set(value As String) |
1045 |
_LOCATION = value |
1046 |
End Set |
1047 |
End Property |
1048 | |
1049 |
Public Property LOCATION_X As Double |
1050 |
Get |
1051 |
Return _LOCATION_X |
1052 |
End Get |
1053 |
Set(value As Double) |
1054 |
_LOCATION_X = value |
1055 |
End Set |
1056 |
End Property |
1057 | |
1058 |
Public Property LOCATION_Y As Double |
1059 |
Get |
1060 |
Return _LOCATION_Y |
1061 |
End Get |
1062 |
Set(value As Double) |
1063 |
_LOCATION_Y = value |
1064 |
End Set |
1065 |
End Property |
1066 | |
1067 |
Public Property TEXT As String |
1068 |
Get |
1069 |
Return _TEXT |
1070 |
End Get |
1071 |
Set(value As String) |
1072 |
_TEXT = value |
1073 |
End Set |
1074 |
End Property |
1075 | |
1076 |
Public Property OWNER As String |
1077 |
Get |
1078 |
Return _OWNER |
1079 |
End Get |
1080 |
Set(value As String) |
1081 |
_OWNER = value |
1082 |
End Set |
1083 |
End Property |
1084 | |
1085 |
Public Overrides Sub AfterSetting() |
1086 |
'' Angle Setting |
1087 |
If ANGLE = 1.57 Then |
1088 |
ANGLE = 90 * Math.PI / 180 |
1089 |
ElseIf ANGLE = 3.14 Then |
1090 |
ANGLE = Math.PI |
1091 |
ElseIf ANGLE = 4.71 Then |
1092 |
ANGLE = 270 * Math.PI / 180 |
1093 |
Else |
1094 |
ANGLE = 0 |
1095 |
End If |
1096 |
'' end |
1097 | |
1098 |
'' Location Setting |
1099 |
Main.ConvertPointBystring(LOCATION, LOCATION_X, LOCATION_Y) |
1100 |
Main.ConvertPointByImage(LOCATION_X, LOCATION_Y, Main._IMG_X, Main._IMG_Y) |
1101 |
'' end |
1102 | |
1103 |
'' SPPID Type Setting |
1104 |
SPPID_TYPE = SPPID_ITEM_TYPE.TEXT |
1105 |
'' end |
1106 |
End Sub |
1107 | |
1108 | |
1109 |
Public Overrides Sub Modeling() |
1110 |
Try |
1111 |
Dim _Placement As Placement = New Placement |
1112 |
If NAME = "TEXT" Then |
1113 |
Dim _lmSymbol As LMSymbol = _Placement.PIDPlaceSymbol(SPPIDMAPPINGNAME, LOCATION_X, LOCATION_Y, Rotation:=ANGLE) |
1114 |
SPPID_ITEM_OBJECT = _Placement.PIDDataSource.GetItemNote(_lmSymbol.ModelItemID) |
1115 |
SPPID_ITEM_OBJECT.Attributes("Note.Body").Value = TEXT |
1116 |
ElseIf NAME = "SIZE" Then |
1117 |
Dim _obj As Object = FindObjectByUID(OWNER) |
1118 |
If String.IsNullOrEmpty(OWNER) = False Then |
1119 |
Dim points(2) As Double |
1120 |
points(1) = LOCATION_X |
1121 |
points(2) = LOCATION_Y |
1122 | |
1123 |
If TypeOf (_obj) Is Symbol Then |
1124 |
Dim _symbol As Symbol = _obj |
1125 |
Dim _lmSymbol As LMSymbol = _symbol.SPPID_ITEM_OBJECT |
1126 | |
1127 |
If _lmSymbol.FileName.ToString().Contains("Piping") Then |
1128 |
SPPIDMAPPINGNAME = "\Piping\Labels - Piping Components\Nominal Diameter.sym" |
1129 |
ElseIf _lmSymbol.FileName.ToString().Contains("Instrumentation") Then |
1130 |
SPPIDMAPPINGNAME = "\Instrumentation\Labels - General Instrument\Nominal Diameter.sym" |
1131 |
End If |
1132 | |
1133 |
SPPID_ITEM_OBJECT = _Placement.PIDPlaceLabel(SPPIDMAPPINGNAME, points, Rotation:=ANGLE, LabeledItem:=_lmSymbol.AsLMRepresentation, IsLeaderVisible:=True) |
1134 | |
1135 |
End If |
1136 |
End If |
1137 |
End If |
1138 |
Catch ex As Exception |
1139 |
Console.WriteLine(ex.Message) |
1140 |
End Try |
1141 |
End Sub |
1142 |
Public Overrides Sub SetAttribute() |
1143 |
Try |
1144 |
Dim _obj As Object = FindObjectByUID(OWNER) |
1145 |
If String.IsNullOrEmpty(OWNER) = False Then |
1146 |
Dim _Placement As Placement = New Placement |
1147 |
If NAME = "SIZE" Then |
1148 |
If TypeOf (_obj) Is Symbol Then |
1149 |
Try |
1150 |
Dim _symbol As Symbol = _obj |
1151 |
Dim _lmSymbol As LMSymbol = _symbol.SPPID_ITEM_OBJECT |
1152 | |
1153 |
If _lmSymbol.FileName.ToString().Contains("Piping") Then |
1154 |
Dim _lmPipingComp As LMPipingComp = _Placement.PIDDataSource.GetPipingComp(_lmSymbol.ModelItemID) |
1155 |
If DBNull.Value.Equals(_lmPipingComp.Attributes("NominalDiameter").Value) Then |
1156 |
_lmPipingComp.Attributes("NominalDiameter").Value = TEXT |
1157 |
_lmPipingComp.Commit() |
1158 |
End If |
1159 |
ElseIf _lmSymbol.FileName.ToString().Contains("Instrumentation") Then |
1160 |
Dim _lmInstrument As LMInstrument = _Placement.PIDDataSource.GetInstrument(_lmSymbol.ModelItemID) |
1161 |
If DBNull.Value.Equals(_lmInstrument.Attributes("NominalDiameter").Value) Then |
1162 |
_lmInstrument.Attributes("NominalDiameter").Value = TEXT |
1163 |
_lmInstrument.Commit() |
1164 |
End If |
1165 |
End If |
1166 |
Catch ex As Exception |
1167 |
Console.WriteLine(ex.Message) |
1168 |
End Try |
1169 | |
1170 |
ElseIf TypeOf (_obj) Is Line Then |
1171 |
Try |
1172 |
Dim _line As Line = _obj |
1173 |
Dim _PipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(_line.LMCONNECTOR_MODELID) |
1174 | |
1175 |
If DBNull.Value.Equals(_PipeRun.NominalDiameter) Then |
1176 |
_PipeRun.NominalDiameter = TEXT |
1177 |
_PipeRun.Commit() |
1178 |
End If |
1179 |
Catch ex As Exception |
1180 |
Console.WriteLine(ex.Message) |
1181 |
End Try |
1182 |
End If |
1183 |
End If |
1184 |
End If |
1185 | |
1186 |
Catch ex As Exception |
1187 |
Console.WriteLine(ex.Message) |
1188 |
End Try |
1189 |
End Sub |
1190 |
End Class |
1191 | |
1192 |
Public Class Attribute |
1193 |
Private _UID As String |
1194 |
Private _NAME As String |
1195 |
Private _VALUE As String |
1196 | |
1197 |
Public Property UID As String |
1198 |
Get |
1199 |
Return _UID |
1200 |
End Get |
1201 |
Set(value As String) |
1202 |
_UID = value |
1203 |
End Set |
1204 |
End Property |
1205 | |
1206 |
Public Property NAME As String |
1207 |
Get |
1208 |
Return _NAME |
1209 |
End Get |
1210 |
Set(value As String) |
1211 |
_NAME = value |
1212 |
End Set |
1213 |
End Property |
1214 | |
1215 |
Public Property VALUE As String |
1216 |
Get |
1217 |
Return _VALUE |
1218 |
End Get |
1219 |
Set(value As String) |
1220 |
_VALUE = value |
1221 |
End Set |
1222 |
End Property |
1223 |
End Class |
1224 | |
1225 |
Public Class Connector |
1226 |
Private _CONNECTEDITEM As String |
1227 |
Private _CONNECTPOINT As String |
1228 |
Private _SCENECONNECTPOINT As String |
1229 | |
1230 |
Public Property CONNECTEDITEM As String |
1231 |
Get |
1232 |
Return _CONNECTEDITEM |
1233 |
End Get |
1234 |
Set(value As String) |
1235 |
_CONNECTEDITEM = value |
1236 |
End Set |
1237 |
End Property |
1238 | |
1239 |
Public Property CONNECTPOINT As String |
1240 |
Get |
1241 |
Return _CONNECTPOINT |
1242 |
End Get |
1243 |
Set(value As String) |
1244 |
_CONNECTPOINT = value |
1245 |
End Set |
1246 |
End Property |
1247 | |
1248 |
Public Property SCENECONNECTPOINT As String |
1249 |
Get |
1250 |
Return _SCENECONNECTPOINT |
1251 |
End Get |
1252 |
Set(value As String) |
1253 |
_SCENECONNECTPOINT = value |
1254 |
End Set |
1255 |
End Property |
1256 |
End Class |