示例#1
0
        void RefreshRoom(Handle handle)
        {
            var R = GC.DataSource as List <Room>;

            var A = R.Where(a => a.Handle.Equals(handle));

            if (!A.Any())
            {
                return;
            }

            var r = A.First();

            // Children 제거
            CADUtil.Erases(Utils.Get.ObjectIDs(r.ChildrenH));

            r.Children.Clear();
            r.ChildrenH.Clear();

            var ObjId = new ObjectId();

            AC.DB.TryGetObjectId(handle, out ObjId);

            var acPoly = Utils.Get.GetObject <Polyline>(ObjId);

            if (acPoly == null)
            {
                return;
            }

            r.Area = Math.Round(acPoly.Area / 1000000, 4);

            var cen  = Utils.PointUtil.GetCenterP(acPoly);
            var pos1 = new Point3d(cen.X, cen.Y + 150, cen.Z);
            var pos2 = new Point3d(cen.X, cen.Y - 150, cen.Z);

            // 이름 적기
            r.ChildrenH.Add(CADUtil.CreateText(pos1, 200, r.Name, ColorIndex.Red).Handle);

            // 길이 적기
            var objIds = Utils.DIMUtil.ReCreate(acPoly, DB.DimLayerId, DB.DimStyleId);

            r.ChildrenH.AddRange(Utils.Get.ObjHandles(objIds));

            // 면적 적기
            r.ChildrenH.Add(CADUtil.CreateText(pos2, 200, Math.Round(r.Area, 4).ToString(), ColorIndex.Red).Handle);

            GV.RefreshData();

            DB.ROOM = GC.DataSource as List <Room>;
        }