프로젝트

일반

사용자정보

개정판 d03dde83

IDd03dde83c3d5ecb7b09ee09d2f61894b69f3a78a
상위 87f22597
하위 ab3f2ca0, faba1fc7

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

dev issue #1230 : get attribute info

Change-Id: I3d40f948a4092bcc1ee16f118ec82484aea02a60

차이점 보기:

DTI_PID/APIDConverter/AutoModeling.cs
273 273

  
274 274
                    if (!bAngle)
275 275
                    {
276
                        ObjectId objectId = GetObjectIdByHandle(handle);
276
                        ObjectId objectId = APIDUtils.GetObjectIdByHandle(handle);
277 277
                        if (objectId != ObjectId.Null)
278 278
                        {
279 279
                            SetBlockReferenceRotation(objectId, symbol.ANGLE);
......
365 365
                }
366 366
                if (datas.Count > 0)
367 367
                {
368
                    datas.Add(new Tuple<string, string>("AddLabel", "No"));
369 368
                    ObjectId objectId = GetFirstPolyLineObjectId(line.Aveva.Handle);
370 369
                    if (!objectId.IsNull)
371 370
                        SetAttributeByAvevaForm(objectId.Handle.Value, datas);
......
390 389
                }
391 390
                if (datas.Count > 0)
392 391
                {
393
                    ObjectId objectId = GetObjectIdByHandle(symbol.Aveva.Handle);
392
                    ObjectId objectId = APIDUtils.GetObjectIdByHandle(symbol.Aveva.Handle);
394 393
                    if (!objectId.IsNull)
395 394
                        SetAttributeByAvevaForm(objectId.Handle.Value, datas);
396 395
                }
......
674 673

  
675 674
            return result;
676 675
        }
677
        private ObjectId GetObjectIdByHandle(long lHandle)
678
        {
679
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
680
            Database acCurDb = acDoc.Database;
681
            Handle handle = new Handle(lHandle);
682
            ObjectId result = ObjectId.Null;
683
            try
684
            {
685
                result = acCurDb.GetObjectId(false, handle, 0);
686
            }
687
            catch (System.Exception ex)
688
            {
689

  
690
            }
691
            return result;
692
        }
693
        private Entity GetEntityByHandle(long handle)
694
        {
695
            Entity entity = null;
696
            ObjectId objectId = GetObjectIdByHandle(handle);
697
            if (objectId != ObjectId.Null)
698
            {
699
                Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
700
                Database acCurDb = acDoc.Database;
701
                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
702
                {
703
                    entity = (Entity)acTrans.GetObject(objectId, OpenMode.ForRead);
704
                    acTrans.Commit();
705
                }
706
            }
707

  
708
            return entity;
709
        }
710 676
        private void SetBlockReferenceRotation(ObjectId objectId, double rotation)
711 677
        {
712 678
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
......
732 698
        #region For Aveva
733 699
        private void SetAttributeByAvevaForm(long handle, List<Tuple<string, string>> datas)
734 700
        {
735
            Entity entity = GetEntityByHandle(handle);
701
            Entity entity = APIDUtils.GetEntityByHandle(handle);
736 702

  
737 703
            ComponentPropertiesHelper componentPropertiesHelper = new ComponentPropertiesHelper();
738 704
            AvevaThread.Run(ThreadType.AddProperty, datas);
......
957 923
        }
958 924
        public static void TESTStatic(long handle)
959 925
        {
960
            AutoModeling auto = new AutoModeling(null);
961
            auto.SetAttributeByAvevaForm(handle, new List<Tuple<string, string>>() { new Tuple<string, string>("Size", "100") });
926

  
962 927
        }
963 928
        #endregion
964 929
    }

내보내기 Unified diff

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