//****************************************************************************************** /// <summary> /// Get data from dialogs /// </summary> public override void OnSetData() { base.OnSetData(); m_ErrorType = 0; if (!FreezeControl.CurrentView) { List <Autodesk.Revit.DB.View> viewList = dlgViewSel.GetSelectedViews(); if (viewList.Count <= 0) { System.SystemBase.Errors.AddError("", "", null); m_ErrorType = 1; } } else { Autodesk.Revit.DB.View v = Revit.CommandData().Application.ActiveUIDocument.Document.ActiveView; if (v.ViewType == Autodesk.Revit.DB.ViewType.Internal || v.ViewType == Autodesk.Revit.DB.ViewType.DrawingSheet || !v.CanBePrinted) { System.SystemBase.Errors.AddError("", "", null); m_ErrorType = 2; } } }
//****************************************************************************************** /// <summary> /// Create sub dialogs /// </summary> public override void OnCreateDialogs() { base.OnCreateDialogs(); m_ExpImpMng = new REXExpImpMng(this); m_RevitData = new REXRevitData(Revit.CommandData()); m_RevitData.Initialize(); m_ErrorType = 0; System.LoadFromFile(false); FreezeControl = new FreezeMainCtr(this); dlgOptions = new DialogOptions(this); dlgExportOptions = new DialogExportOptions(this); dlgViewSel = new DialogViewSel(this); }
//****************************************************************************************** /// <summary> /// Run process calculations and etc. /// </summary> public override void OnRun() { base.OnRun(); List <ViewPath> fileNames = new List <ViewPath>(); Autodesk.Revit.DB.DWGExportOptions dwgOpt = dlgExportOptions.GetExportOptions(dlgOptions.Copy); dwgOpt.FileVersion = dlgOptions.GetVersion(); Autodesk.Revit.DB.DWGImportOptions dwgImpOpt = dlgOptions.GetImportOptions(); dwgImpOpt.Unit = dlgExportOptions.GetExportUnits(dlgOptions.Copy); m_ExpImpMng.Clean(); try //for demo mode { List <Autodesk.Revit.DB.View> viewList; if (FreezeControl.CurrentView) { Autodesk.Revit.DB.View v = Revit.CommandData().Application.ActiveUIDocument.Document.ActiveView; if (!(v.ViewType == Autodesk.Revit.DB.ViewType.Internal || v.ViewType == Autodesk.Revit.DB.ViewType.DrawingSheet || !v.CanBePrinted)) { viewList = new List <Autodesk.Revit.DB.View>(); viewList.Add(Revit.CommandData().Application.ActiveUIDocument.Document.ActiveView); } else { viewList = new List <Autodesk.Revit.DB.View>(); } } else { viewList = dlgViewSel.GetSelectedViews(); } if (viewList.Count > 0) { IREXProgress Progress = System.SystemBase.Tools.Prograss; Progress.Steps = 2 * viewList.Count; Progress.Show(GetForm()); GetForm().Hide(); fileNames = m_ExpImpMng.Export(viewList, dwgOpt, Progress); m_ExpImpMng.Import(dlgOptions.Copy, dlgOptions.Browse, dlgOptions.BaseName, dwgImpOpt, fileNames, Progress); if (dlgOptions.DeleteView) { m_ExpImpMng.DeleteViews(viewList); } Progress.Hide(); global::System.Windows.Forms.MessageBox.Show(GetForm(), Resources.Strings.Texts.FreezingFinSuccesfull, Resources.Strings.Texts.REX_ModuleDescription); } } catch { } m_ExpImpMng.Clean(); DataRef.OptionPath = dlgOptions.Browse; System.SaveToFile(false, false); }