프로젝트

일반

사용자정보

개정판 63fbf592

ID63fbf592f8052c3ebd3373d3f8c2ba46fba5cca9
상위 4ba01591
하위 dfac4553, db62fc05

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

dev issue #000 : inconsistancy check (value 값이 다를 경우 초기화)

Change-Id: Ie2dd79fea10fdaace7304b533fa0e17003304118

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
387 387
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Attribute");
388 388
            SetSystemEditingCommand(false);
389 389

  
390
            foreach (LMRelationship relationship in currentDrawing.Relationships)
390
            bool loop = true;
391
            while (loop)
391 392
            {
392
                foreach (LMInconsistency inconsistency in relationship.Inconsistencies)
393
                loop = false;
394
                LMAFilter filter = new LMAFilter();
395
                LMACriterion criterion = new LMACriterion();
396
                filter.ItemType = "Relationship";
397
                criterion.SourceAttributeName = "SP_DRAWINGID";
398
                criterion.Operator = "=";
399
                criterion.set_ValueAttribute(currentDrawing.Id);
400
                filter.get_Criteria().Add(criterion);
401

  
402
                LMRelationships relationships = new LMRelationships();
403
                relationships.Collect(dataSource, Filter: filter);
404

  
405
                foreach (LMRelationship relationship in relationships)
393 406
                {
394
                    if (inconsistency.get_InconsistencyTypeIndex() == 1)
407
                    foreach (LMInconsistency inconsistency in relationship.Inconsistencies)
395 408
                    {
396
                        LMAAttribute attribute1 = ((dynamic)relationship.Item1RepresentationObject).ModelItemObject.Attributes[inconsistency.get_PropNameItem1()];
397
                        LMAAttribute attribute2 = ((dynamic)relationship.Item2RepresentationObject).ModelItemObject.Attributes[inconsistency.get_PropNameItem2()];
398
                        if (attribute1 != null && !DBNull.Value.Equals(attribute1.get_Value()))
399
                            attribute1.set_Value(DBNull.Value);
400
                        if (attribute2 != null && !DBNull.Value.Equals(attribute2.get_Value()))
401
                            attribute2.set_Value(DBNull.Value);
402
                        inconsistency.Commit();
409
                        if (inconsistency.get_InconsistencyTypeIndex() == 1)
410
                        {
411
                            LMModelItem modelItem1 = relationship.Item1RepresentationObject == null ? null : relationship.Item1RepresentationObject.ModelItemObject;
412
                            LMModelItem modelItem2 = relationship.Item2RepresentationObject == null ? null : relationship.Item2RepresentationObject.ModelItemObject;
413
                            string[] array = inconsistency.get_Name().ToString().Split(new char[] { '=' });
414
                            if (modelItem1 != null)
415
                            {
416
                                string attrName = array[0];
417
                                if (attrName.Contains("PipingPoint"))
418
                                {
419
                                    string originalAttr = attrName.Split(new char[] { '.' })[1];
420
                                    int index = 1;
421
                                    while (modelItem1.Attributes["PipingPoint" + index + "." + originalAttr] != null)
422
                                    {
423
                                        LMAAttribute attribute1 = modelItem1.Attributes["PipingPoint" + index + "." + originalAttr];
424
                                        if (attribute1 != null && !DBNull.Value.Equals(attribute1.get_Value()))
425
                                        {
426
                                            loop = true;
427
                                            attribute1.set_Value(DBNull.Value);
428
                                        }
429
                                        index++;
430
                                    }
431
                                }
432
                                else
433
                                {
434
                                    LMAAttribute attribute1 = modelItem1.Attributes[attrName];
435
                                    if (attribute1 != null && !DBNull.Value.Equals(attribute1.get_Value()))
436
                                    {
437
                                        loop = true;
438
                                        attribute1.set_Value(DBNull.Value);
439
                                    }
440
                                }
441
                                modelItem1.Commit();
442
                            }
443
                            if (modelItem2 != null)
444
                            {
445
                                string attrName = array[1];
446
                                if (attrName.Contains("PipingPoint"))
447
                                {
448
                                    string originalAttr = attrName.Split(new char[] { '.' })[1];
449
                                    int index = 1;
450
                                    while (modelItem2.Attributes["PipingPoint" + index + "." + originalAttr] != null)
451
                                    {
452
                                        LMAAttribute attribute2 = modelItem2.Attributes["PipingPoint" + index + "." + originalAttr];
453
                                        if (attribute2 != null && !DBNull.Value.Equals(attribute2.get_Value()))
454
                                        {
455
                                            attribute2.set_Value(DBNull.Value);
456
                                            loop = true;
457
                                        }
458
                                        index++;
459
                                    }
460
                                }
461
                                else
462
                                {
463
                                    LMAAttribute attribute2 = modelItem2.Attributes[attrName];
464
                                    if (attribute2 != null && !DBNull.Value.Equals(attribute2.get_Value()))
465
                                    {
466
                                        attribute2.set_Value(DBNull.Value);
467
                                        loop = true;
468
                                    }
469
                                }
470
                                modelItem2.Commit();
471
                            }
472
                            if (modelItem1 != null)
473
                                ReleaseCOMObjects(modelItem1);
474
                            if (modelItem2 != null)
475
                                ReleaseCOMObjects(modelItem2);
476
                            inconsistency.Commit();
477
                        }
403 478
                    }
479
                    relationship.Commit();
404 480
                }
481
                ReleaseCOMObjects(filter);
482
                ReleaseCOMObjects(criterion);
483
                ReleaseCOMObjects(relationships);
405 484
            }
406 485

  
486
           
487

  
407 488
            //List<string> endClearModelItemID = new List<string>();
408 489
            //for (int i = 0; i < document.LINES.Count; i++)
409 490
            //{
DTI_PID/SPPIDConverter/ConverterDocking.cs
186 186
            else
187 187
                MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
188 188
        }
189

  
189
        bool first = true;
190
        LMDrawing currentDrawing;
190 191
        private void simpleButton1_Click(object sender, EventArgs e)
191 192
        {
192 193
            Placement _placement = new Placement();
193 194
            LMADataSource dataSource = _placement.PIDDataSource;//placement.PIDDataSource;
194
            LMInconsistencies co = new LMInconsistencies();
195
            if (first)
196
            {
197
                LMAFilter filter = new LMAFilter();
198
                LMACriterion criterion = new LMACriterion();
199
                filter.ItemType = "Drawing";
200
                criterion.SourceAttributeName = "Name";
201
                criterion.Operator = "=";
202
                criterion.set_ValueAttribute("20-PID-2011_Page1-97");
203
                filter.get_Criteria().Add(criterion);
195 204

  
196
            LMAFilter filter = new LMAFilter();
197
            LMACriterion criterion = new LMACriterion();
198
            filter.ItemType = "Drawing";
199
            criterion.SourceAttributeName = "Name";
200
            criterion.Operator = "=";
201
            criterion.set_ValueAttribute("11111");
202
            filter.get_Criteria().Add(criterion);
205
                LMDrawings drawings = new LMDrawings();
206
                drawings.Collect(dataSource, Filter: filter);
203 207

  
204
            LMDrawings drawings = new LMDrawings();
205
            drawings.Collect(dataSource, Filter: filter);
208
                currentDrawing = ((dynamic)drawings).Nth(1);
206 209

  
207
            LMDrawing currentDrawing = ((dynamic)drawings).Nth(1);
208 210

  
209
            foreach (LMRelationship relationship in currentDrawing.Relationships)
211
                LMAFilter filter1 = new LMAFilter();
212
                LMACriterion criterion1 = new LMACriterion();
213
                filter1.ItemType = "Relationship";
214
                criterion1.SourceAttributeName = "SP_DRAWINGID";
215
                criterion1.Operator = "=";
216
                criterion1.set_ValueAttribute(currentDrawing.Id);
217
                filter1.get_Criteria().Add(criterion1);
218

  
219
                LMRelationships relationships = new LMRelationships();
220
                relationships.Collect(dataSource, Filter: filter1);
221
                int cc = relationships.Count;
222
            }
223
            else
210 224
            {
211
                foreach (LMInconsistency inconsistency in relationship.Inconsistencies)
225
                //current LMDrawing 가져오기
226
                LMAFilter filter = new LMAFilter();
227
                LMACriterion criterion = new LMACriterion();
228
                filter.ItemType = "Relationship";
229
                criterion.SourceAttributeName = "SP_DRAWINGID";
230
                criterion.Operator = "=";
231
                criterion.set_ValueAttribute(currentDrawing.Id);
232
                filter.get_Criteria().Add(criterion);
233

  
234
                LMRelationships relationships = new LMRelationships();
235
                relationships.Collect(dataSource, Filter: filter);
236

  
237
                foreach (LMRelationship relationship in relationships)
212 238
                {
213
                    if (inconsistency.get_InconsistencyTypeIndex() == 1)
239
                    foreach (LMInconsistency inconsistency in relationship.Inconsistencies)
214 240
                    {
215
                        LMAAttribute attribute1 = ((dynamic)relationship.Item1RepresentationObject).ModelItemObject.Attributes[inconsistency.get_PropNameItem1()];
216
                        LMAAttribute attribute2 = ((dynamic)relationship.Item2RepresentationObject).ModelItemObject.Attributes[inconsistency.get_PropNameItem2()];
217
                        if (!DBNull.Value.Equals(attribute1.get_Value()))
218
                            attribute1.set_Value(DBNull.Value);
219
                        if (!DBNull.Value.Equals(attribute2.get_Value()))
220
                            attribute2.set_Value(DBNull.Value);
221
                        inconsistency.Commit();
241
                        if (inconsistency.get_InconsistencyTypeIndex() == 1)
242
                        {
243
                            LMModelItem modelItem1 = relationship.Item1RepresentationObject == null ? null : relationship.Item1RepresentationObject.ModelItemObject;
244
                            LMModelItem modelItem2 = relationship.Item2RepresentationObject == null ? null : relationship.Item2RepresentationObject.ModelItemObject;
245
                            string[] array = inconsistency.get_Name().ToString().Split(new char[] { '=' });
246
                            if (modelItem1 != null)
247
                            {
248
                                string attrName = array[0];
249
                                if (attrName.Contains("PipingPoint"))
250
                                {
251
                                    string originalAttr = attrName.Split(new char[] { '.' })[1];
252
                                    int index = 1;
253
                                    while (modelItem1.Attributes["PipingPoint" + index + "." + originalAttr] != null)
254
                                    {
255
                                        LMAAttribute attribute1 = modelItem1.Attributes["PipingPoint" + index + "." + originalAttr];
256
                                        if (attribute1 != null && !DBNull.Value.Equals(attribute1.get_Value()))
257
                                        {
258
                                            attribute1.set_Value(DBNull.Value);
259
                                        }
260
                                        modelItem1.Commit();
261
                                        index++;
262
                                    }
263
                                }
264
                                else
265
                                {
266
                                    LMAAttribute attribute1 = modelItem1.Attributes[attrName];
267
                                    if (attribute1 != null && !DBNull.Value.Equals(attribute1.get_Value()))
268
                                    {
269
                                        attribute1.set_Value(DBNull.Value);
270
                                    }
271
                                    modelItem1.Commit();
272
                                }
273
                            }
274
                            if (modelItem2 != null)
275
                            {
276
                                string attrName = array[1];
277
                                if (attrName.Contains("PipingPoint"))
278
                                {
279
                                    string originalAttr = attrName.Split(new char[] { '.' })[1];
280
                                    int index = 1;
281
                                    while (modelItem2.Attributes["PipingPoint" + index + "." + originalAttr] != null)
282
                                    {
283
                                        LMAAttribute attribute2 = modelItem2.Attributes["PipingPoint" + index + "." + originalAttr];
284
                                        if (attribute2 != null && !DBNull.Value.Equals(attribute2.get_Value()))
285
                                        {
286
                                            attribute2.set_Value(DBNull.Value);
287
                                        }
288
                                        modelItem2.Commit();
289
                                        index++;
290
                                    }
291
                                }
292
                                else
293
                                {
294
                                    LMAAttribute attribute2 = modelItem2.Attributes[attrName];
295
                                    if (attribute2 != null && !DBNull.Value.Equals(attribute2.get_Value()))
296
                                    {
297
                                        attribute2.set_Value(DBNull.Value);
298
                                    }
299
                                    modelItem2.Commit();
300
                                }
301
                            }
302
                            if (modelItem1 != null)
303
                                ReleaseCOMObjects(modelItem1);
304
                            if (modelItem2 != null)
305
                                ReleaseCOMObjects(modelItem2);
306
                            inconsistency.Commit();
307
                        }
222 308
                    }
309
                    relationship.Commit();
223 310
                }
224 311
            }
312
            first = false;
313

  
314
            
315

  
316
            //foreach (LMRelationship relationship in currentDrawing.Relationships)
317
            //{
318
            //    foreach (LMInconsistency inconsistency in relationship.Inconsistencies)
319
            //    {
320
            //        if (inconsistency.get_InconsistencyTypeIndex() == 1)
321
            //        {
322
            //            LMAAttribute attribute1 = ((dynamic)relationship.Item1RepresentationObject).ModelItemObject.Attributes[inconsistency.get_PropNameItem1()];
323
            //            LMAAttribute attribute2 = ((dynamic)relationship.Item2RepresentationObject).ModelItemObject.Attributes[inconsistency.get_PropNameItem2()];
324
            //            if (!DBNull.Value.Equals(attribute1.get_Value()))
325
            //                attribute1.set_Value(DBNull.Value);
326
            //            if (!DBNull.Value.Equals(attribute2.get_Value()))
327
            //                attribute2.set_Value(DBNull.Value);
328
            //            inconsistency.Commit();
329
            //        }
330
            //    }
331
            //}
225 332

  
226 333
            //_LMAItem item = _placement.PIDCreateItem(@"\Piping\Routing\Process Lines\Primary Piping.sym");
227 334
            //PlaceRunInputs placeRunInputs = new PlaceRunInputs();

내보내기 Unified diff

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