private void btnOk_Click(object sender, EventArgs e) { // Create the xml file path, based on selected element var fileName = elStructureList.ElementType.FamilyName; var fileName1 = elStructureList.ElementTypeSingleParameters.SingleOrDefault(p => p.ParameterName == "SYMBOL_FAMILY_AND_TYPE_NAMES_PARAM").ParameterValue; fileName1 = Utility.GetStringForFolderName(fileName1); //var assemblyFolder = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); //var TwoUp = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(assemblyFolder)); var folderBaseline = Utility.GetFolderBaseline(); var xmlPath = System.IO.Path.Combine(folderBaseline, "FilteringFiles\\" + fileName1 + ".xml"); string localXmlPath = new Uri(xmlPath).LocalPath; if (System.IO.File.Exists(localXmlPath)) { DialogResult dialogResult = MessageBox.Show("The filtering file for the given element already exist. Do you want to replace it?", "", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { return; } } var revFilterHandler = new RevitFiltersHandler(); var filteredRows = new Dictionary <string, DataGridViewSelectedRowCollection>(); filteredRows.Add("ElementProperties", dgElementParams.SelectedRows); filteredRows.Add("ElementTypeProperties", dgElementTypeParams.SelectedRows); revFilterHandler.createParametersFilterFile(localXmlPath, filteredRows); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { NLogger.Initialize(); NLogger.LogText("Entered Execute method"); ConfigUtilities.LoadConfig(); LanguageHandler.Init(); uiapp = commandData.Application; doc = uiapp.ActiveUIDocument.Document; revElementHandler = new RevitElementsHandler(uiapp); revFilterHandler = new RevitFiltersHandler(); IList <Element> selectedElements = new List <Element>(); try { var win = CheckOpened("Offsite Panel"); if (win != null) { //elementWindow = win; //elementWindow.Show(); //elementWindow.Focus(); win.Close(); } elementWindow = new OffsiteForm(selectedElements, uiapp, RevitElementSelectionMode.FromFilters); elementWindow.Show(); NLogger.LogText("Exit Execute method with Success"); } catch (Exception ex) { NLogger.LogError(ex); NLogger.LogText("Exit Execute method with Error"); } return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { NLogger.Initialize(); NLogger.LogText("Entered Execute method"); ConfigUtilities.LoadConfig(); LanguageHandler.Init(); uiapp = commandData.Application; doc = uiapp.ActiveUIDocument.Document; revElementHandler = new RevitElementsHandler(uiapp); revFilterHandler = new RevitFiltersHandler(); IList <Element> selectedElements = new List <Element>(); // Handle multi-element selection Selection sel = uiapp.ActiveUIDocument.Selection; try { NLogger.LogText("Performing selection in Revit"); var pickedrefs = sel.PickObjects(ObjectType.Element, "Please select an element"); NLogger.LogText("Selection performed in Revit"); foreach (var pickedref in pickedrefs) { selectedElements.Add(doc.GetElement(pickedref)); } // TODO: DETERMINE IF SAME FAMILY OR NOT // Handle selected elements info extraction var elStructureList = revElementHandler.ProcessElements(selectedElements); var filteredElStrList = revFilterHandler.FilterElements(elStructureList); // Extract all Revit Families for selected Revit elements var fileredElStrRevitFamilies = Utility.GetFamilyTypes(filteredElStrList); if (fileredElStrRevitFamilies.Count > 1) { //MessageBox.Show("Selected elements belong to more than one family. They have to be part of a unique family."); MessageBox.Show(LanguageHandler.GetString("msgBox_SelMultipleRevFam")); } else { var win = CheckOpened("Offsite Panel"); if (win != null) { //elementWindow = win; //elementWindow.Show(); //elementWindow.Focus(); win.Close(); } elementWindow = new OffsiteForm(selectedElements, uiapp, RevitElementSelectionMode.FromView); elementWindow.Show(); } NLogger.LogText("Exit Execute method with Success"); } catch (UIRelevantException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { NLogger.LogError(ex); NLogger.LogText("Exit Execute method with Error"); } return(Result.Succeeded); }
public BaseFormHandler() { revitFilterHandler = new RevitFiltersHandler(); }