개정판 e5662165
dev issue #000 : edit Association
DTI_PID/SPPIDConverter_CustomCommand/SPPIDAutoModeling/Model/SPPID/Symbol.cs | ||
---|---|---|
190 | 190 |
text.Modeling(document); |
191 | 191 |
text.SetAttribute(document); |
192 | 192 |
} |
193 |
else |
|
194 |
{ |
|
195 |
|
|
196 |
} |
|
193 | 197 |
} |
194 | 198 |
} |
195 | 199 |
} |
... | ... | |
217 | 221 |
LMSymbol _LmSymbol = SPPID_ITEM_OBJECT as LMSymbol; |
218 | 222 |
if (_LmSymbol != null) |
219 | 223 |
{ |
220 |
LMPipingComp _LmPipingComp = _placement.PIDDataSource.GetPipingComp(_LmSymbol.ModelItemID);
|
|
221 |
if (_LmPipingComp != null)
|
|
224 |
string fileName = _LmSymbol.get_FileName();
|
|
225 |
if (fileName.Contains("Piping"))
|
|
222 | 226 |
{ |
223 |
foreach (ItemAttribute attr in ATTRIBUTES) |
|
227 |
LMPipingComp _LmPipingComp = _placement.PIDDataSource.GetPipingComp(_LmSymbol.ModelItemID); |
|
228 |
if (_LmPipingComp != null) |
|
224 | 229 |
{ |
225 |
if (string.IsNullOrEmpty(attr.VALUE)) |
|
226 |
continue; |
|
230 |
foreach (ItemAttribute attr in ATTRIBUTES) |
|
231 |
{ |
|
232 |
if (string.IsNullOrEmpty(attr.VALUE)) |
|
233 |
continue; |
|
227 | 234 |
|
228 |
LMAAttribute lMAAttribute = _LmPipingComp.Attributes[attr.SPPIDMAPPINGNAME]; |
|
229 |
if (lMAAttribute != null) |
|
235 |
LMAAttribute lMAAttribute = _LmPipingComp.Attributes[attr.SPPIDMAPPINGNAME]; |
|
236 |
if (lMAAttribute != null) |
|
237 |
{ |
|
238 |
if (DBNull.Value.Equals(lMAAttribute.get_Value())) |
|
239 |
_LmPipingComp.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
|
240 |
else if (lMAAttribute.get_Value() != attr.VALUE) |
|
241 |
_LmPipingComp.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
|
242 |
} |
|
243 |
} |
|
244 |
_LmPipingComp.Commit(); |
|
245 |
} |
|
246 |
} |
|
247 |
else if (fileName.Contains("Instrumentation")) |
|
248 |
{ |
|
249 |
LMInstrument _LmInstrument = _placement.PIDDataSource.GetInstrument(_LmSymbol.ModelItemID); |
|
250 |
if (_LmInstrument != null) |
|
251 |
{ |
|
252 |
foreach (ItemAttribute attr in ATTRIBUTES) |
|
230 | 253 |
{ |
231 |
if (DBNull.Value.Equals(lMAAttribute.get_Value())) |
|
232 |
_LmPipingComp.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
|
233 |
else if (lMAAttribute.get_Value() != attr.VALUE) |
|
234 |
_LmPipingComp.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
|
254 |
if (string.IsNullOrEmpty(attr.VALUE)) |
|
255 |
continue; |
|
256 |
|
|
257 |
LMAAttribute lMAAttribute = _LmInstrument.Attributes[attr.SPPIDMAPPINGNAME]; |
|
258 |
if (lMAAttribute != null) |
|
259 |
{ |
|
260 |
if (DBNull.Value.Equals(lMAAttribute.get_Value())) |
|
261 |
_LmInstrument.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
|
262 |
else if (lMAAttribute.get_Value() != attr.VALUE) |
|
263 |
_LmInstrument.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
|
264 |
} |
|
235 | 265 |
} |
266 |
_LmInstrument.Commit(); |
|
236 | 267 |
} |
237 |
_LmPipingComp.Commit(); |
|
238 | 268 |
} |
239 | 269 |
} |
240 | 270 |
} |
DTI_PID/SPPIDConverter_CustomCommand/SPPIDAutoModeling/Model/SPPID/Text.cs | ||
---|---|---|
24 | 24 |
private double _LOCATION_Y; |
25 | 25 |
private string _VALUE; |
26 | 26 |
private string _OWNER; |
27 |
private bool _IsAssociation; |
|
27 | 28 |
|
28 | 29 |
public double ANGLE { get => _ANGLE; set => _ANGLE = value; } |
29 | 30 |
public string LOCATION { get => _LOCATION; set => _LOCATION = value; } |
... | ... | |
31 | 32 |
public double LOCATION_Y { get => _LOCATION_Y; set => _LOCATION_Y = value; } |
32 | 33 |
public string VALUE { get => _VALUE; set => _VALUE = value; } |
33 | 34 |
public string OWNER { get => _OWNER; set => _OWNER = value; } |
35 |
public bool IsAssociation { get => _IsAssociation; } |
|
34 | 36 |
#endregion |
35 | 37 |
public override void AfterSetting(Document document) |
36 | 38 |
{ |
... | ... | |
61 | 63 |
// Input Drawing |
62 | 64 |
document.TEXTS.Add(this); |
63 | 65 |
// End |
66 |
|
|
67 |
// Association Check |
|
68 |
foreach (Symbol symbol in document.SYMBOLS) |
|
69 |
{ |
|
70 |
foreach (Association association in symbol.ASSOCIATIONS) |
|
71 |
{ |
|
72 |
if (association.TYPE_VALUE == UID) |
|
73 |
{ |
|
74 |
_IsAssociation = true; |
|
75 |
} |
|
76 |
} |
|
77 |
} |
|
64 | 78 |
} |
65 | 79 |
|
66 | 80 |
public override bool Modeling(Document document) |
... | ... | |
70 | 84 |
if (SPPID_ITEM_OBJECT == null) |
71 | 85 |
{ |
72 | 86 |
Placement _placement = new Placement(); |
73 |
if (NAME == "TEXT" || NAME == "NOTE")
|
|
87 |
if ((NAME == "TEXT" || NAME == "NOTE" ) && !IsAssociation)
|
|
74 | 88 |
{ |
75 | 89 |
LMSymbol _LmSymbol = _placement.PIDPlaceSymbol(SPPIDMAPPINGNAME, LOCATION_X, LOCATION_Y, Rotation: ANGLE); |
76 | 90 |
LMItemNote _LmItemNote = _placement.PIDDataSource.GetItemNote(_LmSymbol.ModelItemID); |
DTI_PID/SPPIDConverter_CustomCommand/SPPIDAutoModeling/Modeling/AutoModeling.cs | ||
---|---|---|
10 | 10 |
using Plaice; |
11 | 11 |
using SPPID.Model; |
12 | 12 |
using SPPID.Utill; |
13 |
using System.Diagnostics; |
|
14 |
|
|
13 | 15 |
|
14 | 16 |
namespace SPPID.Modeling |
15 | 17 |
{ |
... | ... | |
33 | 35 |
} |
34 | 36 |
|
35 | 37 |
Log.WriteLine(new ListBoxItem(string.Format("----- START [{0}] -----", document.DWGNAME), Color.Black), logListBox); |
36 |
|
|
38 |
Stopwatch sw = new Stopwatch(); |
|
39 |
sw.Start(); |
|
37 | 40 |
CloseOPCForm.Run(); |
38 | 41 |
|
39 | 42 |
// Group Symbol 실패시 Group Remove |
... | ... | |
108 | 111 |
foreach (Text text in document.TEXTS) |
109 | 112 |
{ |
110 | 113 |
text.Modeling(document); |
111 |
if (text.SPPID_ITEM_OBJECT != null) |
|
114 |
if (text.SPPID_ITEM_OBJECT != null || text.IsAssociation)
|
|
112 | 115 |
Log.WriteLine(new ListBoxItem(string.Format("Create Text UID : {0}", text.UID), Color.Black), logListBox); |
113 | 116 |
else |
114 | 117 |
{ |
115 | 118 |
Log.WriteLine(new ListBoxItem(string.Format("Fail Text UID : {0}", text.UID), Color.Red), logListBox); |
116 | 119 |
Log.WriteLine(text.VALUE + "/" + text.SPPIDMAPPINGNAME); |
117 | 120 |
} |
118 |
|
|
121 |
|
|
119 | 122 |
Log.ProgressBarIncrement(progressBar); |
120 | 123 |
} |
121 | 124 |
|
125 |
if (progressBar != null) |
|
126 |
{ |
|
127 |
Log.SetProgressBarValue(0, progressBar); |
|
128 |
Log.SetProgressMaximumValue(document.SYMBOLS.Count, progressBar); |
|
129 |
} |
|
122 | 130 |
// attribute |
123 | 131 |
foreach (Symbol item in document.SYMBOLS) |
124 | 132 |
{ |
... | ... | |
126 | 134 |
{ |
127 | 135 |
item.SetAttribute(document); |
128 | 136 |
} |
137 |
Log.ProgressBarIncrement(progressBar); |
|
129 | 138 |
} |
130 | 139 |
|
131 | 140 |
|
132 |
|
|
133 | 141 |
CloseOPCForm.Stop(); |
134 | 142 |
// |
135 | 143 |
Log.SetProgressBarValue(progressBar.Maximum, progressBar); |
136 | 144 |
|
137 | 145 |
Log.WriteLine(new ListBoxItem(string.Format("----- END [{0}] -----", document.DWGNAME), Color.Black), logListBox); |
146 |
sw.Stop(); |
|
147 |
TimeSpan ts = sw.Elapsed; |
|
148 |
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", |
|
149 |
ts.Hours, ts.Minutes, ts.Seconds, |
|
150 |
ts.Milliseconds / 10); |
|
151 |
Log.WriteLine(new ListBoxItem(string.Format("Time : {0}", ts), Color.Black), logListBox); |
|
138 | 152 |
Log.WriteLine(new ListBoxItem("", Color.Black), logListBox); |
139 | 153 |
} |
140 | 154 |
|
내보내기 Unified diff