
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a command that will open many models, process and close. However the command keeps stalling due to the following message.
Error-cannot be ignored.
Cannot form radial dimenshion.
I can continue to open the file by clisking the button of Delete Dimension(s).
Bug I want the program to handle this error automatically,so I write the following codes.
Autodesk.Revit.ApplicationServices.Application app = commandData.Application.Application;
app.FailuresProcessing += HandleFailures;
public void HandleFailures(object s, Autodesk.Revit.DB.Events.FailuresProcessingEventArgs e)
{
FailuresAccessor failuresAccessor = e.GetFailuresAccessor();
failuresAccessor.DeleteAllWarnings();
var failures = failuresAccessor.GetFailureMessages();//获取所有的失败信息
foreach (var failure in failures)
{
if (failure.GetSeverity() == FailureSeverity.Error)//获得的是失败信息
{
string content = failure.GetDescriptionText();
if (content.Contains("Cannot form radial dimension"))
{
failure.SetCurrentResolutionType(FailureResolutionType.DeleteElements);
failuresAccessor.ResolveFailure(failure);
}
else
{
failuresAccessor.ResolveFailure(failure);
}
}
}
}
When I run the program, it catches the error and debugs normally.
But this window still appears.
What should I do to avoid this window?
Solved! Go to Solution.