public Menu(UtilitySettings utilitySettings, UtilityElements utilityElements, ICollection <ElementId> currentSelectionSet) { InitializeComponent(); this.settings = utilitySettings; this.elements = utilityElements; this.currentSelectionSet = currentSelectionSet; }
// ************************************************************ Constructor ************************************************************ public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) { try { //Create the setting object, add the settings defined below, and try to read any existing .ini file. this.settings = new UtilitySettings(commandData, ref message, elementSet, PROGRAM_NAME, INI_FILE_NAME); if (this.settings.Cancelled) { return(Result.Succeeded); } if (!this.settings.ValidInstallation) { message = "This version of Hummingbird is not compatible with this version of Revit. Program cannot continue."; return(Result.Failed); } // Save the current selection since the process of creating UtilityElements causes it to be lost (apparently whenever you do a transaction?) ICollection <ElementId> currentSelectionSet = this.settings.DocumentUi.Selection.GetElementIds(); // Now create the utility elements this.elements = new UtilityElements(this.settings); InitializeSettings initializeSettings = new InitializeSettings(this.settings); if (!this.settings.ReadIniFile()) { this.settings.ReloadDefaultValues(); } // open the main menu as modal dialog Menu menu = new Menu(this.settings, this.elements, currentSelectionSet); menu.ShowDialog(); // Return control when menu is closed return(Result.Succeeded); } catch (Exception e) { message = e.Message; return(Result.Failed); } }
// 2015 Deprecated //public ExportElements(UtilitySettings utilitySettings, UtilityElements utilityElements, SelElementSet currentSelectionSet) { public ExportElements(UtilitySettings utilitySettings, UtilityElements utilityElements, ICollection <ElementId> currentSelectionSet) { InitializeComponent(); this.settings = utilitySettings; this.elements = utilityElements; this.currentSelectionSet = currentSelectionSet; this.revitTypes = new RevitTypeNames(); this.settings.SetFormControls(this); textBoxPathCsvFolder.Text = textBoxPathCsvFolder.Text.Trim(); if (textBoxPathCsvFolder.Text.EndsWith(@"\")) { textBoxPathCsvFolder.Text = textBoxPathCsvFolder.Text.Substring(0, textBoxPathCsvFolder.Text.Length - 1); } this.pathCsvFolder = textBoxPathCsvFolder.Text; textBoxCsvFileName.Text = textBoxCsvFileName.Text.Trim(); if (!textBoxCsvFileName.Text.ToLower().EndsWith(".csv")) { textBoxCsvFileName.Text = textBoxCsvFileName.Text + ".csv"; } this.csvFileName = textBoxCsvFileName.Text; }