프로젝트

일반

사용자정보

개정판 14540282

ID14540282046aa95b2e491b229dfbc541171cea9a
상위 a999464f
하위 0d6d3734, 1c5bd296

gaqhf 이(가) 약 5년 전에 추가함

dev issue #1230 : command, utill, custom fix

Change-Id: I73b680168848166eeeb682782840a39e118f0d0b

차이점 보기:

DTI_PID/APIDConverter/AutoModeling.cs
16 16
using Autodesk.AutoCAD.Runtime;
17 17
using Autodesk.AutoCAD.Windows;
18 18

  
19
using AVEVA.PID.CustomizationUtility.DB;
20
using AVEVA.PID.CustomizationUtility.Model;
21
using AVEVA.PID.CustomizationUtility.Properties;
19 22

  
20 23
namespace AVEVA.PID.CustomizationUtility
21 24
{
22 25
    public class AutoModeling
23 26
    {
24
        Autodesk.Windows.RibbonCombo pipeStyleCombo = null;
25
        Autodesk.Windows.RibbonCombo signalStyleCombo = null;
26
        Autodesk.Windows.RibbonChecklistButton autoLabelCheckListButton = null;
27
        Model.Document document;
27 28

  
28
        private void InitGUI()
29
        public AutoModeling(Model.Document document)
29 30
        {
30
            Autodesk.Windows.RibbonItemCollection items = GUI.RibbonHelper.GetPanelItems("ID_PIPE_PANEL");
31
            object objPipeStyle = GUIUtils.FindItem(items, "PIPESTYLE");
32
            if (objPipeStyle != null)
33
                pipeStyleCombo = objPipeStyle as Autodesk.Windows.RibbonCombo;
34
            object objAutoLabel = GUIUtils.FindItem(items, "Auto Label");
35
            if (objAutoLabel != null)
36
                autoLabelCheckListButton = objAutoLabel as Autodesk.Windows.RibbonChecklistButton;
37

  
38
            items = GUI.RibbonHelper.GetPanelItems("ID_SIGNAL_PANEL");
39
            object objSignalStyle = GUIUtils.FindItem(items, "SIGNALSTYLE");
40
            if (objSignalStyle != null)
41
                signalStyleCombo = objSignalStyle as Autodesk.Windows.RibbonCombo;
42
        }
43
        private void SetAutoLabelUnCehck()
44
        {
45
            if (autoLabelCheckListButton != null)
46
            {
47
                foreach (var item in autoLabelCheckListButton.Items)
48
                {
49
                    if (item.GetType() == typeof(Autodesk.Windows.RibbonButton))
50
                    {
51
                        Autodesk.Windows.RibbonButton ribbonButton = item as Autodesk.Windows.RibbonButton;
52
                        if (ribbonButton.IsChecked)
53
                            ribbonButton.IsChecked = false;
54
                    }
55
                }
56
            }
57
        }
58

  
59
        private void SetPipeStyle(string style)
60
        {
61
            if (pipeStyleCombo.Current != null)
62
            {
63
                Autodesk.Windows.RibbonButton button = pipeStyleCombo.Current as Autodesk.Windows.RibbonButton;
64
                if (button.AutomationName != style)
65
                {
66
                    foreach (var item in pipeStyleCombo.Items)
67
                    {
68
                        Autodesk.Windows.RibbonButton loop = item as Autodesk.Windows.RibbonButton;
69
                        if (loop.AutomationName == style)
70
                        {
71
                            pipeStyleCombo.Current = loop;
72
                            break;
73
                        }
74
                    }
75
                }
76
            }
31
            this.document = document;
77 32
        }
78 33

  
79
        private void SetSignalStyle(string style)
34
        public void Run()
80 35
        {
81
            if (signalStyleCombo.Current != null)
36
            if (APIDUtils.CreateDrawingAndOpen(document.AvevaDrawingNumber, document.AvevaSheetNumber, document.AvevaTemplateName, document.AvevaTemplateID))
82 37
            {
83
                Autodesk.Windows.RibbonButton button = signalStyleCombo.Current as Autodesk.Windows.RibbonButton;
84
                if (button.AutomationName != style)
85
                {
86
                    foreach (var item in signalStyleCombo.Items)
87
                    {
88
                        Autodesk.Windows.RibbonButton loop = item as Autodesk.Windows.RibbonButton;
89
                        if (loop.AutomationName == style)
90
                        {
91
                            signalStyleCombo.Current = loop;
92
                            break;
93
                        }
94
                    }
95
                }
38
                test();
96 39
            }
97 40
        }
98 41

  
......
135 78
        #region Drawing Method
136 79
        private string DrawPipe(string style, List<string> coordinates)
137 80
        {
138
            SetPipeStyle(style);
81
            GUIUtils.SetPipeStyle(style);
139 82

  
140 83
            string prevHandle = ReadDrawingLastLine();
141 84

  
142
            Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
85
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
143 86
            Editor editor = acDoc.Editor;
144 87
            List<object> commandParam = new List<object>();
145 88
            //command name
......
162 105
        }
163 106
        private void DrawPipe(string style, List<string> coordinates, ObjectId objectId)
164 107
        {
165
            SetPipeStyle(style);
108
            GUIUtils.SetPipeStyle(style);
166 109

  
167
            Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
110
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
168 111
            Editor editor = acDoc.Editor;
169 112
            List<object> commandParam = new List<object>();
170 113
            //command name
......
209 152
        #region Test Source
210 153
        public void test()
211 154
        {
212
            InitGUI();
155
            //InitGUI();
213 156

  
214 157
            DrawPipe("Main Pipe", new List<string>() { "2,100", "100,100" });
215 158

  
......
220 163

  
221 164
        public static void TEST()
222 165
        {
223
            AutoModeling auto = new AutoModeling();
166
            AutoModeling auto = new AutoModeling(null);
224 167
            auto.test();
225 168
        }
226 169
        #endregion

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)