프로젝트

일반

사용자정보

개정판 2d09df82

ID2d09df82f586d8d0b901ef2a86edd4375c732765
상위 73152510
하위 4f91f3d5, 128c844f

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

dev issue #1231 : symbol rotate

Change-Id: Ia191ea61ffcedc08c08b14e3aa5cefabec3bdcbc

차이점 보기:

DTI_PID/APIDConverter/AutoModeling.cs
128 128
        {
129 129
            long handle = InsertSymbol(symbol.Aveva.Name, symbol.Aveva.X, symbol.Aveva.Y);
130 130
            if (handle != 0)
131
            {
131 132
                symbol.Aveva.Handle = handle;
133
                ObjectId objectId = GetObjectIdByHandle(handle);
134
                if (objectId != ObjectId.Null)
135
                {
136
                    SetBlockReferenceRotation(objectId, symbol.ANGLE);
137
                }
138
            }
139
                
132 140
        }
133 141
        #endregion
134 142

  
......
340 348

  
341 349
            return result;
342 350
        }
351
        private ObjectId GetObjectIdByHandle(long lHandle)
352
        {
353
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
354
            Database acCurDb = acDoc.Database;
355
            Handle handle = new Handle(lHandle);
356

  
357
            return acCurDb.GetObjectId(false, handle, 0);
358
        }
359
        private void SetBlockReferenceRotation(ObjectId objectId, double rotation)
360
        {
361

  
362
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
363
            Database acCurDb = acDoc.Database;
364
            Editor acDocEd = acDoc.Editor;
365

  
366
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
367
            {
368
                DBObject objDB = acTrans.GetObject(objectId, OpenMode.ForWrite);
369
                if (objDB != null)
370
                {
371
                    if (objDB.GetType() == typeof(BlockReference))
372
                    {
373
                        BlockReference block = objDB as BlockReference;
374
                        block.Rotation = rotation;
375
                    }
376
                }
377
                acTrans.Commit();
378
            }
379
        }
343 380
        #endregion
344 381

  
345 382
        #region Modeling Utils
......
443 480

  
444 481
            if (connector != null)
445 482
                result = connector.ConnectedObject as Model.Line;
446

  
483
            
447 484
            return result;
448 485
        }
449 486
        #endregion
......
460 497

  
461 498
            //DrawPipe("Sub Pipe", new List<string>() { "50,100", "50,200" });
462 499
        }
463

  
464

  
465 500
        public static void TESTStatic()
466 501
        {
467 502
            AutoModeling auto = new AutoModeling(null);
DTI_PID/APIDConverter/Utils/APIDUtils.cs
67 67
        public static SlopeType CalcSlope(double x1, double y1, double x2, double y2)
68 68
        {
69 69
            if (x1 - x2 == 0)
70
            {
71 70
                return SlopeType.VERTICAL;
72
            }
73 71
            else
74 72
            {
75 73
                double angle = Math.Atan(Math.Abs(y2 - y1) / Math.Abs(x2 - x1)) * 180 / Math.PI;

내보내기 Unified diff

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