示例#1
0
        private Warning(Autodesk.Revit.DB.FailureMessage failure)
        {
            var elementIds = failure.GetFailingElements();

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

            var doc             = DocumentManager.Instance.CurrentDBDocument;
            var warningElements = new List <WarningElement>();

            foreach (var id in elementIds)
            {
                var e = doc.GetElement(id);
                if (e == null)
                {
                    continue;
                }

                var we = new WarningElement {
                    Id = id.IntegerValue
                };
                warningElements.Add(we);
            }

            Elements     = warningElements;
            ErrorMessage = failure.GetDescriptionText();
        }
示例#2
0
        /// <summary>
        /// This method is called by PerformanceAdviser after all elements in document
        /// matching the ElementFilter from GetElementFilter() are checked by ExecuteElementCheck().
        ///
        /// This method checks to see if there are any elements (door instances, in this case) in the
        /// m_FlippedDoor instance member.  If there are, it iterates through that list and displays
        /// the instance name and door tag of each item.
        /// </summary>
        /// <param name="document">The active document</param>
        public void FinalizeCheck(Autodesk.Revit.DB.Document document)
        {
            if (m_FlippedDoors.Count == 0)
            {
                System.Diagnostics.Debug.WriteLine("No doors were flipped.  Test passed.");
            }

            else
            {
                //Pass the element IDs of the flipped doors to the revit failure reporting APIs.
                Autodesk.Revit.DB.FailureMessage fm = new Autodesk.Revit.DB.FailureMessage(m_doorWarningId);
                fm.SetFailingElements(m_FlippedDoors);
                Autodesk.Revit.DB.Transaction failureReportingTransaction = new Autodesk.Revit.DB.Transaction(document, "Failure reporting transaction");
                failureReportingTransaction.Start();
                Autodesk.Revit.DB.PerformanceAdviser.GetPerformanceAdviser().PostWarning(fm);
                failureReportingTransaction.Commit();
                m_FlippedDoors.Clear();
            }
        }
示例#3
0
 internal Warning(Autodesk.Revit.DB.FailureMessage failure)
 {
     InternalWarning = failure;
 }
示例#4
0
        /// <summary>
        /// This method is called by PerformanceAdviser after all elements in document
        /// matching the ElementFilter from GetElementFilter() are checked by ExecuteElementCheck().
        /// 
        /// This method checks to see if there are any elements (door instances, in this case) in the
        /// m_FlippedDoor instance member.  If there are, it iterates through that list and displays
        /// the instance name and door tag of each item.
        /// </summary>
        /// <param name="document">The active document</param>
        public void FinalizeCheck(Autodesk.Revit.DB.Document document)
        {
            if (m_FlippedDoors.Count == 0)
              System.Diagnostics.Debug.WriteLine("No doors were flipped.  Test passed.");

               else
               {
              //Pass the element IDs of the flipped doors to the revit failure reporting APIs.
              Autodesk.Revit.DB.FailureMessage fm = new Autodesk.Revit.DB.FailureMessage(m_doorWarningId);
              fm.SetFailingElements(m_FlippedDoors);
              Autodesk.Revit.DB.Transaction failureReportingTransaction = new Autodesk.Revit.DB.Transaction(document, "Failure reporting transaction");
              failureReportingTransaction.Start();
               document.PostFailure(fm);
              failureReportingTransaction.Commit();
              m_FlippedDoors.Clear();
               }
        }