1 |
13a36357
|
humkyung
|
using devDept.Eyeshot;
|
2 |
|
|
using devDept.Eyeshot.Entities;
|
3 |
|
|
using devDept.Eyeshot.Translators;
|
4 |
|
|
using devDept.Geometry.Entities;
|
5 |
|
|
using System;
|
6 |
|
|
using System.Collections.Generic;
|
7 |
|
|
using System.ComponentModel;
|
8 |
|
|
using System.Data;
|
9 |
|
|
using System.Drawing;
|
10 |
|
|
using System.IO;
|
11 |
|
|
using System.Linq;
|
12 |
|
|
using System.Runtime.InteropServices;
|
13 |
|
|
using System.Text;
|
14 |
|
|
using System.Threading.Tasks;
|
15 |
|
|
using System.Windows.Forms;
|
16 |
|
|
using Telerik.WinControls;
|
17 |
|
|
using Telerik.WinControls.UI;
|
18 |
|
|
using Telerik.Windows.Documents.Fixed.FormatProviders.Pdf;
|
19 |
|
|
using Telerik.Windows.Documents.Fixed.Model;
|
20 |
|
|
using Telerik.Windows.Documents.Fixed.Model.Editing;
|
21 |
|
|
|
22 |
|
|
namespace ID2.Manager.Controls
|
23 |
|
|
{
|
24 |
|
|
public partial class Verification : UserControl
|
25 |
|
|
{
|
26 |
|
|
readonly string IniFilePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
27 |
|
|
Application.ProductName, $"{Application.ProductName}.ini");
|
28 |
|
|
|
29 |
|
|
#region 기본값
|
30 |
|
|
private static string AutoCADLayer { get; } = "AutoCAD";
|
31 |
288a94c5
|
humkyung
|
private static string AutoCADDiffLayer { get; } = "AutoCAD_Diff";
|
32 |
|
|
private static string AutoCADExceptLayer { get; } = "AutoCAD_Except";
|
33 |
13a36357
|
humkyung
|
private static Color AutoCADColor = Color.FromArgb(44, 44, 44);
|
34 |
|
|
private static string AVEVALayer { get; } = "AVEVA";
|
35 |
288a94c5
|
humkyung
|
private static string AVEVADiffLayer { get; } = "AVEVA_Diff";
|
36 |
|
|
private static string AVEVAExceptLayer { get; } = "AVEVA_Except";
|
37 |
13a36357
|
humkyung
|
private static Color AVEVAColor = Color.FromArgb(44, 44, 44);
|
38 |
288ed615
|
humkyung
|
private static string RevCloudLayer { get; } = "RevCloud";
|
39 |
13a36357
|
humkyung
|
private static Color RevCloudColor = Color.Magenta;
|
40 |
288ed615
|
humkyung
|
private static Color DiffColor = Color.Yellow;
|
41 |
|
|
|
42 |
13a36357
|
humkyung
|
private static double Tolerance = 0;
|
43 |
c4ba621d
|
humkyung
|
private static double LengthToleranceRatio { get; set; } = 0.1;
|
44 |
353b7f9f
|
humkyung
|
private static bool Casesensitive { get; set; } = false;
|
45 |
13a36357
|
humkyung
|
#endregion
|
46 |
|
|
|
47 |
|
|
private RadProgressBarElement _progressBar = null;
|
48 |
|
|
|
49 |
|
|
public Verification(RadProgressBarElement progressBar)
|
50 |
|
|
{
|
51 |
|
|
InitializeComponent();
|
52 |
|
|
|
53 |
|
|
this.Load += Verification_Load;
|
54 |
|
|
this.radSpinEditorTolerance.ValueChanged += RadSpinEditorTolerance_ValueChanged;
|
55 |
|
|
this.radColorBoxAutoCADColor.ValueChanged += RadColorBoxAutoCADColor_ValueChanged;
|
56 |
|
|
this.radColorBoxAVEVAColor.ValueChanged += RadColorBoxAVEVAColor_ValueChanged;
|
57 |
|
|
this.radColorBoxDiffColor.ValueChanged += RadColorBoxDiffColor_ValueChanged;
|
58 |
|
|
this.radColorBoxRevCloudColor.ValueChanged += RadColorBoxRevCloudColor_ValueChanged;
|
59 |
|
|
|
60 |
|
|
this.designAutoCAD.ActionMode = actionType.SelectVisibleByPickDynamic;
|
61 |
|
|
this.designAutoCAD.ActiveViewport.CoordinateSystemIcon.Visible = false;
|
62 |
|
|
this.designAutoCAD.Selection.ColorDynamic = Color.FromArgb(80, Color.OrangeRed);
|
63 |
|
|
this.designAutoCAD.Selection.HaloInnerColor = Color.FromArgb(255, Color.OrangeRed);
|
64 |
|
|
this.designAutoCAD.Selection.HaloOuterColor = Color.FromArgb(64, Color.OrangeRed);
|
65 |
|
|
this.designAutoCAD.Selection.HaloWidthPolygons = 4;
|
66 |
|
|
this.designAutoCAD.Selection.HaloWidthWires = 2;
|
67 |
288ed615
|
humkyung
|
this.designAutoCAD.ActiveViewport.OriginSymbol.Visible = false;
|
68 |
b08da970
|
humkyung
|
this.designAutoCAD.SetView(viewType.Trimetric);
|
69 |
13a36357
|
humkyung
|
|
70 |
|
|
this.designAVEVA.ActionMode = actionType.SelectVisibleByPickDynamic;
|
71 |
|
|
this.designAVEVA.ActiveViewport.CoordinateSystemIcon.Visible = false;
|
72 |
288ed615
|
humkyung
|
this.designAVEVA.ActiveViewport.OriginSymbol.Visible = false;
|
73 |
13a36357
|
humkyung
|
this.designCompare.ActionMode = actionType.SelectVisibleByPickDynamic;
|
74 |
|
|
this.designCompare.ActiveViewport.CoordinateSystemIcon.Visible = false;
|
75 |
288ed615
|
humkyung
|
this.designCompare.ActiveViewport.OriginSymbol.Visible = false;
|
76 |
|
|
|
77 |
288a94c5
|
humkyung
|
this.radCheckedDropDownListAutoCAD.ItemCheckedChanged += RadCheckedDropDownListAutoCAD_ItemCheckedChanged;
|
78 |
|
|
this.radCheckedDropDownListAVEVA.ItemCheckedChanged += RadCheckedDropDownListAVEVA_ItemCheckedChanged;
|
79 |
288ed615
|
humkyung
|
this.radCheckBoxRevCloud.CheckStateChanged += RadCheckBoxRevCloud_CheckStateChanged;
|
80 |
353b7f9f
|
humkyung
|
this.radToggleSwitchCasesensitive.ValueChanged += RadToggleSwitchCasesensitive_ValueChanged;
|
81 |
13a36357
|
humkyung
|
|
82 |
|
|
_progressBar = progressBar;
|
83 |
|
|
|
84 |
|
|
#region Camera Sync
|
85 |
|
|
this.designAutoCAD.ActiveViewport.Rotate.Enabled = false;
|
86 |
|
|
this.designAVEVA.ActiveViewport.Rotate.Enabled = false;
|
87 |
|
|
this.designCompare.ActiveViewport.Rotate.Enabled = false;
|
88 |
|
|
|
89 |
|
|
this.designAutoCAD.ActiveViewport.ViewCubeIcon.Visible = false;
|
90 |
|
|
this.designAVEVA.ActiveViewport.ViewCubeIcon.Visible = false;
|
91 |
|
|
this.designCompare.ActiveViewport.ViewCubeIcon.Visible = false;
|
92 |
|
|
|
93 |
|
|
this.designAutoCAD.AnimateCamera = false;
|
94 |
|
|
this.designAVEVA.AnimateCamera = false;
|
95 |
|
|
this.designCompare.AnimateCamera = false;
|
96 |
|
|
|
97 |
|
|
this.designAutoCAD.CameraChangedFrequency = 200;
|
98 |
|
|
this.designAVEVA.CameraChangedFrequency = 200;
|
99 |
|
|
this.designCompare.CameraChangedFrequency = 200;
|
100 |
|
|
|
101 |
|
|
this.designAutoCAD.CameraChanged += CameraChanged;
|
102 |
|
|
this.designAVEVA.CameraChanged += CameraChanged;
|
103 |
|
|
this.designCompare.CameraChanged += CameraChanged;
|
104 |
|
|
#endregion
|
105 |
|
|
}
|
106 |
|
|
|
107 |
353b7f9f
|
humkyung
|
private void RadToggleSwitchCasesensitive_ValueChanged(object sender, EventArgs e)
|
108 |
|
|
{
|
109 |
|
|
bool value = this.radToggleSwitchCasesensitive.Value;
|
110 |
|
|
Verification.Casesensitive = value;
|
111 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", "Casesensitive", value.ToString());
|
112 |
|
|
}
|
113 |
|
|
|
114 |
288a94c5
|
humkyung
|
private void RadCheckedDropDownListAVEVA_ItemCheckedChanged(object sender, RadCheckedListDataItemEventArgs e)
|
115 |
288ed615
|
humkyung
|
{
|
116 |
288a94c5
|
humkyung
|
var layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == e.Item.Text.ToUpper());
|
117 |
|
|
if (layer != null) layer.Visible = e.Item.Checked;
|
118 |
288ed615
|
humkyung
|
this.designCompare.Invalidate();
|
119 |
288a94c5
|
humkyung
|
|
120 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", e.Item.Text, e.Item.Checked.ToString());
|
121 |
288ed615
|
humkyung
|
}
|
122 |
|
|
|
123 |
288a94c5
|
humkyung
|
private void RadCheckedDropDownListAutoCAD_ItemCheckedChanged(object sender, RadCheckedListDataItemEventArgs e)
|
124 |
288ed615
|
humkyung
|
{
|
125 |
288a94c5
|
humkyung
|
var layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == e.Item.Text.ToUpper());
|
126 |
|
|
if (layer != null) layer.Visible = e.Item.Checked;
|
127 |
|
|
this.designCompare.Invalidate();
|
128 |
|
|
|
129 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", e.Item.Text, e.Item.Checked.ToString());
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
private void RadCheckBoxRevCloud_CheckStateChanged(object sender, EventArgs e)
|
133 |
|
|
{
|
134 |
|
|
var layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == Verification.RevCloudLayer.ToUpper());
|
135 |
288ed615
|
humkyung
|
if (layer != null) layer.Visible = (sender as RadCheckBox).Checked;
|
136 |
|
|
this.designCompare.Invalidate();
|
137 |
|
|
}
|
138 |
|
|
|
139 |
288a94c5
|
humkyung
|
private void RadCheckBoxAVEVA_CheckStateChanged(object sender, EventArgs e)
|
140 |
288ed615
|
humkyung
|
{
|
141 |
288a94c5
|
humkyung
|
var layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == Verification.AVEVALayer.ToUpper());
|
142 |
288ed615
|
humkyung
|
if (layer != null) layer.Visible = (sender as RadCheckBox).Checked;
|
143 |
|
|
this.designCompare.Invalidate();
|
144 |
|
|
}
|
145 |
|
|
|
146 |
13a36357
|
humkyung
|
/// <summary>
|
147 |
|
|
/// Cloud Mark의 색상을 설정한다.
|
148 |
|
|
/// </summary>
|
149 |
|
|
/// <param name="sender"></param>
|
150 |
|
|
/// <param name="e"></param>
|
151 |
|
|
private void RadColorBoxRevCloudColor_ValueChanged(object sender, EventArgs e)
|
152 |
|
|
{
|
153 |
|
|
Verification.RevCloudColor = this.radColorBoxRevCloudColor.Value;
|
154 |
|
|
string color = $"{Verification.RevCloudColor.R},{Verification.RevCloudColor.G},{Verification.RevCloudColor.B}";
|
155 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", "RevCloudColor", color);
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
/// <summary>
|
159 |
|
|
/// 두 도면을 비교하여 결과를 PDF로 출력한다.
|
160 |
|
|
/// </summary>
|
161 |
|
|
/// <param name="sender"></param>
|
162 |
|
|
/// <param name="e"></param>
|
163 |
|
|
public void CompareDrawings(IList<Document> docs, bool Save = false)
|
164 |
|
|
{
|
165 |
|
|
string FileFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
166 |
|
|
Application.ProductName, "Compare");
|
167 |
|
|
if (!System.IO.Directory.Exists(FileFolder)) System.IO.Directory.CreateDirectory(FileFolder);
|
168 |
|
|
|
169 |
|
|
try
|
170 |
|
|
{
|
171 |
|
|
Size? size = new Size();
|
172 |
|
|
RadFixedDocument FixedDoc = null;
|
173 |
|
|
if (Save)
|
174 |
|
|
{
|
175 |
|
|
size = new Size(1920 * 2, 1080 * 2);
|
176 |
|
|
FixedDoc = new RadFixedDocument();
|
177 |
288ed615
|
humkyung
|
|
178 |
|
|
designCompare.ActiveViewport.Background.BottomColor = Color.White;
|
179 |
|
|
designCompare.ActiveViewport.Background.TopColor = Color.White;
|
180 |
13a36357
|
humkyung
|
}
|
181 |
|
|
|
182 |
|
|
_progressBar.Maximum = docs.Count();
|
183 |
|
|
_progressBar.Value1 = 0;
|
184 |
|
|
foreach (var doc in docs)
|
185 |
|
|
{
|
186 |
|
|
_progressBar.Text = doc.DocumentNo;
|
187 |
|
|
CompareDrawing(doc, Save);
|
188 |
|
|
|
189 |
|
|
if (Save)
|
190 |
|
|
{
|
191 |
|
|
using (var bmp = this.designCompare.RenderToBitmap(size.Value))
|
192 |
|
|
{
|
193 |
|
|
string FilePath = System.IO.Path.Combine(FileFolder, $"{doc.DocumentNo}.jpg");
|
194 |
|
|
bmp.Save(FilePath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
195 |
|
|
|
196 |
|
|
var page = FixedDoc.Pages.AddPage();
|
197 |
|
|
page.Size = new Telerik.Documents.Primitives.Size(size.Value.Width, size.Value.Height);
|
198 |
|
|
var editor = new FixedContentEditor(page);
|
199 |
|
|
using (FileStream fs = new FileStream(FilePath, FileMode.Open))
|
200 |
|
|
{
|
201 |
|
|
editor.DrawImage(fs);
|
202 |
|
|
}
|
203 |
|
|
}
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
_progressBar.Value1 += 1;
|
207 |
|
|
Application.DoEvents();
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
if (Save)
|
211 |
|
|
{
|
212 |
|
|
RadSaveFileDialog saveFileDialog = new RadSaveFileDialog()
|
213 |
|
|
{
|
214 |
|
|
Filter = "PDF files (*.pdf)|*.pdf",
|
215 |
|
|
RestoreDirectory = true
|
216 |
|
|
};
|
217 |
|
|
if (System.Windows.Forms.DialogResult.OK == saveFileDialog.ShowDialog())
|
218 |
|
|
{
|
219 |
|
|
string selectedFileName = saveFileDialog.FileName;
|
220 |
|
|
|
221 |
|
|
// If you are working in a .NET Core application, you will need to also provide an image resolver. You can use the default implementation provided in Telerik.Documents.ImageUtils:
|
222 |
|
|
Telerik.Documents.ImageUtils.ImagePropertiesResolver defaultImagePropertiesResolver = new Telerik.Documents.ImageUtils.ImagePropertiesResolver();
|
223 |
|
|
Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.ImagePropertiesResolver = defaultImagePropertiesResolver;
|
224 |
|
|
|
225 |
|
|
var provider = new PdfFormatProvider();
|
226 |
|
|
File.WriteAllBytes(selectedFileName, provider.Export(FixedDoc));
|
227 |
|
|
|
228 |
|
|
RadMessageBox.Show("Comparing document is done");
|
229 |
|
|
}
|
230 |
|
|
}
|
231 |
|
|
}
|
232 |
|
|
catch(Exception ex)
|
233 |
|
|
{
|
234 |
|
|
RadMessageBox.Show(ex.Message);
|
235 |
|
|
}
|
236 |
288ed615
|
humkyung
|
finally
|
237 |
|
|
{
|
238 |
|
|
designCompare.ActiveViewport.Background.BottomColor = Color.Black;
|
239 |
|
|
designCompare.ActiveViewport.Background.TopColor = Color.Black;
|
240 |
|
|
}
|
241 |
13a36357
|
humkyung
|
}
|
242 |
|
|
|
243 |
|
|
/// <summary>
|
244 |
|
|
/// 서로 다른 엔터티의 색상을 설정한다.
|
245 |
|
|
/// </summary>
|
246 |
|
|
/// <param name="sender"></param>
|
247 |
|
|
/// <param name="e"></param>
|
248 |
|
|
private void RadColorBoxDiffColor_ValueChanged(object sender, EventArgs e)
|
249 |
|
|
{
|
250 |
|
|
Verification.DiffColor = this.radColorBoxDiffColor.Value;
|
251 |
|
|
string color = $"{Verification.DiffColor.R},{Verification.DiffColor.G},{Verification.DiffColor.B}";
|
252 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", "DiffColor", color);
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
/// <summary>
|
256 |
|
|
/// AutoCAD 엔터티의 색상을 설정한다.
|
257 |
|
|
/// </summary>
|
258 |
|
|
/// <param name="sender"></param>
|
259 |
|
|
/// <param name="e"></param>
|
260 |
|
|
private void RadColorBoxAutoCADColor_ValueChanged(object sender, EventArgs e)
|
261 |
|
|
{
|
262 |
|
|
Verification.AutoCADColor = this.radColorBoxAutoCADColor.Value;
|
263 |
|
|
string color = $"{Verification.AutoCADColor.R},{Verification.AutoCADColor.G},{Verification.AutoCADColor.B}";
|
264 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", "AutoCADColor", color);
|
265 |
|
|
}
|
266 |
|
|
|
267 |
|
|
/// <summary>
|
268 |
|
|
/// AVEVA 엔터티의 색상을 설정한다.
|
269 |
|
|
/// </summary>
|
270 |
|
|
/// <param name="sender"></param>
|
271 |
|
|
/// <param name="e"></param>
|
272 |
|
|
private void RadColorBoxAVEVAColor_ValueChanged(object sender, EventArgs e)
|
273 |
|
|
{
|
274 |
|
|
Verification.AVEVAColor = this.radColorBoxAVEVAColor.Value;
|
275 |
|
|
string color = $"{Verification.AVEVAColor.R},{Verification.AVEVAColor.G},{Verification.AVEVAColor.B}";
|
276 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", "AVEVAColor", color);
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
/// <summary>
|
280 |
|
|
/// 수정한 Tolerance를 시스템에 반영한다.
|
281 |
|
|
/// </summary>
|
282 |
|
|
/// <param name="sender"></param>
|
283 |
|
|
/// <param name="e"></param>
|
284 |
|
|
private void RadSpinEditorTolerance_ValueChanged(object sender, EventArgs e)
|
285 |
|
|
{
|
286 |
|
|
double toler = Convert.ToDouble(this.radSpinEditorTolerance.Value);
|
287 |
|
|
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", "Tolerance", toler.ToString());
|
288 |
|
|
Verification.Tolerance = toler;
|
289 |
|
|
}
|
290 |
|
|
|
291 |
|
|
private void Verification_Load(object sender, EventArgs e)
|
292 |
|
|
{
|
293 |
|
|
string Toler = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Tolerance");
|
294 |
|
|
if (!string.IsNullOrEmpty(Toler))
|
295 |
|
|
{
|
296 |
|
|
this.radSpinEditorTolerance.Value = Convert.ToDecimal(Toler);
|
297 |
|
|
Verification.Tolerance = Convert.ToDouble(this.radSpinEditorTolerance.Value);
|
298 |
|
|
}
|
299 |
|
|
|
300 |
288a94c5
|
humkyung
|
string _AutoCADLayer = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", Verification.AutoCADLayer);
|
301 |
|
|
if (!string.IsNullOrEmpty(_AutoCADLayer))
|
302 |
|
|
{
|
303 |
|
|
bool Checked = Convert.ToBoolean(_AutoCADLayer);
|
304 |
|
|
var item = this.radCheckedDropDownListAutoCAD.Items.FirstOrDefault(x => x.Text == Verification.AutoCADLayer);
|
305 |
|
|
if (item is RadCheckedListDataItem CheckedItem) CheckedItem.Checked = Checked;
|
306 |
|
|
}
|
307 |
|
|
|
308 |
|
|
string _AutoCADDiffLayer = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", Verification.AutoCADDiffLayer);
|
309 |
|
|
if (!string.IsNullOrEmpty(_AutoCADDiffLayer))
|
310 |
|
|
{
|
311 |
|
|
bool Checked = Convert.ToBoolean(_AutoCADDiffLayer);
|
312 |
|
|
var item = this.radCheckedDropDownListAutoCAD.Items.FirstOrDefault(x => x.Text == Verification.AutoCADDiffLayer);
|
313 |
|
|
if (item is RadCheckedListDataItem CheckedItem) CheckedItem.Checked = Checked;
|
314 |
|
|
}
|
315 |
|
|
|
316 |
13a36357
|
humkyung
|
string _AutoCADColor = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "AutoCADColor");
|
317 |
|
|
if (!string.IsNullOrEmpty(_AutoCADColor))
|
318 |
|
|
{
|
319 |
|
|
var tokens = _AutoCADColor.Split(',');
|
320 |
|
|
if (tokens.Length == 3)
|
321 |
|
|
{
|
322 |
|
|
this.radColorBoxAutoCADColor.Value =
|
323 |
|
|
Color.FromArgb(Convert.ToInt32(tokens[0]), Convert.ToInt32(tokens[1]), Convert.ToInt32(tokens[2]));
|
324 |
|
|
}
|
325 |
|
|
}
|
326 |
|
|
|
327 |
288a94c5
|
humkyung
|
string _AVEVALayer = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", Verification.AVEVALayer);
|
328 |
|
|
if (!string.IsNullOrEmpty(_AutoCADLayer))
|
329 |
|
|
{
|
330 |
|
|
bool Checked = Convert.ToBoolean(_AVEVALayer);
|
331 |
|
|
var item = this.radCheckedDropDownListAVEVA.Items.FirstOrDefault(x => x.Text == Verification.AVEVALayer);
|
332 |
|
|
if (item is RadCheckedListDataItem CheckedItem) CheckedItem.Checked = Checked;
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
string _AVEVADiffLayer = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", Verification.AVEVADiffLayer);
|
336 |
|
|
if (!string.IsNullOrEmpty(_AVEVADiffLayer))
|
337 |
|
|
{
|
338 |
|
|
bool Checked = Convert.ToBoolean(_AVEVADiffLayer);
|
339 |
|
|
var item = this.radCheckedDropDownListAVEVA.Items.FirstOrDefault(x => x.Text == Verification.AVEVADiffLayer);
|
340 |
|
|
if (item is RadCheckedListDataItem CheckedItem) CheckedItem.Checked = Checked;
|
341 |
|
|
}
|
342 |
|
|
|
343 |
13a36357
|
humkyung
|
string _AVEVAColor = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "AVEVAColor");
|
344 |
|
|
if (!string.IsNullOrEmpty(_AVEVAColor))
|
345 |
|
|
{
|
346 |
|
|
var tokens = _AVEVAColor.Split(',');
|
347 |
|
|
if (tokens.Length == 3)
|
348 |
|
|
{
|
349 |
|
|
this.radColorBoxAVEVAColor.Value =
|
350 |
|
|
Color.FromArgb(Convert.ToInt32(tokens[0]), Convert.ToInt32(tokens[1]), Convert.ToInt32(tokens[2]));
|
351 |
|
|
}
|
352 |
|
|
}
|
353 |
|
|
|
354 |
|
|
string _DiffColor = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "DiffColor");
|
355 |
|
|
if (!string.IsNullOrEmpty(_DiffColor))
|
356 |
|
|
{
|
357 |
|
|
var tokens = _DiffColor.Split(',');
|
358 |
|
|
if (tokens.Length == 3)
|
359 |
|
|
{
|
360 |
|
|
this.radColorBoxDiffColor.Value =
|
361 |
|
|
Color.FromArgb(Convert.ToInt32(tokens[0]), Convert.ToInt32(tokens[1]), Convert.ToInt32(tokens[2]));
|
362 |
|
|
}
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
string _RevCloudColor = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "RevCloudColor");
|
366 |
|
|
if (!string.IsNullOrEmpty(_RevCloudColor))
|
367 |
|
|
{
|
368 |
|
|
var tokens = _RevCloudColor.Split(',');
|
369 |
|
|
if (tokens.Length == 3)
|
370 |
|
|
{
|
371 |
|
|
this.radColorBoxRevCloudColor.Value =
|
372 |
|
|
Color.FromArgb(Convert.ToInt32(tokens[0]), Convert.ToInt32(tokens[1]), Convert.ToInt32(tokens[2]));
|
373 |
|
|
}
|
374 |
|
|
}
|
375 |
|
|
|
376 |
c4ba621d
|
humkyung
|
string _LengthToleranceRatio = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Length Tolerance Ratio");
|
377 |
|
|
if (!string.IsNullOrEmpty(_LengthToleranceRatio))
|
378 |
|
|
{
|
379 |
|
|
LengthToleranceRatio = Convert.ToDouble(_LengthToleranceRatio);
|
380 |
|
|
}
|
381 |
|
|
|
382 |
51b9a24a
|
humkyung
|
string _ArrowMaxLength = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Arrow Max Length");
|
383 |
|
|
if (!string.IsNullOrEmpty(_ArrowMaxLength))
|
384 |
|
|
{
|
385 |
|
|
Forms.ExceptLayer.ArrowMaxLength = Convert.ToDouble(_ArrowMaxLength);
|
386 |
|
|
}
|
387 |
|
|
|
388 |
353b7f9f
|
humkyung
|
string _SpecialCharacters = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "SpecialCharacters");
|
389 |
|
|
if (!string.IsNullOrEmpty(_SpecialCharacters))
|
390 |
|
|
{
|
391 |
|
|
var tokens = _SpecialCharacters.Split(',').ToList();
|
392 |
|
|
Forms.ExceptLayer.SpecialCharacters.AddRange(tokens.ConvertAll(x =>
|
393 |
|
|
{
|
394 |
|
|
var characters = x.Split('=');
|
395 |
|
|
return new Forms.ExceptLayer.SpecialCharacter(characters[0], characters[1]);
|
396 |
|
|
}));
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
string _Casesensitive = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Casesensitive");
|
400 |
|
|
if (!string.IsNullOrEmpty(_Casesensitive))
|
401 |
|
|
{
|
402 |
|
|
Casesensitive = Convert.ToBoolean(_Casesensitive);
|
403 |
|
|
}
|
404 |
|
|
|
405 |
13a36357
|
humkyung
|
#region Except Layer를 로딩한다.
|
406 |
4b369ce1
|
humkyung
|
LoadLayerSettings();
|
407 |
|
|
#endregion
|
408 |
54be6611
|
humkyung
|
|
409 |
|
|
this.designCompare.WorkCompleted += DesignCompare_WorkCompleted;
|
410 |
|
|
}
|
411 |
|
|
|
412 |
|
|
private void ApplyLayers()
|
413 |
|
|
{
|
414 |
|
|
var others = this.designCompare.Entities.Where(x =>
|
415 |
|
|
{
|
416 |
|
|
return (x.LayerName != Verification.AVEVALayer && x.LayerName != Verification.AVEVADiffLayer &&
|
417 |
|
|
x.LayerName != Verification.AutoCADLayer && x.LayerName != Verification.AutoCADDiffLayer &&
|
418 |
|
|
x.LayerName != Verification.RevCloudLayer);
|
419 |
|
|
}).ToList();
|
420 |
|
|
|
421 |
|
|
others.ForEach(x =>
|
422 |
|
|
{
|
423 |
|
|
if (x.LayerName == Verification.AutoCADExceptLayer)
|
424 |
|
|
x.LayerName = Verification.AutoCADLayer;
|
425 |
|
|
else if (x.LayerName == Verification.AVEVAExceptLayer)
|
426 |
|
|
x.LayerName = Verification.AVEVALayer;
|
427 |
|
|
});
|
428 |
|
|
|
429 |
|
|
#region 레이어 설정 적용
|
430 |
|
|
var layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == Verification.RevCloudLayer.ToUpper());
|
431 |
|
|
if (layer != null) layer.Visible = this.radCheckBoxRevCloud.Checked;
|
432 |
|
|
|
433 |
|
|
layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == Verification.AVEVALayer.ToUpper());
|
434 |
|
|
if (layer != null)
|
435 |
|
|
{
|
436 |
|
|
var item = this.radCheckedDropDownListAVEVA.Items.FirstOrDefault(x => x.Text.ToUpper() == Verification.AVEVALayer.ToUpper());
|
437 |
|
|
if (item is RadCheckedListDataItem CheckedItem) layer.Visible = CheckedItem.Checked;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == Verification.AVEVADiffLayer.ToUpper());
|
441 |
|
|
if (layer != null)
|
442 |
|
|
{
|
443 |
|
|
var item = this.radCheckedDropDownListAVEVA.Items.FirstOrDefault(x => x.Text.ToUpper() == Verification.AVEVADiffLayer.ToUpper());
|
444 |
|
|
if (item is RadCheckedListDataItem CheckedItem) layer.Visible = CheckedItem.Checked;
|
445 |
|
|
}
|
446 |
|
|
|
447 |
|
|
layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == Verification.AutoCADLayer.ToUpper());
|
448 |
|
|
if (layer != null)
|
449 |
|
|
{
|
450 |
|
|
var item = this.radCheckedDropDownListAutoCAD.Items.FirstOrDefault(x => x.Text.ToUpper() == Verification.AutoCADLayer.ToUpper());
|
451 |
|
|
if (item is RadCheckedListDataItem CheckedItem) layer.Visible = CheckedItem.Checked;
|
452 |
|
|
}
|
453 |
|
|
|
454 |
|
|
layer = this.designCompare.Layers.FirstOrDefault(x => x.Name.ToUpper() == Verification.AutoCADDiffLayer.ToUpper());
|
455 |
|
|
if (layer != null)
|
456 |
|
|
{
|
457 |
|
|
var item = this.radCheckedDropDownListAutoCAD.Items.FirstOrDefault(x => x.Text.ToUpper() == Verification.AutoCADDiffLayer.ToUpper());
|
458 |
|
|
if (item is RadCheckedListDataItem CheckedItem) layer.Visible = CheckedItem.Checked;
|
459 |
|
|
}
|
460 |
|
|
#endregion
|
461 |
|
|
}
|
462 |
|
|
|
463 |
|
|
private void DesignCompare_WorkCompleted(object sender, devDept.WorkCompletedEventArgs e)
|
464 |
|
|
{
|
465 |
|
|
if(e.WorkUnit is Classes.CompareModelWorkUnit workunit)
|
466 |
|
|
{
|
467 |
|
|
ApplyLayers();
|
468 |
|
|
this.designCompare.Invalidate();
|
469 |
|
|
}
|
470 |
4b369ce1
|
humkyung
|
}
|
471 |
|
|
|
472 |
|
|
/// <summary>
|
473 |
|
|
/// 레이어 설정을 읽는다.
|
474 |
|
|
/// </summary>
|
475 |
|
|
public void LoadLayerSettings()
|
476 |
|
|
{
|
477 |
|
|
Forms.ExceptLayer.ExceptLayers.Clear();
|
478 |
288ed615
|
humkyung
|
Forms.ExceptLayer.LineLayers.Clear();
|
479 |
4b369ce1
|
humkyung
|
|
480 |
13a36357
|
humkyung
|
string _ExceptLayers = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Except Layers");
|
481 |
|
|
if (!string.IsNullOrEmpty(_ExceptLayers))
|
482 |
|
|
{
|
483 |
|
|
Forms.ExceptLayer.ExceptLayers.AddRange(_ExceptLayers.Split(',').ToList().ConvertAll(x => new Forms.ExceptLayer.Layer(x)));
|
484 |
|
|
|
485 |
|
|
string _ExceptLayersVisible = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Except Layers Visible");
|
486 |
|
|
if (!string.IsNullOrEmpty(_ExceptLayersVisible))
|
487 |
|
|
{
|
488 |
|
|
var tokens = _ExceptLayersVisible.Split(',').ToList().ConvertAll(x => Convert.ToBoolean(x));
|
489 |
|
|
for (int i = 0; i < Forms.ExceptLayer.ExceptLayers.Count; ++i)
|
490 |
|
|
{
|
491 |
|
|
if (i < tokens.Count)
|
492 |
|
|
{
|
493 |
|
|
Forms.ExceptLayer.ExceptLayers[i].Visible = tokens[i];
|
494 |
|
|
}
|
495 |
|
|
}
|
496 |
|
|
}
|
497 |
|
|
}
|
498 |
288ed615
|
humkyung
|
|
499 |
|
|
string _LineLayers = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Line Layers");
|
500 |
|
|
if (!string.IsNullOrEmpty(_LineLayers))
|
501 |
|
|
{
|
502 |
|
|
Forms.ExceptLayer.LineLayers.AddRange(_LineLayers.Split(',').ToList().ConvertAll(x => new Forms.ExceptLayer.Layer(x)));
|
503 |
|
|
}
|
504 |
13a36357
|
humkyung
|
}
|
505 |
|
|
|
506 |
|
|
/// <summary>
|
507 |
|
|
/// 엔터티들의 색상을 바꾼다.
|
508 |
|
|
/// </summary>
|
509 |
|
|
/// <param name="design"></param>
|
510 |
|
|
/// <param name="list"></param>
|
511 |
|
|
public void ColorEntities(Design design, IList<Entity> list, Color color, colorMethodType colorMethod=colorMethodType.byEntity, bool ChangeBlkColor=true)
|
512 |
|
|
{
|
513 |
|
|
foreach (Entity ent in list)
|
514 |
|
|
{
|
515 |
|
|
ColorEntity(design, ent, color, colorMethod, ChangeBlkColor);
|
516 |
|
|
}
|
517 |
|
|
}
|
518 |
|
|
|
519 |
|
|
/// <summary>
|
520 |
|
|
/// 엔터티의 색상을 변경한다.
|
521 |
|
|
/// </summary>
|
522 |
|
|
/// <param name="design"></param>
|
523 |
|
|
/// <param name="entity"></param>
|
524 |
|
|
/// <param name="color"></param>
|
525 |
|
|
private void ColorEntity(Design design, Entity entity, Color color, colorMethodType colorMethod = colorMethodType.byEntity,
|
526 |
|
|
bool ChangeBlkColor = true)
|
527 |
|
|
{
|
528 |
|
|
if (entity is BlockReference blkref)
|
529 |
|
|
{
|
530 |
|
|
blkref.Color = color;
|
531 |
|
|
blkref.ColorMethod = colorMethod;
|
532 |
|
|
|
533 |
|
|
if (ChangeBlkColor)
|
534 |
|
|
{
|
535 |
|
|
var blk = design.Blocks.FirstOrDefault(x => x.Name == blkref.BlockName);
|
536 |
|
|
if (blk != null)
|
537 |
|
|
{
|
538 |
|
|
ColorEntities(design, blk.Entities, color, colorMethodType.byParent);
|
539 |
|
|
foreach (var attr in blkref.Attributes.Values)
|
540 |
|
|
{
|
541 |
|
|
attr.Color = color;
|
542 |
|
|
attr.ColorMethod = colorMethodType.byParent;
|
543 |
|
|
}
|
544 |
|
|
}
|
545 |
|
|
}
|
546 |
|
|
}
|
547 |
|
|
else
|
548 |
|
|
{
|
549 |
|
|
entity.Color = color;
|
550 |
|
|
entity.ColorMethod = colorMethod;
|
551 |
|
|
}
|
552 |
|
|
}
|
553 |
|
|
|
554 |
3f59180e
|
humkyung
|
/// <summary>
|
555 |
|
|
/// 블럭 참조를 깨어 블럭의 구성 요소들을 리트스트 리턴한다.
|
556 |
|
|
/// </summary>
|
557 |
|
|
/// <param name="design"></param>
|
558 |
|
|
/// <param name="blkref"></param>
|
559 |
|
|
/// <param name="LayerName"></param>
|
560 |
|
|
/// <param name="color"></param>
|
561 |
|
|
/// <returns></returns>
|
562 |
|
|
private List<Entity> ExplodeBlockReference(BlockKeyedCollection Blocks, BlockReference blkref, string LayerName, Color color)
|
563 |
c4ba621d
|
humkyung
|
{
|
564 |
|
|
var res = new List<Entity>();
|
565 |
|
|
|
566 |
546bf875
|
humkyung
|
try
|
567 |
c4ba621d
|
humkyung
|
{
|
568 |
546bf875
|
humkyung
|
var entities = blkref.Explode(Blocks);
|
569 |
|
|
entities.ToList().ForEach(y =>
|
570 |
|
|
{
|
571 |
b08da970
|
humkyung
|
#region 블럭 이름이 ARROW로 시작되는 경우 Hatch로 화살표를 그려준다.
|
572 |
|
|
if (y is LinearPath arrow && arrow.Vertices.Length == 2 && blkref.BlockName.StartsWith("ARROW"))
|
573 |
|
|
{
|
574 |
546bf875
|
humkyung
|
double weight = arrow.LineWeight * blkref.GetScaleFactorY();
|
575 |
|
|
var dir = new devDept.Geometry.Vector3D(arrow.Vertices[0], arrow.Vertices[1]);
|
576 |
|
|
dir.Normalize();
|
577 |
|
|
var cross = devDept.Geometry.Vector3D.Cross(devDept.Geometry.Vector3D.AxisZ, dir);
|
578 |
|
|
var pts = new devDept.Geometry.Point3D[]
|
579 |
|
|
{
|
580 |
b08da970
|
humkyung
|
arrow.Vertices[1] + cross * weight * 0.5,
|
581 |
|
|
arrow.Vertices[0],
|
582 |
|
|
arrow.Vertices[1] - cross * weight * 0.5
|
583 |
546bf875
|
humkyung
|
};
|
584 |
b08da970
|
humkyung
|
|
585 |
546bf875
|
humkyung
|
var hatch = new Hatch("SOLID", new List<ICurve>() { new LinearPath(pts) });
|
586 |
|
|
res.Add(hatch);
|
587 |
|
|
}
|
588 |
b08da970
|
humkyung
|
#endregion
|
589 |
|
|
else if (y is LinearPath lp)
|
590 |
c4ba621d
|
humkyung
|
{
|
591 |
546bf875
|
humkyung
|
int count = Convert.ToInt32(lp.Vertices.Length);
|
592 |
|
|
for (int i = 0; i < count - 1; ++i)
|
593 |
c4ba621d
|
humkyung
|
{
|
594 |
546bf875
|
humkyung
|
var line = new devDept.Eyeshot.Entities.Line(lp.Vertices[i], lp.Vertices[i + 1])
|
595 |
|
|
{
|
596 |
|
|
LayerName = lp.LayerName,
|
597 |
|
|
LineWeight = lp.LineWeight,
|
598 |
|
|
LineTypeMethod = colorMethodType.byEntity,
|
599 |
|
|
Color = lp.Color,
|
600 |
|
|
ColorMethod = colorMethodType.byEntity
|
601 |
|
|
};
|
602 |
|
|
res.Add(line);
|
603 |
|
|
}
|
604 |
c4ba621d
|
humkyung
|
}
|
605 |
a8e46eba
|
humkyung
|
/// PORT, ARROW로 시작하는 블럭은 제외
|
606 |
546bf875
|
humkyung
|
else if (y is BlockReference subblkref && subblkref.BlockName != "PORT")
|
607 |
|
|
{
|
608 |
|
|
res.AddRange(ExplodeBlockReference(Blocks, subblkref, LayerName, color));
|
609 |
|
|
}
|
610 |
|
|
});
|
611 |
|
|
|
612 |
|
|
var attributes = blkref.Attributes.ToList();
|
613 |
|
|
foreach (var ent in entities.Where(y => y is devDept.Eyeshot.Entities.Attribute attr && !attr.Invisible))
|
614 |
c4ba621d
|
humkyung
|
{
|
615 |
546bf875
|
humkyung
|
var txt = ent as devDept.Eyeshot.Entities.Attribute;
|
616 |
|
|
#region 텍스트가 뒤집어지는 것을 방지하기 위해 평면을 교체
|
617 |
|
|
if (txt.Plane.AxisX.Equals(devDept.Geometry.Vector3D.AxisMinusX) && txt.Plane.AxisY.Equals(devDept.Geometry.Vector3D.AxisY))
|
618 |
|
|
{
|
619 |
|
|
txt.Plane = new devDept.Geometry.Plane(txt.Plane.Origin, devDept.Geometry.Vector3D.AxisX, devDept.Geometry.Vector3D.AxisY);
|
620 |
|
|
}
|
621 |
|
|
#endregion
|
622 |
|
|
txt.LayerName = LayerName;
|
623 |
|
|
txt.Color = color;
|
624 |
|
|
txt.ColorMethod = colorMethodType.byEntity;
|
625 |
|
|
KeyValuePair<string, AttributeReference>? kp = attributes.FirstOrDefault(z => z.Key == txt.Tag);
|
626 |
|
|
if (kp.HasValue)
|
627 |
|
|
{
|
628 |
|
|
///attributes.RemoveAll(x => x.Key == txt.Tag);
|
629 |
|
|
txt.TextString = (kp.Value.Value) != null ? kp.Value.Value.Value : string.Empty;
|
630 |
|
|
/*
|
631 |
|
|
if (string.IsNullOrEmpty(txt.TextString))
|
632 |
|
|
{
|
633 |
|
|
var attr = attributes.FirstOrDefault(x => !string.IsNullOrEmpty(x.Value.Value)).Value;
|
634 |
|
|
if (attr != null)
|
635 |
|
|
{
|
636 |
|
|
txt.TextString = attr.Value;
|
637 |
|
|
attributes.RemoveAll(x => x.Value.Equals(attr));
|
638 |
|
|
}
|
639 |
|
|
}
|
640 |
|
|
*/
|
641 |
|
|
}
|
642 |
c4ba621d
|
humkyung
|
}
|
643 |
|
|
|
644 |
546bf875
|
humkyung
|
res.AddRange(entities.Where(y =>
|
645 |
af504a98
|
humkyung
|
{
|
646 |
546bf875
|
humkyung
|
if (y is devDept.Eyeshot.Entities.Attribute attr && (string.IsNullOrEmpty(attr.TextString) || attr.Invisible)) return false;
|
647 |
|
|
if (y is devDept.Eyeshot.Entities.Text text && string.IsNullOrEmpty(text.TextString)) return false;
|
648 |
|
|
if (y is devDept.Eyeshot.Entities.Point) return false;
|
649 |
|
|
if (y is BlockReference subblkref) return false;
|
650 |
|
|
if (y is LinearPath) return false;
|
651 |
|
|
if (y.LayerName.ToUpper() == "AS_PORT") return false;
|
652 |
|
|
return true;
|
653 |
|
|
}));
|
654 |
|
|
|
655 |
|
|
#region 제외 레이어에 속한 항목은 포함하지 않는다.
|
656 |
|
|
res.RemoveAll(x =>
|
657 |
|
|
{
|
658 |
|
|
return Forms.ExceptLayer.ExceptLayers.Exists(y => y.Name.ToUpper() == x.LayerName.ToUpper() && !y.Visible);
|
659 |
|
|
});
|
660 |
1f75c4f0
|
humkyung
|
#endregion
|
661 |
546bf875
|
humkyung
|
foreach (var ent in res) ent.LayerName = LayerName;
|
662 |
c4ba621d
|
humkyung
|
|
663 |
546bf875
|
humkyung
|
blkref.Attributes.Clear();
|
664 |
|
|
///blkref.UpdateBoundingBox(new TraversalParams(design));
|
665 |
|
|
}
|
666 |
|
|
catch(Exception ex)
|
667 |
3f59180e
|
humkyung
|
{
|
668 |
546bf875
|
humkyung
|
Console.WriteLine(ex.Message);
|
669 |
|
|
}
|
670 |
c4ba621d
|
humkyung
|
|
671 |
|
|
return res;
|
672 |
|
|
}
|
673 |
|
|
|
674 |
13a36357
|
humkyung
|
/// <summary>
|
675 |
|
|
/// 주어진 도면의 원본과 AVEVA를 비교한다.
|
676 |
|
|
/// </summary>
|
677 |
|
|
private void CompareDrawing(Document doc, bool ResultOnly = false)
|
678 |
|
|
{
|
679 |
|
|
/// AutoCAD P&ID 파일을 화면에 표시한다.
|
680 |
|
|
void ShowAutoCADFile(string FilePath, Design design, bool clear = true)
|
681 |
|
|
{
|
682 |
|
|
if (clear) design.Clear();
|
683 |
3f59180e
|
humkyung
|
var AddEntities = new List<Entity>();
|
684 |
|
|
|
685 |
13a36357
|
humkyung
|
if (System.IO.File.Exists(FilePath))
|
686 |
|
|
{
|
687 |
|
|
try
|
688 |
|
|
{
|
689 |
3f59180e
|
humkyung
|
#region 다른 프로세스에서 파일을 열고 있는 경우 처리
|
690 |
|
|
using (var fs = File.Open(FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
691 |
|
|
#endregion
|
692 |
|
|
|
693 |
13a36357
|
humkyung
|
{
|
694 |
3f59180e
|
humkyung
|
devDept.Eyeshot.Translators.ReadAutodesk ra = new devDept.Eyeshot.Translators.ReadAutodesk(fs);
|
695 |
|
|
ra.DoWork();
|
696 |
|
|
var min = ra.Min;
|
697 |
|
|
if (!ra.Layers.Contains(Verification.AutoCADLayer)) ra.Layers.Add(Verification.AutoCADLayer, Verification.AutoCADColor);
|
698 |
288a94c5
|
humkyung
|
if (!ra.Layers.Contains(Verification.AutoCADDiffLayer)) ra.Layers.Add(Verification.AutoCADDiffLayer, Verification.DiffColor);
|
699 |
|
|
if (!ra.Layers.Contains(Verification.AutoCADExceptLayer)) ra.Layers.Add(Verification.AutoCADExceptLayer, Verification.AutoCADColor);
|
700 |
3f59180e
|
humkyung
|
foreach (var ent in ra.Entities)
|
701 |
|
|
{
|
702 |
|
|
/// 도면을 원점으로 맞춘다.
|
703 |
|
|
if (min.X != 0 && min.Y != 0) ent.Translate(-min.X, -min.Y);
|
704 |
|
|
|
705 |
b08da970
|
humkyung
|
if (ent is BlockReference blkref)
|
706 |
3f59180e
|
humkyung
|
{
|
707 |
|
|
AddEntities.AddRange(ExplodeBlockReference(ra.Blocks, blkref, Verification.AutoCADLayer, Verification.AutoCADColor));
|
708 |
|
|
}
|
709 |
|
|
}
|
710 |
|
|
ra.AddToScene(design);
|
711 |
13a36357
|
humkyung
|
}
|
712 |
|
|
}
|
713 |
|
|
catch (Exception ex)
|
714 |
|
|
{
|
715 |
|
|
RadMessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, RadMessageIcon.Error);
|
716 |
|
|
return;
|
717 |
|
|
}
|
718 |
|
|
|
719 |
288ed615
|
humkyung
|
#region LinearPath를 Line으로 분할한다.
|
720 |
|
|
design.Entities.ForEach(x =>
|
721 |
13a36357
|
humkyung
|
{
|
722 |
|
|
if (x is LinearPath lp)
|
723 |
|
|
{
|
724 |
51b9a24a
|
humkyung
|
#region 정점 수가 2이고 LineWeight이 0 초과이고 길이가 ArrowMaxLength보다 작을때 화살표를 그려준다.
|
725 |
|
|
if (lp.Vertices.Count() == 2 && lp.LineWeight > 0 && lp.Length() < Forms.ExceptLayer.ArrowMaxLength)
|
726 |
13a36357
|
humkyung
|
{
|
727 |
51b9a24a
|
humkyung
|
double weight = lp.LineWeight;
|
728 |
|
|
var dir = new devDept.Geometry.Vector3D(lp.Vertices[0], lp.Vertices[1]);
|
729 |
|
|
dir.Normalize();
|
730 |
|
|
var cross = devDept.Geometry.Vector3D.Cross(devDept.Geometry.Vector3D.AxisZ, dir);
|
731 |
|
|
var pts = new devDept.Geometry.Point3D[]
|
732 |
13a36357
|
humkyung
|
{
|
733 |
51b9a24a
|
humkyung
|
lp.Vertices[1] + cross * weight * 0.5,
|
734 |
|
|
lp.Vertices[0],
|
735 |
|
|
lp.Vertices[1] - cross * weight * 0.5
|
736 |
|
|
};
|
737 |
|
|
|
738 |
|
|
var hatch = new Hatch("SOLID", new List<ICurve>() { new LinearPath(pts) });
|
739 |
|
|
AddEntities.Add(hatch);
|
740 |
|
|
}
|
741 |
|
|
#endregion
|
742 |
|
|
else
|
743 |
|
|
{
|
744 |
|
|
int count = Convert.ToInt32(lp.Vertices.Length);
|
745 |
|
|
for (int i = 0; i < count - 1; ++i)
|
746 |
|
|
{
|
747 |
|
|
AddEntities.Add(new devDept.Eyeshot.Entities.Line(lp.Vertices[i], lp.Vertices[i + 1])
|
748 |
|
|
{
|
749 |
|
|
LayerName = lp.LayerName,
|
750 |
|
|
LineWeight = lp.LineWeight,
|
751 |
|
|
LineTypeMethod = colorMethodType.byEntity
|
752 |
|
|
});
|
753 |
|
|
}
|
754 |
13a36357
|
humkyung
|
}
|
755 |
|
|
}
|
756 |
|
|
});
|
757 |
288ed615
|
humkyung
|
design.Entities.RemoveAll(x => (x is LinearPath));
|
758 |
|
|
#endregion
|
759 |
13a36357
|
humkyung
|
|
760 |
1f75c4f0
|
humkyung
|
design.Entities.AddRange(AddEntities);
|
761 |
|
|
|
762 |
288ed615
|
humkyung
|
#region 브랜치가 생성되는 부분에서 파이프 라인을 분할
|
763 |
|
|
var queue = design.Entities.Where(x => x is Line &&
|
764 |
|
|
Forms.ExceptLayer.LineLayers.Exists(y => y.Name.ToUpper() == x.LayerName.ToUpper())).ToList();
|
765 |
13a36357
|
humkyung
|
while (queue.Any())
|
766 |
|
|
{
|
767 |
|
|
var line1 = queue.First() as Line;
|
768 |
|
|
var dir1 = line1.Direction;
|
769 |
|
|
dir1.Normalize();
|
770 |
|
|
queue.Remove(line1);
|
771 |
|
|
for (int i = 0; i < queue.Count; ++i)
|
772 |
|
|
{
|
773 |
|
|
var line2 = queue.ElementAt(i) as Line;
|
774 |
|
|
var dir2 = line2.Direction;
|
775 |
|
|
dir2.Normalize();
|
776 |
|
|
if (devDept.Geometry.Vector3D.AreOrthogonal(dir1, dir2))
|
777 |
|
|
{
|
778 |
|
|
var intersects = line1.IntersectWith(line2);
|
779 |
|
|
if (intersects.Count() == 1)
|
780 |
|
|
{
|
781 |
|
|
if (line1.StartPoint.DistanceTo(intersects[0]) > 0.1 && line1.EndPoint.DistanceTo(intersects[0]) > 0.1)
|
782 |
|
|
{
|
783 |
|
|
var split1 = new devDept.Eyeshot.Entities.Line(line1.StartPoint, intersects[0])
|
784 |
|
|
{
|
785 |
|
|
LayerName = line1.LayerName,
|
786 |
|
|
LineWeight = line1.LineWeight,
|
787 |
|
|
LineTypeMethod = colorMethodType.byEntity
|
788 |
|
|
};
|
789 |
|
|
var split2 = new devDept.Eyeshot.Entities.Line(intersects[0], line1.EndPoint)
|
790 |
|
|
{
|
791 |
|
|
LayerName = line1.LayerName,
|
792 |
|
|
LineWeight = line1.LineWeight,
|
793 |
|
|
LineTypeMethod = colorMethodType.byEntity
|
794 |
|
|
};
|
795 |
|
|
design.Entities.Add(split1);
|
796 |
|
|
design.Entities.Add(split2);
|
797 |
|
|
design.Entities.Remove(line1);
|
798 |
|
|
|
799 |
|
|
queue.Add(split1);
|
800 |
|
|
queue.Add(split2);
|
801 |
|
|
|
802 |
|
|
break;
|
803 |
|
|
}
|
804 |
|
|
|
805 |
|
|
if (line2.StartPoint.DistanceTo(intersects[0]) > 0.1 && line2.EndPoint.DistanceTo(intersects[0]) > 0.1)
|
806 |
|
|
{
|
807 |
|
|
var split1 = new devDept.Eyeshot.Entities.Line(line2.StartPoint, intersects[0])
|
808 |
|
|
{
|
809 |
|
|
LayerName = line2.LayerName,
|
810 |
|
|
LineWeight = line2.LineWeight,
|
811 |
|
|
LineTypeMethod = colorMethodType.byEntity
|
812 |
|
|
};
|
813 |
|
|
var split2 = new devDept.Eyeshot.Entities.Line(intersects[0], line2.EndPoint)
|
814 |
|
|
{
|
815 |
|
|
LayerName = line2.LayerName,
|
816 |
|
|
LineWeight = line2.LineWeight,
|
817 |
|
|
LineTypeMethod = colorMethodType.byEntity
|
818 |
|
|
};
|
819 |
|
|
design.Entities.Add(split1);
|
820 |
|
|
design.Entities.Add(split2);
|
821 |
|
|
design.Entities.Remove(line2);
|
822 |
|
|
|
823 |
|
|
queue.Remove(line2);
|
824 |
|
|
queue.Add(split1);
|
825 |
|
|
queue.Add(split2);
|
826 |
|
|
}
|
827 |
|
|
}
|
828 |
|
|
}
|
829 |
|
|
}
|
830 |
|
|
}
|
831 |
|
|
#endregion
|
832 |
|
|
|
833 |
288ed615
|
humkyung
|
#region 레이어 변경
|
834 |
|
|
foreach (var ent in design.Entities)
|
835 |
|
|
{
|
836 |
|
|
ent.Color = Verification.AutoCADColor;
|
837 |
|
|
ent.ColorMethod = colorMethodType.byEntity;
|
838 |
|
|
if (!Forms.ExceptLayer.ExceptLayers.Exists(x => x.Name.ToUpper() == ent.LayerName.ToUpper()))
|
839 |
|
|
{
|
840 |
|
|
ent.LayerName = Verification.AutoCADLayer;
|
841 |
|
|
}
|
842 |
288a94c5
|
humkyung
|
else
|
843 |
|
|
{
|
844 |
|
|
ent.LayerName = Verification.AutoCADExceptLayer;
|
845 |
|
|
}
|
846 |
288ed615
|
humkyung
|
}
|
847 |
|
|
#endregion
|
848 |
|
|
|
849 |
3f59180e
|
humkyung
|
#region 블럭이거나 제외 레이어에 속한 항목은 제거
|
850 |
288ed615
|
humkyung
|
design.Entities.RemoveAll(x => (x is BlockReference) || Forms.ExceptLayer.ExceptLayers.Exists(y => y.Name.ToUpper() == x.LayerName.ToUpper() && !y.Visible));
|
851 |
3f59180e
|
humkyung
|
#endregion
|
852 |
c4ba621d
|
humkyung
|
|
853 |
|
|
#region 눈에 보이지 않는 라인은 제거
|
854 |
|
|
design.Entities.RemoveAll(x => x is Line line && line.Length() < 0.001);
|
855 |
|
|
#endregion
|
856 |
288ed615
|
humkyung
|
|
857 |
13a36357
|
humkyung
|
ColorEntities(design, design.Entities, Verification.AutoCADColor);
|
858 |
|
|
|
859 |
|
|
// Sets the view as Top
|
860 |
|
|
design.SetView(viewType.Top);
|
861 |
|
|
design.ZoomFit();
|
862 |
|
|
design.Invalidate();
|
863 |
|
|
}
|
864 |
|
|
}
|
865 |
|
|
|
866 |
|
|
/// AVEVA P&ID 파일을 화면에 표시한다.
|
867 |
|
|
void ShowAVEVAPIDFile(string FilePath, Design design, bool clear = true)
|
868 |
|
|
{
|
869 |
|
|
if (clear) design.Clear();
|
870 |
|
|
if (System.IO.File.Exists(FilePath))
|
871 |
|
|
{
|
872 |
288ed615
|
humkyung
|
var AddEntities = new List<Entity>();
|
873 |
|
|
|
874 |
3f59180e
|
humkyung
|
#region 다른 프로세스에서 파일을 열고 있는 경우 처리
|
875 |
|
|
using (var fs = File.Open(FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
876 |
|
|
#endregion
|
877 |
13a36357
|
humkyung
|
{
|
878 |
3f59180e
|
humkyung
|
devDept.Eyeshot.Translators.ReadAutodesk ra = new devDept.Eyeshot.Translators.ReadAutodesk(fs);
|
879 |
|
|
ra.DoWork();
|
880 |
13a36357
|
humkyung
|
|
881 |
3f59180e
|
humkyung
|
if (!ra.Layers.Contains(Verification.AVEVALayer)) ra.Layers.Add(Verification.AVEVALayer, Verification.AVEVAColor);
|
882 |
288a94c5
|
humkyung
|
if (!ra.Layers.Contains(Verification.AVEVADiffLayer)) ra.Layers.Add(Verification.AVEVADiffLayer, Verification.DiffColor);
|
883 |
|
|
if (!ra.Layers.Contains(Verification.AVEVAExceptLayer)) ra.Layers.Add(Verification.AVEVAExceptLayer, Verification.AVEVAColor);
|
884 |
3f59180e
|
humkyung
|
var min = ra.Min;
|
885 |
|
|
foreach (var ent in ra.Entities)
|
886 |
13a36357
|
humkyung
|
{
|
887 |
3f59180e
|
humkyung
|
/// 도면을 원점으로 맞춘다.
|
888 |
|
|
if (min.X != 0 && min.Y != 0) ent.Translate(-min.X, -min.Y);
|
889 |
|
|
|
890 |
|
|
#region 멀티 라인들을 분할하여 추가한다.
|
891 |
|
|
if (ent is Mesh mesh && (mesh.LayerName == "AS_PIPE" || mesh.LayerName == "AS_INST"))
|
892 |
13a36357
|
humkyung
|
{
|
893 |
3f59180e
|
humkyung
|
int count = Convert.ToInt32(mesh.Vertices.Length * 0.5);
|
894 |
|
|
for (int i = 0; i < count - 1; ++i)
|
895 |
13a36357
|
humkyung
|
{
|
896 |
3f59180e
|
humkyung
|
AddEntities.Add(new devDept.Eyeshot.Entities.Line(mesh.Vertices[i], mesh.Vertices[i + 1])
|
897 |
13a36357
|
humkyung
|
{
|
898 |
288ed615
|
humkyung
|
LayerName = Verification.AVEVALayer,
|
899 |
13a36357
|
humkyung
|
LineWeight = 3.0f,
|
900 |
|
|
LineTypeMethod = colorMethodType.byEntity,
|
901 |
|
|
Color = Verification.AVEVAColor,
|
902 |
|
|
ColorMethod = colorMethodType.byEntity
|
903 |
3f59180e
|
humkyung
|
});
|
904 |
|
|
}
|
905 |
13a36357
|
humkyung
|
}
|
906 |
3f59180e
|
humkyung
|
else if (ent is TabulatedSurface tf && (tf.LayerName == "AS_PIPE" || tf.LayerName == "AS_INST"))
|
907 |
13a36357
|
humkyung
|
{
|
908 |
3f59180e
|
humkyung
|
int count = Convert.ToInt32(tf.ControlPoints.Length * 0.5);
|
909 |
|
|
for (int i = 0; i < count - 1; ++i)
|
910 |
13a36357
|
humkyung
|
{
|
911 |
3f59180e
|
humkyung
|
AddEntities.Add(
|
912 |
|
|
new devDept.Eyeshot.Entities.Line(
|
913 |
|
|
new devDept.Geometry.Point3D(tf.ControlPoints[i, 0].X, tf.ControlPoints[i, 0].Y, 0),
|
914 |
|
|
new devDept.Geometry.Point3D(tf.ControlPoints[i + 1, 0].X, tf.ControlPoints[i + 1, 0].Y, 0))
|
915 |
|
|
{
|
916 |
|
|
LayerName = Verification.AVEVALayer,
|
917 |
|
|
LineWeight = 3.0f,
|
918 |
|
|
LineTypeMethod = colorMethodType.byEntity,
|
919 |
|
|
Color = Verification.AVEVAColor,
|
920 |
|
|
ColorMethod = colorMethodType.byEntity
|
921 |
|
|
}
|
922 |
|
|
);
|
923 |
|
|
}
|
924 |
|
|
}
|
925 |
|
|
else if (ent is LinearPath lp)
|
926 |
|
|
{
|
927 |
288a94c5
|
humkyung
|
string LayerName = Forms.ExceptLayer.ExceptLayers.Exists(x => x.Name.ToUpper() == lp.LayerName.ToUpper()) ?
|
928 |
|
|
Verification.AVEVAExceptLayer : Verification.AVEVALayer;
|
929 |
3f59180e
|
humkyung
|
int count = Convert.ToInt32(lp.Vertices.Length);
|
930 |
|
|
for (int i = 0; i < count - 1; ++i)
|
931 |
|
|
{
|
932 |
|
|
AddEntities.Add(new devDept.Eyeshot.Entities.Line(lp.Vertices[i], lp.Vertices[i + 1])
|
933 |
|
|
{
|
934 |
288a94c5
|
humkyung
|
LayerName = LayerName,
|
935 |
3f59180e
|
humkyung
|
LineWeight = lp.LineWeight,
|
936 |
|
|
Color = Verification.AVEVAColor,
|
937 |
|
|
LineTypeMethod = colorMethodType.byEntity
|
938 |
|
|
});
|
939 |
|
|
}
|
940 |
b08da970
|
humkyung
|
|
941 |
|
|
#region 밑에서 제거하기 위해 레이어를 AVEVALayer로 바꿔준다.
|
942 |
|
|
lp.LayerName = Verification.AVEVALayer;
|
943 |
|
|
#endregion
|
944 |
3f59180e
|
humkyung
|
}
|
945 |
|
|
#endregion
|
946 |
|
|
else if (ent is BlockReference blkref)
|
947 |
|
|
{
|
948 |
b08da970
|
humkyung
|
if (blkref.BlockName != "LBRK" && blkref.BlockName != "PSNODE" && blkref.BlockName != "PENODE")
|
949 |
3f59180e
|
humkyung
|
{
|
950 |
|
|
AddEntities.AddRange(ExplodeBlockReference(ra.Blocks, blkref, Verification.AVEVALayer, Verification.AVEVAColor));
|
951 |
|
|
}
|
952 |
13a36357
|
humkyung
|
}
|
953 |
288ed615
|
humkyung
|
|
954 |
3f59180e
|
humkyung
|
ent.Color = Verification.AVEVAColor;
|
955 |
|
|
ent.ColorMethod = colorMethodType.byEntity;
|
956 |
|
|
if (!Forms.ExceptLayer.ExceptLayers.Exists(x => x.Name.ToUpper() == ent.LayerName.ToUpper()))
|
957 |
|
|
{
|
958 |
|
|
ent.LayerName = Verification.AVEVALayer;
|
959 |
|
|
}
|
960 |
288a94c5
|
humkyung
|
else
|
961 |
|
|
{
|
962 |
|
|
ent.LayerName = Verification.AVEVAExceptLayer;
|
963 |
|
|
}
|
964 |
288ed615
|
humkyung
|
}
|
965 |
3f59180e
|
humkyung
|
ra.AddToScene(design);
|
966 |
288ed615
|
humkyung
|
}
|
967 |
|
|
|
968 |
c4ba621d
|
humkyung
|
#region 불필요한 블럭들은 제거
|
969 |
3f59180e
|
humkyung
|
design.Entities.RemoveAll(x => x is BlockReference);
|
970 |
c4ba621d
|
humkyung
|
#endregion
|
971 |
|
|
|
972 |
288ed615
|
humkyung
|
#region 블럭을 깸
|
973 |
|
|
design.Entities.Where(x => x.LayerName == Verification.AVEVALayer).ToList().ForEach(x =>
|
974 |
|
|
{
|
975 |
|
|
if(x is BlockReference blkref)
|
976 |
13a36357
|
humkyung
|
{
|
977 |
3f59180e
|
humkyung
|
AddEntities.AddRange(ExplodeBlockReference(design.Blocks, blkref, Verification.AVEVALayer, Verification.AVEVAColor));
|
978 |
13a36357
|
humkyung
|
}
|
979 |
|
|
});
|
980 |
|
|
design.Entities.RemoveAll(x =>
|
981 |
288ed615
|
humkyung
|
((x is Mesh || x is TabulatedSurface) && (x.LayerName == Verification.AVEVALayer)) ||
|
982 |
|
|
(x is LinearPath && x.LayerName == Verification.AVEVALayer) || (x is BlockReference) ||
|
983 |
13a36357
|
humkyung
|
Forms.ExceptLayer.ExceptLayers.Exists(y => y.Name.ToUpper() == x.LayerName.ToUpper() && !y.Visible));
|
984 |
|
|
design.Entities.AddRange(AddEntities);
|
985 |
|
|
#endregion
|
986 |
|
|
|
987 |
c4ba621d
|
humkyung
|
#region 눈에 보이지 않는 라인은 제거
|
988 |
|
|
design.Entities.RemoveAll(x => x is Line line && line.Length() < 0.001);
|
989 |
13a36357
|
humkyung
|
#endregion
|
990 |
|
|
|
991 |
c4ba621d
|
humkyung
|
ColorEntities(design, design.Entities.Where(x => x.LayerName == Verification.AVEVALayer).ToList(), Verification.AVEVAColor);
|
992 |
|
|
|
993 |
13a36357
|
humkyung
|
design.SetView(viewType.Top);
|
994 |
|
|
design.ZoomFit();
|
995 |
|
|
design.Invalidate();
|
996 |
|
|
}
|
997 |
|
|
}
|
998 |
|
|
|
999 |
|
|
string dwgExtension = ".dwg";
|
1000 |
|
|
string ID2DrawingFolder = Program.AutoCADFolder;
|
1001 |
|
|
string dwgFilePath = System.IO.Path.Combine(ID2DrawingFolder, $"{doc.DocumentNo}{dwgExtension}");
|
1002 |
|
|
if (!ResultOnly) ShowAutoCADFile(dwgFilePath, this.designAutoCAD);
|
1003 |
|
|
ShowAutoCADFile(dwgFilePath, this.designCompare);
|
1004 |
|
|
|
1005 |
|
|
string AVEVAPIDFolder = Program.AVEVAPIDFolder;
|
1006 |
|
|
string AVEVAPIDFilePath = string.Empty;
|
1007 |
|
|
if (AVEVAPIDFolder != null)
|
1008 |
|
|
{
|
1009 |
|
|
AVEVAPIDFilePath = System.IO.Path.Combine(AVEVAPIDFolder, $"{doc.DocumentNo}{dwgExtension}");
|
1010 |
|
|
if (!ResultOnly) ShowAVEVAPIDFile(AVEVAPIDFilePath, this.designAVEVA);
|
1011 |
|
|
ShowAVEVAPIDFile(AVEVAPIDFilePath, this.designCompare, false);
|
1012 |
|
|
}
|
1013 |
|
|
|
1014 |
|
|
if (System.IO.File.Exists(dwgFilePath) && System.IO.File.Exists(AVEVAPIDFilePath))
|
1015 |
|
|
{
|
1016 |
353b7f9f
|
humkyung
|
#region 비교 작업 수행
|
1017 |
13a36357
|
humkyung
|
var AutoCADEntities = this.designCompare.Entities.Where(x => x.LayerName == Verification.AutoCADLayer).ToList();
|
1018 |
|
|
var AVEVAtities = this.designCompare.Entities.Where(x => x.LayerName == Verification.AVEVALayer).ToList();
|
1019 |
54be6611
|
humkyung
|
var workunit = new Classes.CompareModelWorkUnit(this.designCompare, AutoCADEntities, AVEVAtities);
|
1020 |
|
|
workunit.Tolerance = Verification.Tolerance;
|
1021 |
|
|
workunit.LengthToleranceRatio = Verification.LengthToleranceRatio;
|
1022 |
|
|
workunit.AutoCADDiffLayer = Verification.AutoCADDiffLayer;
|
1023 |
|
|
workunit.AVEVADiffLayer = Verification.AVEVADiffLayer;
|
1024 |
|
|
workunit.DiffColor = Verification.DiffColor;
|
1025 |
|
|
workunit.RevCloudLayer = Verification.RevCloudLayer;
|
1026 |
|
|
workunit.RevCloudColor = Verification.RevCloudColor;
|
1027 |
353b7f9f
|
humkyung
|
workunit.SpecialCharacters.AddRange(Forms.ExceptLayer.SpecialCharacters);
|
1028 |
|
|
workunit.Casesensitive = Casesensitive;
|
1029 |
54be6611
|
humkyung
|
if (!this.designCompare.IsBusy && !ResultOnly)
|
1030 |
|
|
{
|
1031 |
|
|
this.designCompare.StartWork(workunit);
|
1032 |
|
|
}
|
1033 |
|
|
else
|
1034 |
|
|
{
|
1035 |
|
|
workunit.DoWork();
|
1036 |
|
|
ApplyLayers();
|
1037 |
|
|
}
|
1038 |
13a36357
|
humkyung
|
#endregion
|
1039 |
|
|
}
|
1040 |
|
|
}
|
1041 |
|
|
|
1042 |
|
|
#region Camera Sync
|
1043 |
|
|
private void CameraChanged(object sender, devDept.Eyeshot.Workspace.CameraMoveEventArgs e)
|
1044 |
|
|
{
|
1045 |
|
|
if (sender == this.designAutoCAD)
|
1046 |
|
|
{
|
1047 |
|
|
SyncCamera(this.designAutoCAD, this.designAVEVA);
|
1048 |
|
|
SyncCamera(this.designAutoCAD, this.designCompare);
|
1049 |
|
|
}
|
1050 |
|
|
else if (sender == this.designAVEVA)
|
1051 |
|
|
{
|
1052 |
|
|
SyncCamera(this.designAVEVA, this.designAutoCAD);
|
1053 |
|
|
SyncCamera(this.designAVEVA, this.designCompare);
|
1054 |
|
|
}
|
1055 |
|
|
else
|
1056 |
|
|
{
|
1057 |
|
|
SyncCamera(this.designCompare, this.designAutoCAD);
|
1058 |
|
|
SyncCamera(this.designCompare, this.designAVEVA);
|
1059 |
|
|
}
|
1060 |
|
|
}
|
1061 |
|
|
|
1062 |
|
|
private void SyncCamera(Design designMovedCamera, Design designCameraToMove)
|
1063 |
|
|
{
|
1064 |
|
|
Camera savedCamera;
|
1065 |
|
|
designMovedCamera.SaveView(out savedCamera);
|
1066 |
|
|
|
1067 |
|
|
// restores the camera to the other model
|
1068 |
|
|
designCameraToMove.RestoreView(savedCamera);
|
1069 |
|
|
designCameraToMove.AdjustNearAndFarPlanes();
|
1070 |
|
|
designCameraToMove.Invalidate();
|
1071 |
|
|
}
|
1072 |
|
|
#endregion
|
1073 |
|
|
}
|
1074 |
|
|
} |