프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / DTI_PID / SPPIDConverter / ConverterDocking.cs @ 7c3cdd0b

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

1 65881d60 gaqhf
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Drawing;
5
using System.Data;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows.Forms;
10
using System.Threading;
11
using Microsoft.VisualBasic;
12 e3e2d41f gaqhf
using Ingr.RAD2D;
13 d19ae675 gaqhf
using Converter.BaseModel;
14
using Converter.SPPID.Properties;
15
using Converter.SPPID.DB;
16
using Converter.SPPID.Util;
17
using Converter.SPPID.Form;
18
using Converter.SPPID.Model;
19 1ba9c671 gaqhf
using Plaice;
20
using Llama;
21 ca214bc3 gaqhf
using DevExpress.XtraSplashScreen;
22 65881d60 gaqhf
23
namespace Converter.SPPID.Wrapper
24
{
25
    public partial class ConverterDocking : UserControl
26
    {
27 e3e2d41f gaqhf
        Ingr.RAD2D.Application radApp;
28 d19ae675 gaqhf
        dynamic application;
29 65881d60 gaqhf
        public ConverterDocking()
30
        {
31
            InitializeComponent();
32 d19ae675 gaqhf
            application = Interaction.GetObject("", "PIDAutomation.Application");
33 e3e2d41f gaqhf
            WrapperApplication wApp = new WrapperApplication(application.Application);
34
            radApp = wApp.RADApplication;
35 1ba9c671 gaqhf
36
#if DEBUG
37
            simpleButton1.Visible = true;
38
#endif
39 65881d60 gaqhf
        }
40
41 e3e2d41f gaqhf
        private void btnConverter_Click(object sender, EventArgs e)
42 65881d60 gaqhf
        {
43 1ba9c671 gaqhf
            ConverterForm converterForm = new ConverterForm();
44
            if (converterForm.ShowDialog() == DialogResult.OK)
45 65881d60 gaqhf
            {
46 1ba9c671 gaqhf
47
                try
48
                {
49
                    CloseOPCForm.Run();
50 ca214bc3 gaqhf
51 d5ec4d0f gaqhf
                    for (int i = 0; i < converterForm.Documents.Count; i++)
52 1ba9c671 gaqhf
                    {
53 d5ec4d0f gaqhf
                        SPPID_Document document = converterForm.Documents[i];
54 1ba9c671 gaqhf
                        if (document.SetSPPIDMapping() && document.Enable)
55
                        {
56
                            AutoModeling modeling = new AutoModeling(document, application, radApp);
57 d5ec4d0f gaqhf
                            modeling.DocumentLabelText = string.Format("Drawing Name : {0} ({1}/{2})", document.DrawingName, i + 1, converterForm.Documents.Count);
58 1ba9c671 gaqhf
                            modeling.Run();
59
                        }
60
                    }
61
                }
62
                catch (Exception ex)
63
                {
64
                    MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
65
                }
66
                finally
67 d19ae675 gaqhf
                {
68 1ba9c671 gaqhf
                    CloseOPCForm.Stop();
69
                }
70
71
                MessageBox.Show(Msg.EndConvert, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
72
            }
73
        }
74
75
        private void simpleButton1_Click(object sender, EventArgs e)
76
        {
77 20972c61 gaqhf
            Placement placement = new Placement();
78
            LMADataSource dataSource = placement.PIDDataSource;
79 1f1b3a40 gaqhf
80 1ba9c671 gaqhf
            Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveSelectSet[0] as Ingr.RAD2D.Symbol2d;
81
            if (symbol2d != null)
82 65881d60 gaqhf
            {
83 1f1b3a40 gaqhf
                double minX;
84
                double minY;
85
                double maxX;
86
                double maxY;
87
                symbol2d.Range(out minX, out minY, out maxX, out maxY);
88 1ba9c671 gaqhf
89 1f1b3a40 gaqhf
                foreach (var attributes in symbol2d.AttributeSets)
90 1ba9c671 gaqhf
                {
91 1f1b3a40 gaqhf
                    foreach (var attribute in attributes)
92 1ba9c671 gaqhf
                    {
93 1f1b3a40 gaqhf
                        string name = attribute.Name;
94
                        string value = attribute.GetValue().ToString();
95
                        if (name == "ModelID")
96
                        {
97
                            string modelID = value;
98
                            LMModelItem modelItem = dataSource.GetModelItem(modelID);
99
                            foreach (LMRepresentation rep in modelItem.Representations)
100
                            {
101
                                if (rep.Attributes["RepresentationType"].get_Value() == "Symbol")
102
                                {
103
                                    LMSymbol symbol = dataSource.GetSymbol(rep.Id);
104
105
                                    double prevX = symbol.get_XCoordinate();
106
                                    double prevY = symbol.get_YCoordinate();
107 1ba9c671 gaqhf
108
109 1f1b3a40 gaqhf
                                }
110
                            }
111
                        }
112 1ba9c671 gaqhf
                    }
113
                }
114 1f1b3a40 gaqhf
115
               
116 65881d60 gaqhf
            }
117
        }
118
    }
119
}
클립보드 이미지 추가 (최대 크기: 500 MB)