public SetTagsInterface(Autodesk.Revit.UI.ExternalEvent exEvent, ExternalEventHandler handler, ModelessForms.Application thisApp) { InitializeComponent(); m_ExEvent = exEvent; m_Handler = handler; ThisApp = thisApp; pathToDataFile = ModelessForms.Properties.Settings.Default.pathToExcel; textBox2.Text = pathToDataFile; }
public SnS(Autodesk.Revit.UI.ExternalEvent exEvent, ExternalEventHandler handler, ModelessForms.Application thisApp) { InitializeComponent(); m_ExEvent = exEvent; m_Handler = handler; ThisApp = thisApp; //Initialize treeview path separator treeView1.PathSeparator = "."; //Log LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration("G:\\Github\\shtirlitsDva\\MyRevitAddins\\MyRevitAddins\\SetTagsModeless\\NLog.config"); //Setup a rudimentary list with categories string[] cats = { "Pipes", "Pipe Fittings", "Pipe Accessories" }; checkedListBox2.Items.Clear(); checkedListBox2.Items.AddRange(cats); Grouping grouping = mySettings.Default.GroupingSettings; if (grouping != null) { Payload.Grouping = grouping; } //Initialize settings for categories if (mySettings.Default.SelectedCategories != null) { SelectedCategories = mySettings.Default.SelectedCategories; if (SelectedCategories.Count != 0) { foreach (string cat in SelectedCategories) { SetItemChecked(cat, checkedListBox2); } } Payload.CategoriesToSearch = SelectedCategories; //Request Revit for parameter information AsyncGatherParameterData asGPD = new AsyncGatherParameterData(Payload); ThisApp.asyncCommand = asGPD; m_ExEvent.Raise(); Payload.GetParameterDataOperationComplete += GetParameterDataOperationComplete; button2.Text = "Loading parameter data..."; } }
public MEPUtilsChooser(Autodesk.Revit.UI.ExternalEvent exEvent, ExternalEventHandler handler, ModelessForms.Application thisApp) { InitializeComponent(); m_ExEvent = exEvent; m_Handler = handler; ThisApp = thisApp; //From here: http://stackoverflow.com/questions/34426888/dynamic-button-creation-placing-them-in-a-predefined-order-using-c-sharp //Edit the number of methods in rowCount here int columnCount = 1; int rowCount = 3; tableLayoutPanel1.ColumnCount = columnCount; tableLayoutPanel1.RowCount = rowCount; tableLayoutPanel1.ColumnStyles.Clear(); tableLayoutPanel1.RowStyles.Clear(); for (int i = 0; i < columnCount; i++) { tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / columnCount)); } for (int i = 0; i < rowCount; i++) { tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100 / rowCount)); } //Place methods to execute in this dict methodDict = new Dictionary <int, Func <UIApplication, Result> > { { 0, InsulationHandler.CreateAllInsulation }, { 1, InsulationHandler.DeleteAllPipeInsulation }, { 2, new InsulationHandler().ExecuteInsulationSettings }, { 3, PipeCreator.CreatePipeFromConnector }, { 4, FlangeCreator.CreateFlangeForElements }, { 5, TotalLineLength.TotalLineLengths }, { 6, MEPUtils.CreateInstrumentation.StartCreatingInstrumentation.StartCreating }, { 7, MEPUtils.SupportTools.SupportToolsMain.CallForm }, { 8, MEPUtils.MoveToDistance.MoveToDistance.Move }, { 9, new MEPUtils.CountWelds.CountWelds().CountWeldsMethod }, { 10, new MEPUtils.NumberStuff.NumberStuff().NumberStuffMethod } }; //Place names for methods in this dict nameDict = new Dictionary <int, string> { { 0, "Create all insulation" }, { 1, "Delete all insulation" }, { 2, "Insulation settings" }, { 3, "Create pipe from connector" }, { 4, "Create flanges" }, { 5, "Total length of lines" }, { 6, "Create Instrument!" }, { 7, "Support Tools" }, { 8, "Move e to distance" }, { 9, "(ctrl) Count welds" }, { 10, "(ctrl) (Re-)Number" } }; for (int i = 0; i < nameDict.Count; i++) { var b = new Button { Text = nameDict[i], Name = string.Format("b_{0}", i) }; b.Click += B_Click; b.Dock = DockStyle.Fill; b.AutoSizeMode = 0; tableLayoutPanel1.Controls.Add(b); } }