Message 1 of 6
Revit crash when call Export() function after call C# SaveFileDialog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi everyone,
i meet a strange problem, thus
First, i call Document.Export() function export a view to dwg;
Secong, i call C# Class SaveFileDialog want to select a path,
but when SaveFileDialog.ShowDialog() called, Revit will Crash.
a necessary condition to show this problem is when command begin runing, change window focus to another window, like Windows Exploer.
my code is like this:
public class ExportCmd : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Document doc = commandData.Application.ActiveUIDocument.Document; ICollection<Element> views = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan)).ToElements(); List<ElementId> lstPlanViews = new List<ElementId>(); foreach (Element v in views) { ViewPlan tv = (ViewPlan)v; if (tv.CanBePrinted) { lstPlanViews.Add(tv.Id); break; } } DWGExportOptions m_dwgOptions = new DWGExportOptions { FileVersion = ACADVersion.R2013, }; doc.Export(@"d:/aaa", "Teeee", lstPlanViews, m_dwgOptions); Microsoft.Win32.SaveFileDialog saveDlg = new Microsoft.Win32.SaveFileDialog(); if (saveDlg.ShowDialog() == true) { ; } return Result.Succeeded; } }
This problem is shown in Revit 2015 to Revit 2018.
Did any one meeted this problem?
thx.