/// <summary>
        /// This method is called when there have been failures found at the end of a transaction and Revit is about to start processing them.
        /// </summary>
        /// <param name="failuresAccessor"></param>
        /// <returns></returns>
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            // 在事务结束时,Revit即将处理这些错误之前调用

            IList <FailureMessageAccessor> fmas = failuresAccessor.GetFailureMessages();

            if (fmas.Count == 0)
            {
                return(FailureProcessingResult.Continue);
            }

            String transactionName = failuresAccessor.GetTransactionName();

            // 用事件名称区分是否是要处理的错误信息
            if (transactionName.Equals("Warning_FailurePreproccessor"))
            {
                foreach (FailureMessageAccessor fma in fmas)
                {
                    FailureDefinitionId id = fma.GetFailureDefinitionId();
                    if (id == Command.m_idWarning)
                    {
                        // 删除警告
                        failuresAccessor.DeleteWarning(fma);
                    }
                }

                return(FailureProcessingResult.ProceedWithCommit);
            }
            else if (transactionName.Equals("Warning_FailurePreproccessor_OverlappedWall"))
            {
                foreach (FailureMessageAccessor fma in fmas)
                {
                    FailureDefinitionId id = fma.GetFailureDefinitionId();
                    if (id == BuiltInFailures.OverlapFailures.WallsOverlap)
                    {
                        // 删除错误
                        failuresAccessor.DeleteWarning(fma);
                    }
                }

                return(FailureProcessingResult.ProceedWithCommit);
            }
            else
            {
                // 不做处理
                return(FailureProcessingResult.Continue);
            }
        }
        FailureProcessingResult IFailuresPreprocessor.PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            IList <FailureMessageAccessor> failList = failuresAccessor.GetFailureMessages();

            if (_failureIdList.Count == 0)
            {
                failuresAccessor.DeleteAllWarnings();
                if (deleteErrors)
                {
                    foreach (FailureMessageAccessor accessor in failList)
                    {
                        if (accessor.GetSeverity() == FailureSeverity.Error)
                        {
                            var ids = accessor.GetFailingElementIds();
                            failuresAccessor.DeleteElements((IList <ElementId>)ids.GetEnumerator());
                        }
                    }
                }
            }
            else
            {
                foreach (FailureMessageAccessor failure in failList)
                {
                    FailureDefinitionId failId = failure.GetFailureDefinitionId();
                    if (_failureIdList.Exists(p => p == failId))
                    {
                        failuresAccessor.DeleteWarning(failure);
                    }
                }
            }
            return(FailureProcessingResult.Continue);
        }
Exemple #3
0
        private void Application_FailuresProcessing(object sender, FailuresProcessingEventArgs e)
        {
            FailuresAccessor failuresAccessor = e.GetFailuresAccessor();
            IEnumerable <FailureMessageAccessor> failureMessages =
                failuresAccessor.GetFailureMessages();

            if (failureMessages.Count() == 0)
            {
                // FailureProcessingResult.Continue is to let
                // the failure cycle continue next step.
                e.SetProcessingResult(FailureProcessingResult.Continue);
                return;
            }
            else
            {
                foreach (FailureMessageAccessor failureMessage in failureMessages)
                {
                    if (failureMessage.GetSeverity() == FailureSeverity.Warning)
                    {
                        failuresAccessor.DeleteWarning(failureMessage);
                    }
                    else
                    {
                        failuresAccessor.ResolveFailure(failureMessage);
                    }
                }
            }
            //String transactionName = failuresAccessor.GetTransactionName();
            e.SetProcessingResult(FailureProcessingResult.Continue);
        }
        static private void OnFailuresProcessingEvent(object sender, FailuresProcessingEventArgs e)
        {
            FailuresAccessor failuresAccessor = e.GetFailuresAccessor();
            IList <FailureMessageAccessor> failureMessages = failuresAccessor.GetFailureMessages();

            if (failureMessages.Count == 0)
            {
                return;
            }

            foreach (FailureMessageAccessor failure in failureMessages)
            {
                if (failure.GetSeverity() == FailureSeverity.Error)
                {
                    FailureResolutionType type = FailureResolutionType.Invalid;
                    if (failure.HasResolutions() && GetFailureResolutionType(failuresAccessor, failure, ref type))
                    {
                        failure.SetCurrentResolutionType(type);
                        failuresAccessor.ResolveFailure(failure);
                        e.SetProcessingResult(FailureProcessingResult.ProceedWithCommit);
                    }
                }
                if (failure.GetSeverity() == FailureSeverity.Warning)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
            }
        }
        private void OnFailuresProcessing(object sender, FailuresProcessingEventArgs e)
        {
            FailuresAccessor failuresAccessor = e.GetFailuresAccessor();

            string transactionName = failuresAccessor.GetTransactionName();
            IList <FailureMessageAccessor> fmas = failuresAccessor.GetFailureMessages();

            if (fmas.Count == 0)
            {
                e.SetProcessingResult(FailureProcessingResult.Continue);
                return;
            }
            else
            {
                foreach (FailureMessageAccessor fma in fmas)
                {
                    FailureSeverity severity = fma.GetSeverity();
                    try
                    {
                        if (severity == FailureSeverity.Warning)
                        {
                            failuresAccessor.DeleteWarning(fma);
                            e.SetProcessingResult(FailureProcessingResult.Continue);
                        }
                        else
                        {
                            e.SetProcessingResult(FailureProcessingResult.ProceedWithRollBack);
                        }
                    }
                    catch { }
                }
            }
        }
Exemple #6
0
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            IList <FailureMessageAccessor> failureMessages = failuresAccessor.GetFailureMessages();

            foreach (FailureMessageAccessor failureMessageAccessor in failureMessages)
            {
                FailureDefinitionId id = failureMessageAccessor.GetFailureDefinitionId();
                try {
                    ErrorMessage = failureMessageAccessor.GetDescriptionText();
                }
                catch {
                    ErrorMessage = "Unknown Error";
                }
                try {
                    FailureSeverity failureSeverity = failureMessageAccessor.GetSeverity();
                    ErrorSeverity = failureSeverity.ToString();
                    // delete all of the warning level failures and roll back any others
                    if (failureSeverity == FailureSeverity.Warning)
                    {
                        failuresAccessor.DeleteWarning(failureMessageAccessor);
                    }
                    else
                    {
                        return(FailureProcessingResult.ProceedWithRollBack);
                    }
                }
                catch { }
            }
            return(FailureProcessingResult.Continue);
        }
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            var failureMessages = failuresAccessor.GetFailureMessages();
            var needRollBack    = false;

            foreach (var fma in failureMessages)
            {
                var severity = fma.GetSeverity();
                try
                {
                    var items = fma.GetFailingElementIds().ToList();

                    if (severity == FailureSeverity.Warning)
                    {
                        Log.AppendLog(LogMessageType.WARNING, "Deleted Warning");
                        failuresAccessor.DeleteWarning(fma);
                    }
                    else if (severity == FailureSeverity.Error)
                    {
                        Log.AppendLog(LogMessageType.ERROR, string.Join(",", items));
                        needRollBack = true;
                    }
                }
                catch (Exception ex)
                {
                    Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
                }
            }
            return(needRollBack ? FailureProcessingResult.ProceedWithRollBack : FailureProcessingResult.Continue);
        }
        FailureProcessingResult IFailuresPreprocessor.PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            string transactionName            = failuresAccessor.GetTransactionName();
            IList <FailureMessageAccessor> po = failuresAccessor.GetFailureMessages();

            if (po.Count == 0)
            {
                return(FailureProcessingResult.Continue);
            }
            if (transactionName.Equals("EXEMPLE"))
            {
                foreach (FailureMessageAccessor p1 in po)
                {
                    if (p1.GetSeverity() == FailureSeverity.Error)
                    {
                        failuresAccessor.DeleteAllWarnings();
                        return(FailureProcessingResult.ProceedWithRollBack);
                    }
                    else
                    {
                        failuresAccessor.DeleteWarning(p1);
                    }
                }
            }
            else
            {
                foreach (FailureMessageAccessor p1 in po)
                {
                    failuresAccessor.DeleteAllWarnings();
                }
            }
            return(FailureProcessingResult.Continue);
        }
Exemple #9
0
            public FailureProcessingResult PreprocessFailures(FailuresAccessor a)
            {
                // inside event handler, get all warnings

                IList <FailureMessageAccessor> failures = a.GetFailureMessages();

                foreach (FailureMessageAccessor f in failures)
                {
                    // check failure definition ids
                    // against ones to dismiss:

                    FailureDefinitionId id = f.GetFailureDefinitionId();

                    if (BuiltInFailures.InaccurateFailures.InaccurateLine == id ||
                        BuiltInFailures.OverlapFailures.DuplicateInstances == id ||
                        BuiltInFailures.InaccurateFailures.InaccurateCurveBasedFamily == id ||
                        BuiltInFailures.InaccurateFailures.InaccurateBeamOrBrace == id ||
                        BuiltInFailures.InaccurateFailures.InaccurateLine == id)
                    {
                        a.DeleteWarning(f);
                    }
                    else
                    {
                        a.RollBackPendingTransaction();
                    }
                }
                return(FailureProcessingResult.Continue);
            }
Exemple #10
0
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            foreach (FailureMessageAccessor failure in failuresAccessor.GetFailureMessages())
            {
                FailureDefinitionId defId     = failure.GetFailureDefinitionId();
                FailureDefinitionId nameInUse = BuiltInFailures.GeneralFailures.NameNotUnique;//same detail number

                // Delete any "Can't paste duplicate types.  Only non duplicate types will be pasted." warnings
                if (defId == nameInUse)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
                else if (failure.GetSeverity() == FailureSeverity.Warning)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
            }
            return(FailureProcessingResult.Continue);
        }
Exemple #11
0
            public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
            {
                var failList = failuresAccessor.GetFailureMessages();

                foreach (FailureMessageAccessor failure in failList)
                {
                    failuresAccessor.DeleteWarning(failure);
                }

                return(FailureProcessingResult.Continue);
            }
Exemple #12
0
        /***************************************************/
        /****              Public methods               ****/
        /***************************************************/

        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            IList <FailureMessageAccessor> failureMessageAccessors = failuresAccessor.GetFailureMessages();

            foreach (FailureMessageAccessor failureMessageAccessor in failureMessageAccessors)
            {
                failuresAccessor.DeleteWarning(failureMessageAccessor);
            }

            return(FailureProcessingResult.Continue);
        }
Exemple #13
0
            private void FailureProcessor(object sender, FailuresProcessingEventArgs e)
            {
                FailuresAccessor fas = e.GetFailuresAccessor();

                List <FailureMessageAccessor> fma = fas.GetFailureMessages().ToList();

                foreach (FailureMessageAccessor fa in fma)
                {
                    fas.DeleteWarning(fa);
                }
            }
Exemple #14
0
        public FailureProcessingResult PreprocessFailures(FailuresAccessor accessor)
        {
            var failures = accessor.GetFailureMessages();

            foreach (var failure in failures)
            {
                //var id = failure.GetFailureDefinitionId();
                //if (BuiltInFailures.GeneralFailures.ErrorInFamilyResolved == id)
                accessor.DeleteWarning(failure);
            }
            return(FailureProcessingResult.Continue);
        }
Exemple #15
0
 public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
 {
     foreach (FailureMessageAccessor failure in failuresAccessor.GetFailureMessages())
     {
         FailureDefinitionId failID = failure.GetFailureDefinitionId();
         if (failureDefinitionIdList.Exists(e => e.Guid.ToString() == failID.Guid.ToString()))
         {
             failuresAccessor.DeleteWarning(failure);
         }
     }
     return(FailureProcessingResult.Continue);
 }
Exemple #16
0
        /// <summary>
        /// Implementation of the IFailuresPreprocessor.
        /// </summary>
        /// <param name="failuresAccessor"></param>
        /// <returns></returns>
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            foreach (FailureMessageAccessor failure in failuresAccessor.GetFailureMessages())
            {
                FailureDefinitionId defId      = failure.GetFailureDefinitionId();
                FailureDefinitionId cannotCopy = BuiltInFailures.CopyPasteFailures.CannotCopyDuplicates;

                // Delete any "Can't paste duplicate types.  Only non duplicate types will be pasted." warnings
                if (defId == cannotCopy)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
                else if (failure.GetSeverity() == FailureSeverity.Warning)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
            }

            // Handle any other errors interactively
            return(FailureProcessingResult.Continue);
        }
Exemple #17
0
        private void OnFailuresProcessing(object sender, FailuresProcessingEventArgs e)
        {
            FailuresAccessor failuresAccessor = e.GetFailuresAccessor();
            //string transactionName = failuresAccessor.GetTransactionName();

            IList <FailureMessageAccessor> fmas = failuresAccessor.GetFailureMessages();

            if (fmas.Count > 0)
            {
                List <FailureMessageInfo> failureMessageInfoList = new List <FailureMessageInfo>();
                foreach (FailureMessageAccessor fma in fmas)
                {
                    FailureMessageInfo messageInfo = new FailureMessageInfo();
                    try
                    {
                        messageInfo.ErrorMessage      = fma.GetDescriptionText();
                        messageInfo.ErrorSeverity     = fma.GetSeverity().ToString();
                        messageInfo.FailingElementIds = fma.GetFailingElementIds().ToList();
                    }
                    catch { messageInfo.ErrorMessage = "Unknown Error"; }
                    failureMessageInfoList.Add(messageInfo);

                    //add log message
                    FailureDefinitionId definitionId = fma.GetFailureDefinitionId();
                    Guid defGuid = definitionId.Guid;
                    if (!FailureDefinitionIds.Contains(defGuid))
                    {
                        LogFileManager.AppendLog(messageInfo);
                        FailureDefinitionIds.Add(defGuid);
                    }

                    if (FailureSeverity.Warning == fma.GetSeverity())
                    {
                        failuresAccessor.DeleteWarning(fma);
                    }
                    else if (FailureSeverity.Error == fma.GetSeverity())
                    {
                        e.SetProcessingResult(FailureProcessingResult.ProceedWithRollBack);
                        return;
                    }
                }

                if (failuresAccessor.IsFailureResolutionPermitted())
                {
                    failuresAccessor.ResolveFailures(fmas);
                }

                e.SetProcessingResult(FailureProcessingResult.ProceedWithCommit);
                return;
            }
            e.SetProcessingResult(FailureProcessingResult.Continue);
        }
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            // inside event handler, get all warnings

            IList <FailureMessageAccessor> fmas = failuresAccessor.GetFailureMessages();

            if (fmas.Count == 0)
            {
                return(FailureProcessingResult.Continue);
            }

            foreach (FailureMessageAccessor fma in fmas)
            {
                FailureSeverity s = fma.GetSeverity();
                if (s == FailureSeverity.Warning)
                {
                    failuresAccessor.DeleteWarning(fma);
                }
                else if (s == FailureSeverity.Error)
                {
                    //FailureDefinitionId id = fma.GetFailureDefinitionId();

                    //if (id == BuiltInFailures.JoinElementsFailures.)
                    //{
                    // only default option being choosen,
                    // not good enough!
                    //failuresAccessor.ResolveFailure(fma);
                    //}
                    //return FailureProcessingResult.ProceedWithRollBack;
                }

                /*
                 * switch (s)
                 * {
                 *  // Slightly off axis error gets ignored
                 *  case "Element is slightly off axis and may cause inaccuracies.":
                 *
                 *      break;
                 *
                 *  case "Beam or Brace is slightly off axis and may cause inaccuracies.":
                 *      break;
                 *
                 *  default:
                 *
                 *      //GlobalVariables.WarningList.Add(new WarningEntry(a.GetTransactionName(), f.GetDescriptionText(), f.GetFailingElementIds()));
                 *      break;
                 * }
                 * a.DeleteWarning(f);
                 */
            }
            return(FailureProcessingResult.Continue);
        }
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            IList <FailureMessageAccessor> failList = new List <FailureMessageAccessor>();

            // Inside event handler, get all warnings
            failList = failuresAccessor.GetFailureMessages();
            foreach (FailureMessageAccessor failure in failList)
            {
                failuresAccessor.DeleteWarning(failure);
            }

            return(FailureProcessingResult.Continue);
        }
        /// <summary>
        /// Will dismiss all warnings
        /// </summary>
        private void DismissAllWarnings(object o, FailuresProcessingEventArgs e)
        {
            FailuresAccessor fa = e.GetFailuresAccessor();
            IList <FailureMessageAccessor> failList = fa.GetFailureMessages();

            // Inside event handler, get all warnings
//			warningsNum += failList.Count;
            foreach (FailureMessageAccessor failure in failList)
            {
                fa.DeleteWarning(failure);
                warningsNum += 1;
            }
        }
        public FailureProcessingResult PreprocessFailures(FailuresAccessor a)
        {
            IList <FailureMessageAccessor> failures = a.GetFailureMessages();

            foreach (FailureMessageAccessor f in failures)
            {
                if (f.GetSeverity().ToString() == "Warning")
                {
                    a.DeleteWarning(f);
                }
            }
            return(FailureProcessingResult.Continue);
        }
    public FailureProcessingResult PreprocessFailures(FailuresAccessor a)
    {
        var failures = a.GetFailureMessages();

        foreach (var f in failures)
        {
            var id = f.GetFailureDefinitionId();
            if (BuiltInFailures.GeneralFailures.DuplicateValue == id)
            {
                a.DeleteWarning(f);
            }
        }
        return(FailureProcessingResult.Continue);
    }
Exemple #23
0
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            var failList = failuresAccessor.GetFailureMessages();

            foreach (var item in failList)
            {
                var failureId = item.GetFailureDefinitionId();
                if (failureId == BuiltInFailures.InaccurateFailures.InaccurateBeamOrBrace)
                {
                    failuresAccessor.DeleteWarning(item);
                }
            }
            return(FailureProcessingResult.Continue);
        }
Exemple #24
0
            public FailureProcessingResult PreprocessFailures(FailuresAccessor a)
            {
                var failures = a.GetFailureMessages();

                foreach (var f in failures)
                {
                    var id = f.GetFailureDefinitionId();
                    if (BuiltInFailures.GeneralFailures.DuplicateValue == id)
                    {
                        a.DeleteWarning(f);
                    }

                    if (BuiltInFailures.RoomFailures.RoomsInSameRegionSpaces != id)
                    {
                        continue;
                    }
                    _warnElements = f.GetFailingElementIds();
                    a.DeleteWarning(f);
                    return(FailureProcessingResult.ProceedWithRollBack);
                }

                return(FailureProcessingResult.Continue);
            }
Exemple #25
0
        private static void OnFailuresProcessing(object sender, Autodesk.Revit.DB.Events.FailuresProcessingEventArgs e)
        {
            FailuresAccessor failuresAccessor = e.GetFailuresAccessor();
            IEnumerable <FailureMessageAccessor> failureMessages = failuresAccessor.GetFailureMessages();

            foreach (FailureMessageAccessor failureMessage in failureMessages)
            {
                if (failureMessage.GetSeverity() == FailureSeverity.Warning)
                {
                    failuresAccessor.DeleteWarning(failureMessage);
                }
            }
            e.SetProcessingResult(FailureProcessingResult.Continue);
        }
        public FailureProcessingResult PreprocessFailures(FailuresAccessor fa)
        {
            var failures = fa.GetFailureMessages();

            foreach (var f in failures)
            {
                var failId = f.GetFailureDefinitionId();
                if (failId == BuiltInFailures.OverlapFailures.DuplicateInstances ||
                    failId == BuiltInFailures.GeneralFailures.DuplicateValue)
                {
                    fa.DeleteWarning(f);
                }
            }
            return(FailureProcessingResult.Continue);
        }
Exemple #27
0
        private void TransactionManager_FailuresRaised(FailuresAccessor failuresAccessor)
        {
            IList <FailureMessageAccessor> failList = failuresAccessor.GetFailureMessages();

            IEnumerable <FailureMessageAccessor> query =
                from fail in failList
                where fail.GetSeverity() == FailureSeverity.Warning
                select fail;

            foreach (FailureMessageAccessor fail in query)
            {
                Logger.Log("!! Warning: " + fail.GetDescriptionText());
                failuresAccessor.DeleteWarning(fail);
            }
        }
Exemple #28
0
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            IList <FailureMessageAccessor> FailureList = new List <FailureMessageAccessor>();

            FailureList = failuresAccessor.GetFailureMessages();
            foreach (FailureMessageAccessor failure in FailureList)
            {
                FailureDefinitionId failID = failure.GetFailureDefinitionId();
                if (failID == BuiltInFailures.GroupFailures.AtomViolationWhenOnePlaceInstance)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
            }
            return(FailureProcessingResult.Continue);
        }
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            foreach (FailureMessageAccessor failure in failuresAccessor.GetFailureMessages())
            {
                FailureDefinitionId defId = failure.GetFailureDefinitionId();

                //delete warning "Elevation View Delete"
                if (failure.GetSeverity() == FailureSeverity.Warning)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
            }

            return(FailureProcessingResult.Continue);
        }
Exemple #30
0
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            // Inside event handler, get all warnings
            IList <FailureMessageAccessor> failList = failuresAccessor.GetFailureMessages();

            foreach (FailureMessageAccessor failure in failList)
            {
                // check FailureDefinitionIds against ones that you want to dismiss
                FailureDefinitionId failId = failure.GetFailureDefinitionId();
                // prevent Revit from showing Unenclosed room warnings
                if (failId == BuiltInFailures.OverlapFailures.WallsOverlap)
                {
                    failuresAccessor.DeleteWarning(failure);
                }
            }
            return(FailureProcessingResult.Continue);
        }
Exemple #31
0
        public FailureProcessingResult PreprocessFailures(
          FailuresAccessor a)
        {
            // inside event handler, get all warnings

            IList<FailureMessageAccessor> failures
              = a.GetFailureMessages();

            foreach (FailureMessageAccessor f in failures)
            {
                // check failure definition ids
                // against ones to dismiss:

                FailureDefinitionId id
                  = f.GetFailureDefinitionId();

                //BuiltInFailures.JoinElementsFailures.CannotKeepJoined == id ||
                //    BuiltInFailures.JoinElementsFailures.CannotJoinElementsError == id ||
                //    BuiltInFailures.JoinElementsFailures.CannotJoinElementsStructural == id ||
                //    BuiltInFailures.JoinElementsFailures.CannotJoinElementsStructuralError == id ||
                //    BuiltInFailures.JoinElementsFailures.CannotJoinElementsWarn == id

                if (BuiltInFailures.InaccurateFailures.InaccurateLine == id ||
                    BuiltInFailures.OverlapFailures.DuplicateInstances == id ||
                    BuiltInFailures.InaccurateFailures.InaccurateCurveBasedFamily == id ||
                    BuiltInFailures.InaccurateFailures.InaccurateBeamOrBrace == id
                    )
                {
                    a.DeleteWarning(f);
                }
                //else if(BuiltInFailures.CurveFailures.LineTooShortError == id ||
                //    BuiltInFailures.CurveFailures.LineTooShortWarning == id
                //    )
                //{
                //    a.RollBackPendingTransaction();
                //}
                else
                {
                    a.RollBackPendingTransaction();
                }

            }
            return FailureProcessingResult.Continue;
        }
Exemple #32
0
    public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
    {
        foreach (FailureMessageAccessor failure in failuresAccessor.GetFailureMessages())
                {
                    // Delete any "Can't paste duplicate types.  Only non duplicate types will be pasted." warnings
                    //if (failure.GetFailureDefinitionId() == BuiltInFailures.CopyPasteFailures.CannotCopyDuplicates)
                    if (failure.GetFailureDefinitionId() == BuiltInFailures.CopyPasteFailures.CannotCopyDuplicates)
                    {
                        failuresAccessor.DeleteWarning(failure);
                        //failuresAccessor.GetType();
                    }
                    //List<ElementId> delete = new List<ElementId>();
                    //failuresAccessor.DeleteElements(delete);
                }

                // Handle any other errors interactively
                return FailureProcessingResult.Continue;
    }
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            var failList = failuresAccessor.GetFailureMessages();

            var query = from fail in failList
                        let severity = fail.GetSeverity()
                        where severity == FailureSeverity.Warning
                        select fail;

            foreach (var fail in query)
            {
                DynamoLogger.Instance.Log(
                    "!! Warning: " + fail.GetDescriptionText());
                failuresAccessor.DeleteWarning(fail);
            }

            return FailureProcessingResult.Continue;
        }
        private static void TransactionManager_FailuresRaised(FailuresAccessor failuresAccessor)
        {
            IList<FailureMessageAccessor> failList = failuresAccessor.GetFailureMessages();

            IEnumerable<FailureMessageAccessor> query = 
                from fail in failList
                where fail.GetSeverity() == FailureSeverity.Warning
                select fail;

            foreach (FailureMessageAccessor fail in query)
            {
                dynSettings.DynamoLogger.Log("!! Warning: " + fail.GetDescriptionText());
                failuresAccessor.DeleteWarning(fail);
            }
        }
        FailureProcessingResult PreprocessFailures(
            FailuresAccessor a)
        {
            IList<FailureMessageAccessor> failures
              = a.GetFailureMessages();

              foreach( FailureMessageAccessor f in failures )
              {
            FailureSeverity fseverity = a.GetSeverity();

            if( fseverity == FailureSeverity.Warning )
            {
              a.DeleteWarning( f );
            }
            else
            {
              a.ResolveFailure( f );
              return FailureProcessingResult.ProceedWithCommit;
            }
              }
              return FailureProcessingResult.Continue;
        }
            public FailureProcessingResult PreprocessFailures(
                FailuresAccessor a)
            {
                // inside event handler, get all warnings

                IList<FailureMessageAccessor> failures
                  = a.GetFailureMessages();

                foreach( FailureMessageAccessor f in failures )
                {
                  // check failure definition ids
                  // against ones to dismiss:

                  FailureDefinitionId id
                = f.GetFailureDefinitionId();

                  if( BuiltInFailures.RoomFailures.RoomNotEnclosed
                == id )
                  {
                a.DeleteWarning( f );
                  }
                }
                return FailureProcessingResult.Continue;
            }
Exemple #37
0
        /// <summary>
        /// This method is called when there have been failures found at the end of a transaction and Revit is about to start processing them. 
        /// </summary>
        /// <param name="failuresAccessor">The Interface class that provides access to the failure information. </param>
        /// <returns></returns>
        public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
        {
            IList<FailureMessageAccessor> fmas = failuresAccessor.GetFailureMessages();
            if (fmas.Count == 0)
            {
                return FailureProcessingResult.Continue;
            }

            String transactionName = failuresAccessor.GetTransactionName();
            if (transactionName.Equals("Warning_FailurePreproccessor"))
            {
                foreach (FailureMessageAccessor fma in fmas)
                {
                    FailureDefinitionId id = fma.GetFailureDefinitionId();
                    if (id == Command.m_idWarning)
                    {
                        failuresAccessor.DeleteWarning(fma);
                    }
                }

                return FailureProcessingResult.ProceedWithCommit;
            }
            else if (transactionName.Equals("Warning_FailurePreproccessor_OverlappedWall"))
            {
                foreach (FailureMessageAccessor fma in fmas)
                {
                    FailureDefinitionId id = fma.GetFailureDefinitionId();
                    if (id == BuiltInFailures.OverlapFailures.WallsOverlap)
                    {
                        failuresAccessor.DeleteWarning(fma);
                    }
                }

                return FailureProcessingResult.ProceedWithCommit;
            }
            else
            {
                return FailureProcessingResult.Continue;
            }
        }