Пример #1
0
        public static List <Revit.Elements.Element> ThreeDViewByRoom(List <Revit.Elements.Room> Rooms, List <String> Names, double Offset = 500)
        {
            var ThreeDViews = new List <Revit.Elements.Element>();
            var doc         = DocumentManager.Instance.CurrentDBDocument;
            var vtype       = new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)).Cast <ViewFamilyType>().FirstOrDefault(a => a.ViewFamily == ViewFamily.ThreeDimensional);

            TransactionManager.Instance.EnsureInTransaction(doc);
            foreach (var elem in Rooms.Zip(Names, Tuple.Create))
            {
                BoundingBoxXYZ bbox       = elem.Item1.InternalElement.get_BoundingBox(doc.ActiveView);
                var            newbbox    = Utility.crop_box(bbox, Offset / 304.8);
                View3D         ThreeDView = View3D.CreateIsometric(doc, vtype.Id);
                ThreeDView.Name = elem.Item2;
                ThreeDView.SetSectionBox(newbbox);
                ThreeDView.CropBoxActive  = true;
                ThreeDView.CropBoxVisible = true;
                ThreeDView.Scale          = 50;
                ThreeDViews.Add(ThreeDView.ToDSType(true));
            }
            TransactionManager.Instance.TransactionTaskDone();

            return(ThreeDViews);
        }