Example #1
0
        private void InitViewPlan(Autodesk.Revit.DB.Level level, Autodesk.Revit.DB.ViewFamilyType viewFamilyType)
        {
            // Phase 1 - Check to see if the object exists and should be rebound
            var doc    = DocumentManager.Instance.CurrentDBDocument;
            var oldEle = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.ViewPlan>(doc);

            // Rebind to Element
            if (oldEle != null)
            {
                InternalSetViewPlan(oldEle);
                return;
            }

            // Phase 2 - There was no existing Element, create new one
            TransactionManager.Instance.EnsureInTransaction(doc);

            var view = Autodesk.Revit.DB.ViewPlan.Create(doc, viewFamilyType.Id, level.Id);

            InternalSetViewPlan(view);

            TransactionManager.Instance.TransactionTaskDone();

            ElementBinder.SetElementForTrace(InternalElement);
        }
Example #2
0
 private CeilingPlanViews(Autodesk.Revit.DB.Level level, Autodesk.Revit.DB.ViewFamilyType viewFamilyType)
 {
     SafeInit(() => InitViewPlan(level, viewFamilyType));
 }