Failure Processing for multiple failures

sobon.konrad
Advocate
Advocate

Failure Processing for multiple failures

sobon.konrad
Advocate
Advocate

Is there a way to handle multiple failures all in one event handler? 

I was trying this: 

 

public void FailureProcessing(object sender, FailuresProcessingEventArgs e)
        {
            FailuresAccessor failureAccessor = e.GetFailuresAccessor();

            IList<FailureMessageAccessor> fmas = failureAccessor.GetFailureMessages();
            if (fmas.Count == 0)
            {
                e.SetProcessingResult(FailureProcessingResult.Continue);
                return;
            }
            else
            {
                foreach (FailureMessageAccessor fma in fmas)
                {
                    FailureDefinitionId id = fma.GetFailureDefinitionId();
                    if (id == BuiltInFailures.InaccurateFailures.InaccurateAreaLine)
                    {
                        failureAccessor.DeleteWarning(fma);
                    }
                    else if (id == BuiltInFailures.OverlapFailures.AreaBoundaryLinesOverlap)
                    {
                        failureAccessor.DeleteElements(fma.GetFailingElementIds().ToList());
                    }
                    else
                    {
                        continue;
                    }
                }
                e.SetProcessingResult(FailureProcessingResult.ProceedWithCommit);
                return;
            }
        }

 

 

It doesn't seem to work, as my transaction doesn't get commited. Any advice is welcome. 

0 Likes
Reply
523 Views
2 Replies
Replies (2)

Mustafa.Salaheldin
Collaborator
Collaborator

Please provide more information and sample RVT file to reproduce your issue.


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes

jeremytammik
Autodesk
Autodesk

Dear Mustafa,

 

Thank you for your response, which I fully agree with.

 

Dear Konrad,

 

Your code looks OK to me.

 

Could you provide a complete minimal reproducible case for us to pass on to the development team for analysis?

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Thank you!

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes