/// <summary> /// Overload method to implement Beacon external command within Revit. /// </summary> /// <param name="commandData"></param> /// <param name="msg"></param> /// <param name="elems"></param> /// <returns></returns> public Result Execute(ExternalCommandData commandData, ref string msg, ElementSet elems) { // Get the environment variables UIApplication uiApp = commandData.Application; Document doc = uiApp.ActiveUIDocument.Document; RevitReader revitReader = new RevitReader(doc); // Create PlotView to load OxyPlot.Wpf assembly before calling wpf, plotView is not specifically used here. PlotView plotView = new PlotView(); // Select Phases and Map Levels SettingUI settingUI = new SettingUI(revitReader); settingUI.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; bool?settingResult = settingUI.ShowDialog(); if (settingResult == true) { revitReader.ReadElements(); MainUI mainUI = new MainUI(revitReader); mainUI.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; mainUI.ShowDialog(); } return(Result.Succeeded); }
/// <summary> /// UI used for pre-export settings. /// </summary> /// <param name="revitReader">Provide RevitReader instance</param> public SettingUI(RevitReader revitReader) { InitializeComponent(); a_RevitReader = revitReader; // Set Icon this.Icon = App.BeaconIcon; PopulateLevels(); SetPreviousState(); }
/// <summary> /// Beacon main UI /// </summary> /// <param name="revitReader">Provide RevitReader instance</param> public MainUI(RevitReader revitReader) { InitializeComponent(); a_RevitReader = revitReader; RatingLeft.Fill = new SolidColorBrush(Colors.White); RatingCenter.Fill = new SolidColorBrush(Colors.White); RatingRight.Fill = new SolidColorBrush(Colors.White); // Set Icon this.Icon = App.BeaconIcon; // Building Types a_buildingTypes = new List <string>() { "Commercial", "Residential", "Education", "Health Care", "Lodging", "Mixed", "Multi-Family", "Office", "Public Assembly", "Other" }; BuildingUseComboBox.ItemsSource = a_buildingTypes; BuildingUseComboBox.SelectedIndex = 0; // Initialize GWP InitializeGwpData(); // Parse Revit Data ParseByCategoryAndLevel(); // Display Plot ColumnSeriesByCategory columnSeriesByCategory = new ColumnSeriesByCategory(a_categoryPlotData); MainPlotView.Model = columnSeriesByCategory.MyModel; // Change to display bar values on hover instead of click. OxyPlot.PlotController customController = new OxyPlot.PlotController(); customController.Bind(new OxyPlot.OxyMouseEnterGesture(), OxyPlot.PlotCommands.HoverSnapTrack); MainPlotView.Controller = customController; CategoryButton.FontWeight = FontWeights.Bold; LevelButton.FontWeight = FontWeights.Regular; a_isCategoryPlot = true; a_isInitialing = false; }