개정판 6a7573b0
dev issue #366 : Mirror 기능 및 Drawing 크기 구하는 방식 변경
Change-Id: I7c87b78b185832403f62b18783c50861c70bb208
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
33 | 33 |
WrapperApplication wApp = new WrapperApplication(application.Application); |
34 | 34 |
radApp = wApp.RADApplication; |
35 | 35 |
|
36 |
try |
|
37 |
{ |
|
38 |
textEditDrawingX.EditValue = Settings.Default.DrawingX; |
|
39 |
textEditDrawingY.EditValue = Settings.Default.DrawingY; |
|
40 |
} |
|
41 |
catch (Exception ex) |
|
42 |
{ |
|
43 |
StringBuilder sb = new StringBuilder(); |
|
44 |
sb.AppendLine(ex.Message); |
|
45 |
sb.AppendLine(ex.StackTrace); |
|
46 |
MessageBox.Show(sb.ToString()); |
|
47 |
} |
|
48 |
|
|
49 |
|
|
36 | 50 |
#if DEBUG |
37 | 51 |
simpleButton1.Visible = true; |
38 | 52 |
|
... | ... | |
83 | 97 |
} |
84 | 98 |
} |
85 | 99 |
|
86 |
private void simpleButton1_Click(object sender, EventArgs e)
|
|
100 |
private void btnGetDrawingSize_Click(object sender, EventArgs e)
|
|
87 | 101 |
{ |
88 |
Placement placement = new Placement(); |
|
89 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
|
90 |
|
|
91 |
|
|
92 |
Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveSelectSet[0] as Ingr.RAD2D.Symbol2d; |
|
93 |
if (symbol2d != null) |
|
102 |
if (radApp.ActiveSelectSet.Count > 0) |
|
94 | 103 |
{ |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
double minX; |
|
99 |
double minY; |
|
100 |
double maxX; |
|
101 |
double maxY; |
|
102 |
symbol2d.Range(out minX, out minY, out maxX, out maxY); |
|
103 |
|
|
104 |
foreach (var attributes in symbol2d.AttributeSets) |
|
104 |
DependencyObject line2D = radApp.ActiveSelectSet[0] as DependencyObject; |
|
105 |
if (line2D != null) |
|
105 | 106 |
{ |
106 |
foreach (var attribute in attributes) |
|
107 |
{ |
|
108 |
string name = attribute.Name; |
|
109 |
string value = attribute.GetValue().ToString(); |
|
110 |
if (name == "ModelID") |
|
111 |
{ |
|
112 |
string modelID = value; |
|
113 |
LMModelItem modelItem = dataSource.GetModelItem(modelID); |
|
114 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
115 |
{ |
|
116 |
if (rep.Attributes["RepresentationType"].get_Value() == "Symbol") |
|
117 |
{ |
|
118 |
LMSymbol symbol = dataSource.GetSymbol(rep.Id); |
|
119 |
|
|
120 |
List<double[]> points = new List<double[]>(); |
|
121 |
StringBuilder sb = new StringBuilder(); |
|
122 |
for (int i = 1; i < int.MaxValue; i++) |
|
123 |
{ |
|
124 |
double connX = 0; |
|
125 |
double connY = 0; |
|
126 |
if (placement.PIDConnectPointLocation(symbol, i, ref connX, ref connY)) |
|
127 |
{ |
|
128 |
points.Add(new double[] { connX, connY }); |
|
129 |
sb.AppendLine(i + " / " + connX + " / " + connY); |
|
130 |
} |
|
131 |
else |
|
132 |
break; |
|
133 |
} |
|
134 |
|
|
135 |
double prevX = symbol.get_XCoordinate(); |
|
136 |
double prevY = symbol.get_YCoordinate(); |
|
137 |
|
|
138 |
MessageBox.Show(sb.ToString()); |
|
139 |
} |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
107 |
double minX = 0; |
|
108 |
double minY = 0; |
|
109 |
double maxX = 0; |
|
110 |
double maxY = 0; |
|
111 |
line2D.Range(out minX, out minY, out maxX, out maxY); |
|
112 |
|
|
113 |
Settings.Default.DrawingX = maxX - minX; |
|
114 |
Settings.Default.DrawingY = maxY - minY; |
|
115 |
Settings.Default.Save(); |
|
116 |
|
|
117 |
textEditDrawingX.EditValue = Settings.Default.DrawingX; |
|
118 |
textEditDrawingY.EditValue = Settings.Default.DrawingY; |
|
143 | 119 |
} |
144 |
|
|
145 |
|
|
120 |
else |
|
121 |
MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
146 | 122 |
} |
123 |
else |
|
124 |
MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
125 |
} |
|
126 |
|
|
127 |
private void simpleButton1_Click(object sender, EventArgs e) |
|
128 |
{ |
|
129 |
Placement placement = new Placement(); |
|
130 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
|
131 |
|
|
132 |
placement.PIDPlaceSymbol(@"\Instrumentation\Relief Devices\Press Relief Valve.sym", 0, 0, Mirror: 0); |
|
133 |
placement.PIDPlaceSymbol(@"\Instrumentation\Relief Devices\Press Relief Valve.sym", 0.03, 0, Mirror: 1); |
|
134 |
//placement.PIDPlaceSymbol("", 0.06, 0, Mirror: 2); |
|
135 |
//Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveSelectSet[0] as Ingr.RAD2D.Symbol2d; |
|
136 |
//if (symbol2d != null) |
|
137 |
//{ |
|
138 |
// double minX; |
|
139 |
// double minY; |
|
140 |
// double maxX; |
|
141 |
// double maxY; |
|
142 |
// symbol2d.Range(out minX, out minY, out maxX, out maxY); |
|
143 |
|
|
144 |
// foreach (var attributes in symbol2d.AttributeSets) |
|
145 |
// { |
|
146 |
// foreach (var attribute in attributes) |
|
147 |
// { |
|
148 |
// string name = attribute.Name; |
|
149 |
// string value = attribute.GetValue().ToString(); |
|
150 |
// if (name == "ModelID") |
|
151 |
// { |
|
152 |
// string modelID = value; |
|
153 |
// LMModelItem modelItem = dataSource.GetModelItem(modelID); |
|
154 |
// foreach (LMRepresentation rep in modelItem.Representations) |
|
155 |
// { |
|
156 |
// if (rep.Attributes["RepresentationType"].get_Value() == "Symbol") |
|
157 |
// { |
|
158 |
// LMSymbol symbol = dataSource.GetSymbol(rep.Id); |
|
159 |
|
|
160 |
// List<double[]> points = new List<double[]>(); |
|
161 |
// StringBuilder sb = new StringBuilder(); |
|
162 |
// for (int i = 1; i < int.MaxValue; i++) |
|
163 |
// { |
|
164 |
// double connX = 0; |
|
165 |
// double connY = 0; |
|
166 |
// if (placement.PIDConnectPointLocation(symbol, i, ref connX, ref connY)) |
|
167 |
// { |
|
168 |
// points.Add(new double[] { connX, connY }); |
|
169 |
// sb.AppendLine(i + " / " + connX + " / " + connY); |
|
170 |
// } |
|
171 |
// else |
|
172 |
// break; |
|
173 |
// } |
|
174 |
|
|
175 |
// double prevX = symbol.get_XCoordinate(); |
|
176 |
// double prevY = symbol.get_YCoordinate(); |
|
177 |
|
|
178 |
// MessageBox.Show(sb.ToString()); |
|
179 |
// } |
|
180 |
// } |
|
181 |
// } |
|
182 |
// } |
|
183 |
// } |
|
184 |
|
|
185 |
|
|
186 |
//} |
|
147 | 187 |
} |
188 |
|
|
189 |
|
|
148 | 190 |
} |
149 | 191 |
} |
내보내기 Unified diff