public static void Update() { if (!IsShowing && messageQueue.Count > 0) { IsShowing = true; currentData = messageQueue.Dequeue(); currentText = currentData.ToString(); } else if (IsShowing && (Input.CheckKeyboardJustPressed(Keys.E) || Input.CheckXboxJustPressed(Buttons.X))) { if (currentData.Callback != null) { currentData.Callback(); } if (messageQueue.Count == 0) { IsShowing = false; } else { currentText = messageQueue.Dequeue().ToString(); } } }
public Result OnStartup(UIControlledApplication application) { RibbonPanel panel = application.CreateRibbonPanel("PipeForRevit"); string assemblyPath = Assembly.GetExecutingAssembly().Location; PushButtonData btnData = new PushButtonData("PipePush", "Pipe-Push", assemblyPath, "PipeForRevit.RevitPipeSender"); PushButton btn = panel.AddItem(btnData) as PushButton; btn.ToolTip = "Push the data through the pipe"; BitmapImage image = new BitmapImage(new Uri(Path.Combine(_baseDir, "PipeArrow.png"))); btn.LargeImage = image; _txtBoxData = new TextBoxData("Pipe Identifier"); _textBox = panel.AddItem(_txtBoxData) as TextBox; _textBox.Width = 100; _textBox.Enabled = true; _textBox.SelectTextOnFocus = true; _textBox.PromptText = "Pipe Identifier"; PushButtonData btnData2 = new PushButtonData("PipePull", "Pipe-Pull", assemblyPath, "PipeForRevit.RevitPipeReceiver"); PushButton btn2 = panel.AddItem(btnData2) as PushButton; btn2.ToolTip = "Pull data from the pipe"; BitmapImage image2 = new BitmapImage(new Uri(Path.Combine(_baseDir, "PipeArrow.png"))); btn2.LargeImage = image2; _converter = new RevitPipeConverter(); //Revit looks for DLLs in the Revit.exe directory, so we need to do this to make it work AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(RevitPipeUtil.MyResolveEventHandler); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { PublicVariables.UpperValue = 10000; PublicVariables.LowerValue = 0; application.CreateRibbonTab("Updater Tool"); string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string dllPath = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020\UpdaterTool.dll"); string appFolderPath = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020"); RibbonPanel ribbonPanel = application.CreateRibbonPanel("Updater Tool", "Updater"); TextBoxData textBoxData1 = new TextBoxData("textBox1"); TextBox textBox1 = ribbonPanel.AddItem(textBoxData1) as TextBox; textBox1.PromptText = "Enter a Reference Value"; textBox1.EnterPressed += TextBoxEnterClicked; ribbonPanel.AddSeparator(); RadioButtonGroupData radioButtonGroupData1 = new RadioButtonGroupData("radioButtonGroup1"); RadioButtonGroup radioButtonGroup1 = ribbonPanel.AddItem(radioButtonGroupData1) as RadioButtonGroup; ToggleButtonData toggleButton1 = new ToggleButtonData("toggleButton1", "Deactivate", dllPath, "UpdaterTool.Deactivated"); BitmapImage img1 = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Stop.png"))); toggleButton1.LargeImage = img1; ToggleButtonData toggleButton2 = new ToggleButtonData("toggleButton2", "Activate", dllPath, "UpdaterTool.Activated"); BitmapImage img2 = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Check.png"))); toggleButton2.LargeImage = img2; radioButtonGroup1.AddItem(toggleButton1); radioButtonGroup1.AddItem(toggleButton2); return(Result.Succeeded); }
public Result ReadAdminField(out IEditFieldData data) { TextBoxData box = new TextBoxData(); string text = HttpContext.Current.Request.Form[fieldName]; box.Text = text ?? ""; data = box; return new Result(); }
private void Start() { titleObj = rootObj.transform.Find("Title").gameObject; contentObj = rootObj.transform.Find("Content").gameObject; btnObj = rootObj.transform.Find("Button").gameObject; DataGatherer data = DataGatherer.Get(); textBox = data.GetTextBox(textIndex); }
public Result ReadAdminField(out IEditFieldData data) { TextBoxData box = new TextBoxData(); string text = HttpContext.Current.Request.Form[fieldName]; box.Text = text ?? ""; data = box; return(new Result()); }
public static void AddMessage(string text, string name = null, Action callback = null) { foreach (string str in text.Split('\n')) { TextBoxData txt = new TextBoxData(name, str, callback); if (!messageQueue.Any(v => { return(v == txt); })) { messageQueue.Enqueue(txt); } } }
public MainWindow() { InitializeComponent(); // Set Datacontext for binding TextBoxData textBox = new TextBoxData(); this.DataContext = textBox; // Disable buttons Bnext.IsEnabled = false; Bprevious.IsEnabled = false; }
/// <summary> /// Add a text field for accepting user input for how many family instances to array on /// the curve. /// </summary> /// <param name="panel">the RibbonPanel where the UI element is added</param> private void AddPartitionsTextField(RibbonPanel panel) { TextBoxData partitionsFieldData = new TextBoxData("curve partitions field"); TextBox partitionsFieldBox = panel.AddItem(partitionsFieldData) as TextBox; //Call method to customize the text box and set it as inactive CustomizeTextBox(panel, partitionsFieldBox, null, "number of partitions:", 0, false, 130); //Call method to customize the text box and set it as active TextBoxData partitionsBoxData = new TextBoxData("curve partitions box"); partitionsBox = panel.AddItem(partitionsBoxData) as TextBox; CustomizeTextBox(panel, partitionsBox, "Define the number of partitions", "" + partitionsVal, partitionsVal, true, 50); }
//进行各种按钮的属性设置 public void AddButtonIteam(ref RibbonPanel ribbon, string buttonType, string tabName, string buttonText, string assemblyName, string className, string largeImageuri, string toolTip, string longDescription) { switch (buttonType) { case "PushButton": PushButtonData pbd = new PushButtonData(tabName, buttonText, assemblyName, className); //tabName可用可不用? SetPushButtonAttribute(ref ribbon, pbd, largeImageuri, toolTip, longDescription); break; case "PulldownButton": PulldownButtonData pdbd = new PulldownButtonData("柱", "柱"); SetPulldownButtonAttribute(ref ribbon, assemblyName, className, pdbd, largeImageuri, toolTip, longDescription); break; case "SplitButton": SplitButtonData sbd = new SplitButtonData("板", "板"); //SetButtonAttribute(pbd, largeImageuri, toolTip, longDescription); break; case "ComboBox": ComboBoxData cbd = new ComboBoxData(""); //SetButtonAttribute(pbd, largeImageuri, toolTip, longDescription); break; case "RadioButtonGroup": RadioButtonGroupData rbgd = new RadioButtonGroupData(""); //SetButtonAttribute(pbd, largeImageuri, toolTip, longDescription); break; case "ToggleButton": ToggleButtonData tbd = new ToggleButtonData("", ""); //SetButtonAttribute(pbd, largeImageuri, toolTip, longDescription); break; case "TextBox": TextBoxData textbd = new TextBoxData(""); //SetButtonAttribute(pbd, largeImageuri, toolTip, longDescription); break; default: break; } }
// Both OnStartup and OnShutdown must be implemented as public method public Result OnStartup(UIControlledApplication application) { // Add a new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel("JONES NICHOLSON"); // Create a push button to trigger a command add it to the ribbon panel. // Adding lining to duct string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; PushButtonData buttonData = new PushButtonData("cmdAddLining", "ADD LINING", thisAssemblyPath, "JonesNicholson.AddLiningToDuct"); PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton; TextBoxData itemData3 = new TextBoxData("itemName3"); Autodesk.Revit.UI.TextBox item3 = ribbonPanel.AddItem(itemData3) as Autodesk.Revit.UI.TextBox; item3.Value = "Option 3"; item3.ToolTip = itemData3.Name; // Can be changed to a more descriptive text. // Optionally, other properties may be assigned to the button // a) tool-tip pushButton.ToolTip = "Will add lining to duct , keeping free area size intact"; // b) large bitmap Uri uriImage = new Uri(@"C:\Users\Alext\OneDrive\Documents\Visual Studio 2013\Projects\Revit API\JonesNicholson\JonesNicholson\bin\Debug\39_globe_72x72.png"); BitmapImage largeImage = new BitmapImage(uriImage); pushButton.LargeImage = largeImage; // Create a push button to trigger a command add it to the ribbon panel. // At this stage this button is for demonstration purposes , no functionality is implemented PushButtonData buttonDataTest = new PushButtonData("cmdRemoveLining", "Remove LINING", thisAssemblyPath, "JonesNicholson.RemoveLiningToDuct"); PushButton pushButtonTest = ribbonPanel.AddItem(buttonDataTest) as PushButton; // Optionally, other properties may be assigned to the button // a) tool-tip pushButton.ToolTip = "Will add lining to duct , keeping free area size intact"; // b) large bitmap pushButtonTest.LargeImage = largeImage; return(Result.Succeeded); }
/// <summary> 添加“当前时间”的文本框 </summary> private TextBoxData AddTextBoxCurrentDate() { TextBoxData currentDate = new TextBoxData("CurrentDate"); // Create a new push button // TextBox textBox = panel.AddItem() as TextBox; // Set Icon currentDate.ToolTip = "当前时间,用来查看开挖情况与显示对应的监测数据。可以精确到分钟,推荐的格式为“ 2016/6/6 13:06 ”。"; // Set Contextual help ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url, "http://www.autodesk.com"); currentDate.SetContextualHelp(contextHelp); // Set Icon currentDate.Image = new BitmapImage(new Uri(Path.Combine(Path_icons, "ViewStage_16.png"))); return(currentDate); }
public Result OnStartup(UIControlledApplication application) { application.CreateRibbonTab("Quyet"); var pannel = application.CreateRibbonPanel("Quyet", "Hello World"); var buttondata = new TextBoxData("button1"); pannel.AddItem(buttondata); var buttondata1 = new PushButtonData("button2", "Hello World", Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "WpfControlLibrary1.dll"), "WpfControlLibrary1.command1"); pannel.AddItem(buttondata1); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication app) { //Addin tab data string RIBBON_PANEL = "Generate fractal tree"; //Add a tab RibbonPanel panel = app.CreateRibbonPanel(RIBBON_PANEL); string assemblyName = Assembly.GetExecutingAssembly().Location; //add button for command trigger PushButtonData buttonData = new PushButtonData( "Generate a fractal tree from a line", RIBBON_PANEL, assemblyName, "FractalTreeGenerator.GenerateFractalTree"); PushButton pushButton = panel.AddItem(buttonData) as PushButton; pushButton.ToolTip = "Click on a line to turn into a fractal tree"; //add text input TextBoxData itemDepth = new TextBoxData("treeDepth"); TextBox item1 = panel.AddItem(itemDepth) as TextBox; item1.Value = 3; item1.ToolTip = "Tree depth (do not use more than 10)"; item1.EnterPressed += Refresh; //refreshes value picked from textbox on enter press void Refresh(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.treeDepth = Convert.ToInt32(item1.Value.ToString()); } catch { } } return(Result.Succeeded); }
/// <summary> /// Text box /// Text box used in conjunction with event. We'll come to this later. /// For now, just shows how to make a text box. /// </summary> public void AddTextBox(RibbonPanel panel) { // Fill the text box information TextBoxData txtBoxData = new TextBoxData("TextBox"); txtBoxData.Image = NewBitmapImage("Basics.ico"); txtBoxData.Name = "Text Box"; txtBoxData.ToolTip = "Enter text here"; txtBoxData.LongDescription = "<p>This is Revit UI Labs.</p><p>Ribbon Lab</p>"; txtBoxData.ToolTipImage = NewBitmapImage("ImgHelloWorld.png"); // Create the text box item on the panel TextBox txtBox = panel.AddItem(txtBoxData) as TextBox; txtBox.PromptText = "Enter a comment"; txtBox.ShowImageAsButton = true; txtBox.EnterPressed += new EventHandler <Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(txtBox_EnterPressed); txtBox.Width = 180; }
internal override RibbonItemData Finish() { var textBoxData = new TextBoxData(name); if (textBoxImage != null) { textBoxData.Image = textBoxImage; } if (textBoxDescription != null) { textBoxData.ToolTip = textBoxDescription; } if (textBoxHelpUrl != null) { textBoxData.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, textBoxHelpUrl)); } return(textBoxData); }
/// <summary> /// Add a Text Box to the Ribbon Panel /// </summary> /// <param name="Panel"></param> /// <param name="textboxName"></param> /// <param name="tooltip"></param> /// <returns></returns> private Boolean AddTextBox(RibbonPanel Panel, string textboxName, string tooltip) { try { TextBoxData tbData = new TextBoxData(textboxName); Autodesk.Revit.UI.TextBox textBox = Panel.AddItem(tbData) as Autodesk.Revit.UI.TextBox; textBox.PromptText = "Write something and hit Enter"; textBox.ShowImageAsButton = true; textBox.ToolTip = tooltip; textBox.EnterPressed += new EventHandler <TextBoxEnterPressedEventArgs>(MyTextBoxEnter); return(true); } catch { return(false); } }
public Result OnStartup(UIControlledApplication uiApp) { try { uiApp.CreateRibbonTab(TabName); } catch {}; RibbonPanel Panel = uiApp.CreateRibbonPanel(TabName, PanelName); TextBoxData tbd = new TextBoxData("Pattern Entry"); ComboBoxData cbd = new ComboBoxData("Pattern Type"); var items = Panel.AddStackedItems(cbd, tbd); var cbox = items[0] as ComboBox; var tbox = items[1] as TextBox; cbox.AddItem(new ComboBoxMemberData("Brick Pattern", "Brick Pattern")); cbox.AddItem(new ComboBoxMemberData("Herringbone Pattern", "Herringbone Pattern")); cbox.AddItem(new ComboBoxMemberData("Basket Pattern", "Basket Pattern")); cbox.AddItem(new ComboBoxMemberData("Plank Pattern", "Plank Pattern")); cbox.AddItem(new ComboBoxMemberData("Custom Pattern", "Custom Pattern")); tbox.Width = 250; tbox.PromptText = "Width, Height, Grout, Steps"; tbox.EnterPressed += EnterPressed; cbox.CurrentChanged += CurrentChanged; return(Result.Succeeded); }
private static void ValidateTableData(TextBoxData data) { data.Align.Should().Be(TextAlignment.TextAlignCenter); data.BackColor.Red.Should().Be(0); data.BackColor.Green.Should().Be(128); data.BackColor.Blue.Should().Be(128); data.Font.Name.Should().Be("BentonSans"); data.Font.Italic.Should().Be(true); data.Font.Size.Should().Be(330000U); data.Font.Weight.Should().Be(700); data.FontColor.Red.Should().Be(230); data.FontColor.Green.Should().Be(132); data.FontColor.Blue.Should().Be(210); data.IntensityScale.Should().Be(0.98f); data.IsDmd.Should().Be(false); data.IsTransparent.Should().Be(false); data.Text.Should().Be("007"); data.V1.X.Should().Be(285); data.V1.Y.Should().Be(290); data.V2.X.Should().Be(285 + 250); data.V2.Y.Should().Be(290 + 70); }
internal new TextBoxData GetButtonData() { TextBoxData txtData = new TextBoxData(_name); if (string.IsNullOrWhiteSpace(_toolTips)) { txtData.ToolTip = _toolTips; } if (string.IsNullOrWhiteSpace(_description)) { txtData.LongDescription = _description; } if (_smallImage != null) { txtData.Image = _smallImage; } if (_toolTipsImage != null) { txtData.ToolTipImage = _toolTipsImage; } return(txtData); }
public override RibbonItemData GetItemData() { TextBoxData tbxData = new TextBoxData(_name); if (string.IsNullOrWhiteSpace(_toolTips)) { tbxData.ToolTip = _toolTips; } if (string.IsNullOrWhiteSpace(_description)) { tbxData.LongDescription = _description; } if (_smallImage != null) { tbxData.Image = _smallImage; } if (_toolTipsImage != null) { tbxData.ToolTipImage = _toolTipsImage; } return(tbxData); }
private static void ValidateTableData(TextBoxData data) { Assert.Equal(TextAlignment.TextAlignCenter, data.Align); Assert.Equal(0, data.BackColor.Red); Assert.Equal(128, data.BackColor.Green); Assert.Equal(128, data.BackColor.Blue); Assert.Equal("BentonSans", data.Font.Name); Assert.Equal(true, data.Font.Italic); Assert.Equal(330000U, data.Font.Size); Assert.Equal(700U, data.Font.Weight); Assert.Equal(230, data.FontColor.Red); Assert.Equal(132, data.FontColor.Green); Assert.Equal(210, data.FontColor.Blue); Assert.Equal(0.98f, data.IntensityScale); Assert.Equal(false, data.IsDmd); Assert.Equal(false, data.IsTransparent); Assert.Equal("007", data.Text); Assert.Equal(285, data.V1.X); Assert.Equal(290, data.V1.Y); Assert.Equal(285 + 250, data.V2.X); Assert.Equal(290 + 70, data.V2.Y); }
/// <summary> /// Adds a group of text fields for accepting user input for the various parameters /// of the sine curve (cycles, period, amplitude). /// </summary> /// <param name="panel">the RibbonPanel where the UI element is added</param> private void AddCurvePropertiesTextFields(RibbonPanel panel) { //Inactive textfields that just display information about the active input fields TextBoxData periodLabelData = new TextBoxData("curve period field"); TextBoxData cyclesLabelData = new TextBoxData("curve cycles field"); TextBoxData amplitudeLabelData = new TextBoxData("curve amplitude field"); //Stack them horizontally IList <RibbonItem> textFieldList = panel.AddStackedItems(periodLabelData, cyclesLabelData, amplitudeLabelData); //Call method to customize the text boxes and make them inactive String periodToolTip = "A double value denoting the period of the curve, i.e. how often the curve goes a full repition around the unit circle."; CustomizeTextBox(panel, (TextBox)textFieldList[0], periodToolTip, "curve period:", 0, false, 130); String cyclesToolTip = "A double value denoting the number of circles the curve makes."; CustomizeTextBox(panel, (TextBox)textFieldList[1], cyclesToolTip, "curve cycles:", 0, false, 130); String amplitudeToolTip = "A double value denoting how far the curve gets away from the x-axis."; CustomizeTextBox(panel, (TextBox)textFieldList[2], amplitudeToolTip, "curve amplitude:", 0, false, 130); //Active text fields for user input TextBoxData periodBoxData = new TextBoxData("curve period"); TextBoxData cyclesBoxData = new TextBoxData("curve cycles"); TextBoxData amplitudeBoxData = new TextBoxData("curve amplitude"); //Stack them horizontally IList <RibbonItem> textBoxList = panel.AddStackedItems(periodBoxData, cyclesBoxData, amplitudeBoxData); periodBox = (TextBox)textBoxList[0]; cyclesBox = (TextBox)textBoxList[1]; amplitudeBox = (TextBox)textBoxList[2]; //Call method to customize the text boxes and make them active CustomizeTextBox(panel, periodBox, "Define the period of the sine curve", "" + periodVal, periodVal, true, 50); CustomizeTextBox(panel, cyclesBox, "Define the number of cycles of the sine curve", "" + cyclesVal, cyclesVal, true, 50); CustomizeTextBox(panel, amplitudeBox, "Define the amplitude of the sine curve", "" + amplitudeVal, amplitudeVal, true, 50); }
public static void CreatePanel(UIControlledApplication uiApp) { RibbonPanel Panel = uiApp.CreateRibbonPanel(CCRibbon.tabName, PName); TextBoxData tbd = new TextBoxData(TBName); TextBox tb = Panel.AddItem(tbd) as TextBox; tb.Width = 350; tb.EnterPressed += EnterPressed; ComboBoxData cbd = new ComboBoxData("Update Type"); ComboBox box = Panel.AddItem(cbd) as ComboBox; box.AddItem(new ComboBoxMemberData("Run Command", "Run Command")); box.AddItem(new ComboBoxMemberData("Masterformat", "Masterformat")); box.AddItem(new ComboBoxMemberData("Occupant Load Factor", "Occupant Load Factor")); box.AddItem(new ComboBoxMemberData("Command Training", "Command Training")); PushButtonData OLFButtonData = new PushButtonData( "Update OLF", "Update OLF", @dllpath, "CC_Plugin.SetOLF"); PushButton PBOccLoadFactor = Panel.AddItem(OLFButtonData) as PushButton; }
/// <summary> /// This method is used to create RibbonSample panel, and add wall related command buttons to it: /// 1. contains a SplitButton for user to create Non-Structural or Structural Wall; /// 2. contains a StackedBotton which is consisted with one PushButton and two Comboboxes, /// PushButon is used to reset all the RibbonItem, Comboboxes are use to select Level and WallShape /// 3. contains a RadioButtonGroup for user to select WallType. /// 4. Adds a Slide-Out Panel to existing panel with following functionalities: /// 5. a text box is added to set mark for new wall, mark is a instance parameter for wall, /// Eg: if user set text as "wall", then Mark for each new wall will be "wall1", "wall2", "wall3".... /// 6. a StackedButton which consisted of a PushButton (delete all the walls) and a PulldownButton (move all the walls in X or Y direction) /// </summary> /// <param name="application">An object that is passed to the external application /// which contains the controlled application.</param> private void CreateRibbonSamplePanel(UIControlledApplication application) { // create a Ribbon panel which contains three stackable buttons and one single push button. string firstPanelName = "Ribbon Sample"; RibbonPanel ribbonSamplePanel = application.CreateRibbonPanel(firstPanelName); #region Create a SplitButton for user to create Non-Structural or Structural Wall SplitButtonData splitButtonData = new SplitButtonData("NewWallSplit", "Create Wall"); SplitButton splitButton = ribbonSamplePanel.AddItem(splitButtonData) as SplitButton; PushButton pushButton = splitButton.AddPushButton(new PushButtonData("WallPush", "Wall", AddInPath, "Revit.SDK.Samples.Ribbon.CS.CreateWall")); pushButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWall.png"), UriKind.Absolute)); pushButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWall-S.png"), UriKind.Absolute)); pushButton.ToolTip = "Creates a partition wall in the building model."; pushButton.ToolTipImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWallTooltip.bmp"), UriKind.Absolute)); pushButton = splitButton.AddPushButton(new PushButtonData("StrWallPush", "Structure Wall", AddInPath, "Revit.SDK.Samples.Ribbon.CS.CreateStructureWall")); pushButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "StrcturalWall.png"), UriKind.Absolute)); pushButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "StrcturalWall-S.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); #region Add a StackedButton which is consisted of one PushButton and two Comboboxes PushButtonData pushButtonData = new PushButtonData("Reset", "Reset", AddInPath, "Revit.SDK.Samples.Ribbon.CS.ResetSetting"); ComboBoxData comboBoxDataLevel = new ComboBoxData("LevelsSelector"); ComboBoxData comboBoxDataShape = new ComboBoxData("WallShapeComboBox"); IList <RibbonItem> ribbonItemsStacked = ribbonSamplePanel.AddStackedItems(pushButtonData, comboBoxDataLevel, comboBoxDataShape); ((PushButton)(ribbonItemsStacked[0])).Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Reset.png"), UriKind.Absolute)); //Add options to WallShapeComboBox Autodesk.Revit.UI.ComboBox comboboxWallShape = (Autodesk.Revit.UI.ComboBox)(ribbonItemsStacked[2]); ComboBoxMemberData comboBoxMemberData = new ComboBoxMemberData("RectangleWall", "RectangleWall"); ComboBoxMember comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "RectangleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("CircleWall", "CircleWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CircleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("TriangleWall", "TriangleWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "TriangleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("SquareWall", "SquareWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "SquareWall.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); #region Add a RadioButtonGroup for user to select WallType RadioButtonGroupData radioButtonGroupData = new RadioButtonGroupData("WallTypeSelector"); RadioButtonGroup radioButtonGroup = (RadioButtonGroup)(ribbonSamplePanel.AddItem(radioButtonGroupData)); ToggleButton toggleButton = radioButtonGroup.AddItem(new ToggleButtonData("Generic8", "Generic - 8\"", AddInPath, "Revit.SDK.Samples.Ribbon.CS.Dummy")); toggleButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Generic8.png"), UriKind.Absolute)); toggleButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Generic8-S.png"), UriKind.Absolute)); toggleButton = radioButtonGroup.AddItem(new ToggleButtonData("ExteriorBrick", "Exterior - Brick", AddInPath, "Revit.SDK.Samples.Ribbon.CS.Dummy")); toggleButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "ExteriorBrick.png"), UriKind.Absolute)); toggleButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "ExteriorBrick-S.png"), UriKind.Absolute)); #endregion //slide-out panel: ribbonSamplePanel.AddSlideOut(); #region add a Text box to set the mark for new wall TextBoxData testBoxData = new TextBoxData("WallMark"); Autodesk.Revit.UI.TextBox textBox = (Autodesk.Revit.UI.TextBox)(ribbonSamplePanel.AddItem(testBoxData)); textBox.Value = "new wall"; //default wall mark textBox.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "WallMark.png"), UriKind.Absolute)); textBox.ToolTip = "Set the mark for new wall"; textBox.ShowImageAsButton = true; textBox.EnterPressed += new EventHandler <Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(SetTextBoxValue); #endregion ribbonSamplePanel.AddSeparator(); #region Create a StackedButton which consisted of a PushButton (delete all the walls) and a PulldownButton (move all the walls in X or Y direction) PushButtonData deleteWallsButtonData = new PushButtonData("deleteWalls", "Delete Walls", AddInPath, "Revit.SDK.Samples.Ribbon.CS.DeleteWalls"); deleteWallsButtonData.ToolTip = "Delete all the walls created by the Create Wall tool."; deleteWallsButtonData.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "DeleteWalls.png"), UriKind.Absolute)); PulldownButtonData moveWallsButtonData = new PulldownButtonData("moveWalls", "Move Walls"); moveWallsButtonData.ToolTip = "Move all the walls in X or Y direction"; moveWallsButtonData.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWalls.png"), UriKind.Absolute)); // create stackable buttons IList <RibbonItem> ribbonItems = ribbonSamplePanel.AddStackedItems(deleteWallsButtonData, moveWallsButtonData); // add two push buttons as sub-items of the moveWalls PulldownButton. PulldownButton moveWallItem = ribbonItems[1] as PulldownButton; PushButton moveX = moveWallItem.AddPushButton(new PushButtonData("XDirection", "X Direction", AddInPath, "Revit.SDK.Samples.Ribbon.CS.XMoveWalls")); moveX.ToolTip = "move all walls 10 feet in X direction."; moveX.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWallsXLarge.png"), UriKind.Absolute)); PushButton moveY = moveWallItem.AddPushButton(new PushButtonData("YDirection", "Y Direction", AddInPath, "Revit.SDK.Samples.Ribbon.CS.YMoveWalls")); moveY.ToolTip = "move all walls 10 feet in Y direction."; moveY.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWallsYLarge.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); application.ControlledApplication.DocumentCreated += new EventHandler <Autodesk.Revit.DB.Events.DocumentCreatedEventArgs>(DocumentCreated); }
public void BeforeEachTest() { Item = new TestData.Item(1, "ItemName"); PropertyMetaData = PropertyMetaDataMocker.CreateStub("Name", false, null, 100, null, 100, Item.ItemId.GetType()); TextBoxData = new TextBoxData("value").WithValidationFrom(PropertyMetaData); }
/// <summary> /// Execute the command when REVIT starts /// </summary> /// <param name="a">Access the control of user interface application</param> /// <returns></returns> public Result OnStartup(UIControlledApplication a) { m_DoorControlForm = null; // no dialog needed yet; the command will bring it m_rotatingForm = null; m_SymbolSelection = null; m_structuralConnectionSelector = null; thisApp = this; // static access to this application instance #region Revit ribbon and tab creation // An instance of push button data model class PushButtonDataModel p = new PushButtonDataModel(); // Get executing assembly for creating button data PushButtonDataModel.GetAssemblyLocation = Assembly.GetExecutingAssembly().Location; // Create Ribbon Tab string tabName = "Selectra Main"; a.CreateRibbonTab(tabName); // Create the ribbon panels RibbonPanel arhcitecturalCommandsPanel = a.CreateRibbonPanel(tabName, "Architectural Commands"); RibbonPanel structuralCommandsPanel = a.CreateRibbonPanel(tabName, "Structural Commads"); TextBoxData textBoxData = new TextBoxData("Cope Distance"); TextBox copeDistanceTextBox = structuralCommandsPanel.AddItem(textBoxData) as TextBox; copeDistanceTextBox.Width /= 3; copeDistanceTextBox.PromptText = "Cope Distance"; copeDistanceTextBox.Value = "0.0"; copeDistanceTextBox.ToolTip = "Sets the cope distance of cutted framing elements"; SplitButtonData splitButtonData = new SplitButtonData("Multi Cope Split", "Multi Cope"); SplitButton splitMultiCope = structuralCommandsPanel.AddItem(splitButtonData) as SplitButton; splitMultiCope.ItemText = "Multiple Cope Options"; SplitButtonData splitDatumButtonData = new SplitButtonData("Datum Util Split", "Datum Utils"); SplitButton splitButtonDatum = arhcitecturalCommandsPanel.AddItem(splitDatumButtonData) as SplitButton; splitButtonDatum.ItemText = "Datum Utils"; #region Create Beam between Columns Button // Populate button data model PushButtonDataModel BeamBtwColButtonData = new PushButtonDataModel() { Label = "CreateBeam\nBetweenColumn", Panel = structuralCommandsPanel, CommandNamespacePath = CreateBeamCommand.GetPath(), Tooltip = "Create Beam between columns from selected beam symbol", IconImageName = p.Icon_Beam, TooltipImageName = p.tooltip_Beam }; // Create Button from provided data PushButton beamButton = Button.Create(BeamBtwColButtonData); #endregion #region Create Structural Connection Button // Populate push button data model PushButtonDataModel createStructuralConnectionData = new PushButtonDataModel() { Label = "Create Structural\nConnection", Panel = structuralCommandsPanel, CommandNamespacePath = CreateStructuralConnectionCommand.GetPath(), Tooltip = "Create Multiple Structural Connection between selected elements", IconImageName = p.Icon_PlateConnection, TooltipImageName = p.tooltip_PlateConnection }; // Create push button from populated button data PushButton createStructuralConnectionButton = Button.Create(createStructuralConnectionData); #endregion #region Rotate Multiple Elements Button // Populate button data model PushButtonDataModel rotateButtonData = new PushButtonDataModel() { Label = "Rotate Multiple\nElements", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = RotateMultiCommand.GetPath(), Tooltip = "Create Beam between columns from selected beam symbol", IconImageName = p.Icon_Rotate, TooltipImageName = p.tooltip_3DRotate }; // Create Button from provided data PushButton rotateButton = Button.Create(rotateButtonData); #endregion #region Door Control Button // Populate button data model PushButtonDataModel doorControlData = new PushButtonDataModel() { Label = "Door Control", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = DoorControlCommand.GetPath(), Tooltip = "Control the door behaviour due to user input", IconImageName = p.Icon_DoorOpening, TooltipImageName = p.tooltip_DoorOpening }; // Create button from provided data PushButton doorControlButton = Button.Create(doorControlData); #endregion #region Multiple Coping Button Data // Populate button data model PushButtonDataModel multiCopeData = new PushButtonDataModel() { Label = "Multiple\nCope", Panel = structuralCommandsPanel, CommandNamespacePath = CopeIntersected.GetPath(), Tooltip = "Cope multiple beams and columns", IconImageName = p.Icon_B, TooltipImageName = p.tooltip_Beam, }; #endregion #region Cope Intersected Beams Button Data // Populate button data model PushButtonDataModel copeIntersectsData = new PushButtonDataModel() { Label = "Cope Intersected Beams", Panel = structuralCommandsPanel, CommandNamespacePath = CopeIntersectedBeams.GetPath(), Tooltip = "Cope the beams that intersects with selected beam", IconImageName = p.Icon_Beam, TooltipImageName = p.tooltip_Beam }; #endregion #region Cope Beam With Intersects Button Data PushButtonDataModel copeSelectedData = new PushButtonDataModel() { Label = "Cope Selected Beam\n with Intersects", Panel = structuralCommandsPanel, CommandNamespacePath = CopeSelectedWIntersects.GetPath(), Tooltip = "Cope selected beam through intersects", IconImageName = p.Icon_B, TooltipImageName = p.tooltip_Beam }; #endregion #region Cope Connected Beams // Populate button data model PushButtonDataModel copeConnectedsData = new PushButtonDataModel() { Label = "Cope connected beams", Panel = structuralCommandsPanel, CommandNamespacePath = CopeConnectedBeams.GetPath(), Tooltip = "Cope the beams that connected to selected element", IconImageName = p.Icon_Beam, TooltipImageName = p.tooltip_Beam, }; #endregion #region Cope Beams Connected To Structural Column Button Data PushButtonDataModel copeConnectedToColumnData = new PushButtonDataModel() { Label = "Cope Beams Connected To Structural Column", Panel = structuralCommandsPanel, CommandNamespacePath = CopeBeamConnectedToStrColumn.GetPath(), Tooltip = "Cope beams connected to structural column", IconImageName = p.Icon_Beam, TooltipImageName = p.tooltip_Beam }; #endregion #region Remove copings Button Data // Populate button data model PushButtonDataModel removeCopeButtonData = new PushButtonDataModel() { Label = "Remove Copings", Panel = structuralCommandsPanel, CommandNamespacePath = RemoveAllCopings.GetPath(), Tooltip = "Remove all copings from selected elements", IconImageName = p.Icon_Beam, TooltipImageName = p.tooltip_DoorOpening }; #endregion #region Override Graphic Settings Button // Populate button data model PushButtonDataModel overrideButtonData = new PushButtonDataModel() { Label = "Override\nGraphics", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = OverrideCommand.GetPath(), Tooltip = "Override graphic settings of selected element", IconImageName = p.Icon_Override, TooltipImageName = p.tooltip_Override }; // Create push button from provided data PushButton overrideButton = Button.Create(overrideButtonData); #endregion #region Create Wall Grid Button Data // Populate the button data model PushButtonDataModel createGridButtonData = new PushButtonDataModel() { Label = "Create Wall\nGrid", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = CreateWallGrid.GetPath(), Tooltip = "Create Grid from wall center line", IconImageName = p.Icon_Grid, TooltipImageName = p.tooltip_Grid }; #endregion #region Plate Param Changer Button // Populate button data mode PushButtonDataModel plateParamData = new PushButtonDataModel() { Label = "Plate Parametre\nController", Panel = structuralCommandsPanel, CommandNamespacePath = SteelElementProperty.GetPath(), Tooltip = "Set the parameter of plates (Volume and Mass)", IconImageName = p.Icon_PlateConnection, TooltipImageName = p.tooltip_PlateConnection }; PushButton plateParamButton = Button.Create(plateParamData); #endregion #region Schema Build Button // Populate button data model PushButtonDataModel schemaBuildButtonData = new PushButtonDataModel() { Label = "Add Data", Panel = structuralCommandsPanel, CommandNamespacePath = AddField.GetPath(), Tooltip = "Add Data to extensible storage", IconImageName = p.Icon_B, TooltipImageName = p.Icon_DoorOpening }; PushButton schemaBuildButton = Button.Create(schemaBuildButtonData); #endregion #region Tag Wall Layers Button PushButtonDataModel tagWallLayerData = new PushButtonDataModel() { Label = "Tag Wall\nLayers", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = TagWallLayers.GetPath(), Tooltip = "Create a textnote element at given point that includes the wall layers information", IconImageName = p.Icon_B, TooltipImageName = p.tooltip_DoorOpening }; PushButton tagWallButton = Button.Create(tagWallLayerData); #endregion #region Create Level Button Data // Populate button data model with given input PushButtonDataModel createLevelData = new PushButtonDataModel() { Label = "Create Multiple\nLevel", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = CreateLevel.GetPath(), Tooltip = "Create Multiple Level with given user input", IconImageName = p.Icon_B, TooltipImageName = p.tooltip_Grid }; #endregion #region Set Elevation Button Data // Populate Button Data model PushButtonDataModel setElevationData = new PushButtonDataModel() { Label = "Set Elevation", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = SetELevation.GetPath(), Tooltip = "Set elevation of level(s) with given input", IconImageName = p.Icon_S, TooltipImageName = p.Icon_S }; #endregion #region Sample Button // Populate button data model PushButtonDataModel sampleData = new PushButtonDataModel() { Label = "SAMPLE", Panel = arhcitecturalCommandsPanel, CommandNamespacePath = Sample.GetPath(), Tooltip = "This is just a sample for test purpose, content change continiously", IconImageName = p.Icon_S, TooltipImageName = p.tooltip_Override }; // Create push button from provided data PushButton sampleButton = Button.Create(sampleData); #endregion // Add push button to multiple cope split button splitMultiCope.AddPushButton(Button.CreateButtonData(multiCopeData)); splitMultiCope.AddPushButton(Button.CreateButtonData(copeIntersectsData)); splitMultiCope.AddPushButton(Button.CreateButtonData(copeSelectedData)); splitMultiCope.AddPushButton(Button.CreateButtonData(copeConnectedToColumnData)); splitMultiCope.AddPushButton(Button.CreateButtonData(removeCopeButtonData)); splitMultiCope.AddPushButton(Button.CreateButtonData(copeConnectedsData)); // Add push button to datum utils split button splitButtonDatum.AddPushButton(Button.CreateButtonData(createLevelData)); splitButtonDatum.AddPushButton(Button.CreateButtonData(setElevationData)); splitButtonDatum.AddPushButton(Button.CreateButtonData(createGridButtonData)); #endregion return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication app) { //Addin tab data string RIBBON_PANEL = "Generate procedural terrain"; //Add a tab RibbonPanel panel = app.CreateRibbonPanel(RIBBON_PANEL); string assemblyName = Assembly.GetExecutingAssembly().Location; //add button for command trigger PushButtonData buttonTerrain = new PushButtonData( "Generate procedural terrain", "Procedural terrain", assemblyName, "TerrainGenerator.TerrainGenerator"); PushButton pushButton1 = panel.AddItem(buttonTerrain) as PushButton; pushButton1.ToolTip = "Click on a closed line to generate terrain"; pushButton1.Image = BmpImageSource("TerrainGenerator.Resources.TerrainGeneratorSmall.bmp"); pushButton1.LargeImage = BmpImageSource("TerrainGenerator.Resources.TerrainGenerator.bmp"); //add text input TextBoxData itemOctaves = new TextBoxData("Octaves"); itemOctaves.Name = "Iterations of noise"; //add text input2 TextBoxData itemAmplitude = new TextBoxData("Amplitude"); itemAmplitude.Name = "Details amplitude"; //add text input3 TextBoxData itemFrequency = new TextBoxData("Speed"); itemFrequency.Name = "Details speed"; //add text input4 TextBoxData itemDensity = new TextBoxData("Density"); itemFrequency.Name = "Mesh grid density"; //add text input5 TextBoxData itemThickness = new TextBoxData("MinThickness"); itemFrequency.Name = "Minimum height of mesh"; //add text input6 TextBoxData itemRandom = new TextBoxData("Predefined or not"); itemFrequency.Name = "Use predefined permutation table or generate"; IList <RibbonItem> stackedItems = panel.AddStackedItems(itemOctaves, itemAmplitude, itemFrequency); if (stackedItems.Count > 1) { TextBox item1 = stackedItems[0] as TextBox; item1.Value = GlobVars.nOctaves; item1.ToolTip = "Number of iterations (try not use more than 7)"; item1.EnterPressed += Refresh; //refreshes value picked from textbox on enter press void Refresh(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.nOctaves = Convert.ToInt32(item1.Value.ToString()); } catch { } } TextBox item2 = stackedItems[1] as TextBox; item2.Value = GlobVars.amplitude; item2.ToolTip = "Noise height"; item2.EnterPressed += Refresh2; //refreshes value picked from textbox on enter press void Refresh2(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.amplitude = Convert.ToDouble(item2.Value.ToString()); } catch { } } TextBox item3 = stackedItems[2] as TextBox; item3.Value = GlobVars.speed; item3.ToolTip = "Noise density"; item3.EnterPressed += Refresh3; //refreshes value picked from textbox on enter press void Refresh3(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.speed = Convert.ToDouble(item3.Value.ToString()); } catch { } } } IList <RibbonItem> stackedItems2 = panel.AddStackedItems(itemDensity, itemRandom); if (stackedItems2.Count > 1) { TextBox item4 = stackedItems2[0] as TextBox; item4.Value = GlobVars.density; item4.ToolTip = "Mesh grid density"; item4.EnterPressed += Refresh3; //refreshes value picked from textbox on enter press void Refresh3(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.density = Convert.ToDouble(item4.Value.ToString()); } catch { } } TextBox item6 = stackedItems2[1] as TextBox; item6.Value = GlobVars.randomvals; item6.ToolTip = "0 for Perlins permutation table, 1 for random"; item6.EnterPressed += Refresh5; //refreshes value picked from textbox on enter press void Refresh5(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.randomvals = Convert.ToInt32(item6.Value.ToString()); } catch { } } } return(Result.Succeeded); }
/// <summary> /// Text box /// Text box used in conjunction with event. We'll come to this later. /// For now, just shows how to make a text box. /// </summary> public void AddTextBox(RibbonPanel panel) { // Fill the text box information TextBoxData txtBoxData = new TextBoxData("TextBox"); txtBoxData.Image = NewBitmapImage("Basics.ico"); txtBoxData.Name = "Text Box"; txtBoxData.ToolTip = "Enter text here"; txtBoxData.LongDescription = "<p>This is Revit UI Labs.</p><p>Ribbon Lab</p>"; txtBoxData.ToolTipImage = NewBitmapImage("ImgHelloWorld.png"); // Create the text box item on the panel TextBox txtBox = panel.AddItem(txtBoxData) as TextBox; txtBox.PromptText = "Enter a comment"; txtBox.ShowImageAsButton = true; txtBox.EnterPressed += new EventHandler<Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(txtBox_EnterPressed); txtBox.Width = 180; }
private static void AssertAreEqual(string textToCompare, TextBoxData textBoxData) { textBoxData.ToString().ShouldBeEqualTo(textToCompare); }
public Result OnStartup(UIControlledApplication a) { UiCtrApp = a; try { // Register event for Syncronization // a.ControlledApplication.DocumentSynchronizingWithCentral += new EventHandler // <Autodesk.Revit.DB.Events.DocumentSynchronizingWithCentralEventArgs>(application_Sync); UiCtrApp.ViewActivated += new EventHandler <Autodesk.Revit.UI.Events.ViewActivatedEventArgs>(getdoc); } catch (Exception) { return(Result.Failed); } a.CreateRibbonTab("Exp. Add-Ins"); RibbonPanel panel_Export = a.CreateRibbonPanel("Exp. Add-Ins", "Export"); panel_ViewSetup = a.CreateRibbonPanel("Exp. Add-Ins", "View Tools"); RibbonPanel panel_Reelevate = a.CreateRibbonPanel("Exp. Add-Ins", "Re-Elevate"); RibbonPanel panel_Annot = a.CreateRibbonPanel("Exp. Add-Ins", "Annotation"); RibbonPanel panel_Managers = a.CreateRibbonPanel("Exp. Add-Ins", "Managers"); RibbonPanel panel_Spec = a.CreateRibbonPanel("Exp. Add-Ins", "Specific"); RibbonPanel panel_Qt = a.CreateRibbonPanel("Exp. Add-Ins", "Quick Tools"); string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; string root = thisAssemblyPath.Remove(thisAssemblyPath.Length - 11); PushButtonData button_DWGExport = new PushButtonData("Button_DWGExport", "Export DWG", root + "DWGExport.dll", "DWGExport.DWGExport"); PushButtonData button_NavisExport = new PushButtonData("button_NavisExport", "Export NWC", root + "DWGExport.dll", "NavisExport.NavisExport"); PushButtonData button_AllExport = new PushButtonData("Button_Navis_DWGExport", "Export All", root + "DWGExport.dll", "ExportAll.ExportAll"); PushButton button_RevPrint = panel_Export.AddItem(new PushButtonData("Button_RevPrint", "Print Revision", root + "DWGExport.dll", "PrintRevision.PrintRevision")) as PushButton; button_DWGExport.ToolTip = "Selected Views/Sheets will be exported to .DWG. Tip: use Manage Save/Load selection for sets."; button_NavisExport.ToolTip = "Views with 'Export' as Title on Sheet will be exported to .NWC"; button_AllExport.ToolTip = "Views with 'Export' as Title on Sheet will be exported to .DWG and .NWC"; button_RevPrint.ToolTip = "Select and Print a certain Revision using the current print settings."; PushButtonData button_ShiftViewRange_Top_Up = new PushButtonData("Button_ShiftViewRange_Top_Up", "T+", root + "SetViewRange.dll", "SetViewRange.Shift_TU"); PushButtonData button_ShiftViewRange_Top_Down = new PushButtonData("Button_ShiftViewRange_Top_Down", "T-", root + "SetViewRange.dll", "SetViewRange.Shift_TD"); PushButtonData button_ShiftViewRange_Bottom_Up = new PushButtonData("Button_ShiftViewRange_Bottom_Up", "B+", root + "SetViewRange.dll", "SetViewRange.Shift_BU"); PushButtonData button_ShiftViewRange_Bottom_Down = new PushButtonData("Button_ShiftViewRange_Bottom_Down", "B-", root + "SetViewRange.dll", "SetViewRange.Shift_BD"); PushButtonData button_SetViewRange = new PushButtonData("Button_SetViewRange", "Set View Range per 3D", root + "SetViewRange.dll", "SetViewRange.SetPer3D"); button_ShiftViewRange_Top_Up.ToolTip = "Shifts Top of View Range by set value - Up."; button_ShiftViewRange_Top_Down.ToolTip = "Shifts Top of View Range by set value - Down."; button_ShiftViewRange_Bottom_Up.ToolTip = "Shifts Bottom of View Range by set value - Up."; button_ShiftViewRange_Bottom_Down.ToolTip = "Shifts Bottom of View Range by set value - Down."; button_SetViewRange.ToolTip = "Sets View Range of active Plan View to Top and Bottom planes of the Section Box used on identically named 3d View."; PushButtonData button_TL = new PushButtonData("ToggleLink", "Toggle Links", root + "MultiDWG.dll", "MultiDWG.ToggleLink"); PushButtonData button_TPC = new PushButtonData("TogglePC", "Toggle PCs", root + "MultiDWG.dll", "MultiDWG.TogglePC"); button_TL.ToolTip = "Toggles visibility of all Links in the active view"; button_TPC.ToolTip = "Toggles visibility of all Point Clouds in the active view"; PushButton button_RehostElements = panel_Reelevate.AddItem(new PushButtonData("Button_RehostElements", "Rehost Elements", root + "Rehost Elements.dll", "RehostElements.RehostElements")) as PushButton; PushButtonData button_AlignToBottom = new PushButtonData("Button_AlignToBottom", "MEP to Bottom", root + "AlignToBottom.dll", "AlignToBottom.AlignToBottom"); PushButtonData button_AlignToTop = new PushButtonData("Button_AlignToTop", "MEP to Top", root + "AlignToBottom.dll", "AlignToBottom.AlignToTop"); button_RehostElements.ToolTip = "Sets the Reference Level of selected elements to the active Plan View's Associated Level"; button_AlignToBottom.ToolTip = "Aligns Bottom of MEP elements to the bottom of selected MEP element"; button_AlignToTop.ToolTip = "Aligns Top of MEP elements to the top of selected MEP element"; PushButtonData button_MultiDWG = new PushButtonData("Button_MultiDWG", "MultiDWG", root + "MultiDWG.dll", "MultiDWG.MultiDWG"); PushButtonData button_DuctSurfaceArea = new PushButtonData("Button_DSA", "Duct F. Unfolded", root + "MultiDWG.dll", "MultiDWG.DuctSurfaceArea"); PushButtonData button_ConduitAngle = new PushButtonData("Button_CA", "Conduit Angles", root + "MultiDWG.dll", "MultiDWG.ConduitAngle"); button_MultiDWG.ToolTip = "Specific: Loads all .DWG-s from selected folder. Sets LOD according to filename, temporarily hides medium and high LOD-s."; button_DuctSurfaceArea.ToolTip = "Specific: Inserts total surface area without connections into \"Duct Surface Area\" Project Parameter."; button_ConduitAngle.ToolTip = "Specific: Sums the angles of selected Conduit turns"; panel_Spec.AddStackedItems(button_MultiDWG, button_DuctSurfaceArea, button_ConduitAngle); PushButtonData toggle_Insulation = new PushButtonData("Toggle_Insulation", "Align to INS", root + "AlignToBottom.dll", "Toggle.Toggle"); toggle_Insulation.ToolTip = "Aligns to Insulation surfaces, when present"; PushButtonData button_Qv1 = new PushButtonData("Qv1", "1", root + "SetViewRange.dll", "QuickViews.QuickView1"); PushButtonData button_Qv2 = new PushButtonData("Qv2", "2", root + "SetViewRange.dll", "QuickViews.QuickView2"); PushButtonData button_Qv3 = new PushButtonData("Qv3", "3", root + "SetViewRange.dll", "QuickViews.QuickView3"); PushButtonData button_Qv4 = new PushButtonData("Qv4", "4", root + "SetViewRange.dll", "QuickViews.QuickView4"); PushButtonData button_Qv5 = new PushButtonData("Qv5", "5", root + "SetViewRange.dll", "QuickViews.QuickView5"); PushButtonData button_Qv6 = new PushButtonData("Qv6", "6", root + "SetViewRange.dll", "QuickViews.QuickView6"); button_Qv1.ToolTip = "Switch View to 'QuickView 1'"; button_Qv2.ToolTip = "Switch View to 'QuickView 2'"; button_Qv3.ToolTip = "Switch View to 'QuickView 3'"; button_Qv4.ToolTip = "Switch View to 'QuickView 4'"; button_Qv5.ToolTip = "Switch View to 'QuickView 5'"; button_Qv6.ToolTip = "Switch View to 'QuickView 6'"; panel_ViewSetup.AddStackedItems(button_Qv1, button_Qv2, button_Qv3); panel_ViewSetup.AddStackedItems(button_Qv4, button_Qv5, button_Qv6); PushButton button_SetupQV = panel_ViewSetup.AddItem(new PushButtonData("Button_SetupQV", "Options", root + "SetViewRange.dll", "QuickViews.QuickViews")) as PushButton; PushButtonData button_Dim2Grid = new PushButtonData("Dimtogrid", "RackDim", root + "AnnoTools.dll", "AnnoTools.RackDim"); PushButtonData button_Rack = new PushButtonData("Rack", "Rack", root + "AnnoTools.dll", "AnnoTools.Rack"); PushButtonData button_Lin = new PushButtonData("Lin", "Linear", root + "AnnoTools.dll", "AnnoTools.LinearAnnotation"); string versioned = "AnnoTools"; if (a.ControlledApplication.VersionName.Contains("2017")) { versioned = "Exp_apps_R17"; } PushButtonData button_MTag = new PushButtonData("MTag", "MultiTag", root + versioned + ".dll", versioned + ".MultiTag"); PushButtonData button_ManageRefs = new PushButtonData("Button_ManageRefs", "Mng. Ref.Planes", root + "MultiDWG.dll", "MultiDWG.ManageRefPlanes"); PushButtonData button_ManageRevs = new PushButtonData("Button_ManageRevs", "Mng. Revisions", root + "Revision_Editor.dll", "Revision_Editor.Revision_Editor"); button_SetupQV.ToolTip = "Set quick access to views and more."; button_Dim2Grid.ToolTip = "Create Dimension referring the selected element's centerlines and Grids."; button_Rack.ToolTip = "Create tag for Conduit Rack, listing conduits: left to right \\ top to bottom"; button_Lin.ToolTip = "Create Dimension for objects with more distance in-between"; button_MTag.ToolTip = "Create Tags by Category for multiple selected elements at once"; button_ManageRefs.ToolTip = "Create Reference Planes from at the origins of 3 selected items, or Delete Ref.Planes"; button_ManageRevs.ToolTip = "Manage Revisions"; TextBoxData leftSpaceData = new TextBoxData("A"); TextBoxData rightSpaceData = new TextBoxData("B"); TextBoxData firstYData = new TextBoxData("C"); TextBoxData stepYData = new TextBoxData("1"); TextBoxData splitPointData = new TextBoxData("2"); TextBoxData placementData = new TextBoxData("3"); panel_Annot.AddStackedItems(leftSpaceData, rightSpaceData, firstYData); panel_Annot.AddStackedItems(stepYData, splitPointData, placementData); foreach (RibbonItem item in panel_Annot.GetItems()) { SetTextBox(item, "A", ":A:", "Distance of TextBoxes on Left", 60); SetTextBox(item, "B", ":B:", "Distance of TextBoxes on Right", 60); SetTextBox(item, "C", ":C:", "Height offset of TextBoxes", 60); SetTextBox(item, "1", ":1:", "Gap between TextBoxes", 60); SetTextBox(item, "2", ":2:", "Controls directional switch, and linebreaks of TextBoxes", 60); SetTextBox(item, "3", ":3:", "Placement of annotation along the reference line", 60); } PulldownButtonData QtData = new PulldownButtonData("Quicktools", "QuickTools"); PulldownButton QtButtonGroup = panel_Qt.AddItem(QtData) as PulldownButton; PushButtonData qt1 = new PushButtonData("Filter Verticals", "Filter Vert", root + "MultiDWG.dll", "MultiDWG.FindVert"); PushButtonData qt2 = new PushButtonData("Filter Round Hosted", "Filter Round Hosted", root + "AnnoTools.dll", "AnnoTools.CheckTag"); PushButtonData qt3 = new PushButtonData("Align Identicals", "Align Identicals", root + "AnnoTools.dll", "AnnoTools.Cleansheet"); PushButtonData qt4 = new PushButtonData("Replace in Parameter", "Replace in Parameter", root + "MultiDWG.dll", "MultiDWG.ReplaceInParam"); PushButtonData qt5 = new PushButtonData("Duplicate Sheets", "Duplicate Sheets", root + "MultiDWG.dll", "MultiDWG.DuplicateSheets"); qt1.ToolTip = "Filters Vertical elements from selection " + Environment.NewLine + ":1: controls vertical sensitivity"; qt2.ToolTip = "Filter the selected tags that are hosted to Round duct " + Environment.NewLine + ":3: Type for 'Rectangular' filter"; qt3.ToolTip = "Merges selected tags with same content." + Environment.NewLine + ":A: and :B: controls sensitivity"; qt4.ToolTip = "Replaces text in parameter of selection." + Environment.NewLine + ":A: - Parameter name" + Environment.NewLine + ":B: - Original" + Environment.NewLine + ":C: - Replace"; qt5.ToolTip = "Duplicates the selected sheets." + Environment.NewLine + ":A: - Suffix - Sheet Number" + Environment.NewLine + ":B: - Suffix - Sheet Name" + Environment.NewLine + ":C: - Type for Dependent view duplicates"; string IconsPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Icons\\"); string[] files = Directory.GetFiles(IconsPath); string im_dwg = IconsPath + "Button_DWGExport.png"; string im_nwc = IconsPath + "Button_NavisExport.png"; string im_all = IconsPath + "Button_AllExport.png"; string im_reh = IconsPath + "Button_RehostElements.png"; string im_tup = IconsPath + "Button_T_UP.png"; string im_tdn = IconsPath + "Button_T_DN.png"; string im_bup = IconsPath + "Button_B_UP.png"; string im_bdn = IconsPath + "Button_B_DN.png"; string im_ins = IconsPath + "Button_Ins.png"; string im_pre = IconsPath + "Button_PrintRev.png"; string im_pre_sm = IconsPath + "Button_PrintRev_sm.png"; string im_rak = IconsPath + "Button_Rack.png"; string im_d2g_sm = IconsPath + "Button_Dim2Grid_sm.png"; string im_ref = IconsPath + "Button_Ref.png"; string im_lin_sm = IconsPath + "Button_Lin_sm.png"; string im_mtag = IconsPath + "Button_MTag.png"; string im_tl_sm = IconsPath + "Button_TL_sm.png"; string im_tpc_sm = IconsPath + "Button_TPC_sm.png"; string im_qt1 = IconsPath + "Button_qt1.png"; string im_qt2 = IconsPath + "Button_qt2.png"; string im_qt3 = IconsPath + "Button_qt3.png"; string im_qt4 = IconsPath + "Button_qt4.png"; string im_qt5 = IconsPath + "Button_qt5.png"; string im_rev = IconsPath + "Button_Rev.png"; button_DWGExport.Image = SetImage(im_dwg); button_NavisExport.Image = SetImage(im_nwc); button_AllExport.Image = SetImage(im_all); button_ShiftViewRange_Top_Up.Image = SetImage(im_tup); button_ShiftViewRange_Top_Down.Image = SetImage(im_tdn); button_ShiftViewRange_Bottom_Up.Image = SetImage(im_bup); button_ShiftViewRange_Bottom_Down.Image = SetImage(im_bdn); button_RehostElements.Image = SetImage(im_reh); button_RehostElements.LargeImage = SetImage(im_reh); toggle_Insulation.Image = SetImage(im_ins); button_RevPrint.LargeImage = SetImage(im_pre); button_RevPrint.Image = SetImage(im_pre_sm); button_Rack.Image = SetImage(im_rak); button_Dim2Grid.Image = SetImage(im_d2g_sm); button_Lin.Image = SetImage(im_lin_sm); button_MTag.LargeImage = SetImage(im_mtag); button_ManageRefs.LargeImage = SetImage(im_ref); button_ManageRefs.Image = SetImage(im_ref); button_ManageRevs.LargeImage = SetImage(im_rev); button_ManageRevs.Image = SetImage(im_rev); button_TL.Image = SetImage(im_tl_sm); button_TPC.Image = SetImage(im_tpc_sm); qt1.LargeImage = SetImage(im_qt1); qt2.LargeImage = SetImage(im_qt2); qt3.LargeImage = SetImage(im_qt3); qt4.LargeImage = SetImage(im_qt4); qt5.LargeImage = SetImage(im_qt5); QtButtonGroup.AddPushButton(qt1); QtButtonGroup.AddPushButton(qt2); QtButtonGroup.AddPushButton(qt3); QtButtonGroup.AddPushButton(qt4); QtButtonGroup.AddPushButton(qt5); ComboBoxData ShiftRange = new ComboBoxData("ShiftRange"); panel_ViewSetup.AddStackedItems(button_ShiftViewRange_Bottom_Up, button_ShiftViewRange_Bottom_Down); panel_ViewSetup.AddStackedItems(button_ShiftViewRange_Top_Up, button_ShiftViewRange_Top_Down); panel_ViewSetup.AddStackedItems(button_TL, button_TPC); panel_Export.AddStackedItems(button_DWGExport, button_NavisExport, button_AllExport); panel_ViewSetup.AddStackedItems(button_SetViewRange, ShiftRange); panel_Reelevate.AddStackedItems(button_AlignToTop, button_AlignToBottom, toggle_Insulation); panel_Managers.AddItem(button_ManageRefs); panel_Managers.AddItem(button_ManageRevs); panel_Annot.AddStackedItems(button_Dim2Grid, button_Lin, button_Rack); panel_Annot.AddItem(button_MTag); a.ApplicationClosing += a_ApplicationClosing; //Set Application to Idling a.Idling += a_Idling; return(Result.Succeeded); }
private void AddStackedButtons(RibbonPanel panel) { ComboBoxData cbData = new ComboBoxData("comboBox"); TextBoxData textData = new TextBoxData("Text Box"); textData.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\39-Globe_16x16.png")); textData.Name = "Text Box"; textData.ToolTip = "Enter some text here"; textData.LongDescription = "This is text that will appear next to the image" + "when the user hovers the mouse over the control"; textData.ToolTipImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\39-Globe_32x32.png")); IList <RibbonItem> stackedItems = panel.AddStackedItems(textData, cbData); if (stackedItems.Count > 1) { TextBox tBox = stackedItems[0] as TextBox; if (tBox != null) { tBox.PromptText = "Enter a comment"; tBox.ShowImageAsButton = true; tBox.ToolTip = "Enter some text"; // Register event handler ProcessText tBox.EnterPressed += new EventHandler <Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(ProcessText); } ComboBox cBox = stackedItems[1] as ComboBox; if (cBox != null) { cBox.ItemText = "ComboBox"; cBox.ToolTip = "Select an Option"; cBox.LongDescription = "Select a number or letter"; ComboBoxMemberData cboxMemDataA = new ComboBoxMemberData("A", "Option A"); cboxMemDataA.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\A.bmp")); cboxMemDataA.GroupName = "Letters"; cBox.AddItem(cboxMemDataA); ComboBoxMemberData cboxMemDataB = new ComboBoxMemberData("B", "Option B"); cboxMemDataB.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\B.bmp")); cboxMemDataB.GroupName = "Letters"; cBox.AddItem(cboxMemDataB); ComboBoxMemberData cboxMemData = new ComboBoxMemberData("One", "Option 1"); cboxMemData.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\One.bmp")); cboxMemData.GroupName = "Numbers"; cBox.AddItem(cboxMemData); ComboBoxMemberData cboxMemData2 = new ComboBoxMemberData("Two", "Option 2"); cboxMemData2.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Two.bmp")); cboxMemData2.GroupName = "Numbers"; cBox.AddItem(cboxMemData2); ComboBoxMemberData cboxMemData3 = new ComboBoxMemberData("Three", "Option 3"); cboxMemData3.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Three.bmp")); cboxMemData3.GroupName = "Numbers"; cBox.AddItem(cboxMemData3); } } }
public Result OnStartup(UIControlledApplication app) { //Addin tab data string RIBBON_PANEL = "Generate fractal tree"; //Add a tab RibbonPanel panel = app.CreateRibbonPanel(RIBBON_PANEL); string assemblyName = Assembly.GetExecutingAssembly().Location; //add button for command trigger PushButtonData buttonTree = new PushButtonData( "Generate a fractal tree from a line", "Regular Tree", assemblyName, "FractalTreeGenerator.GenerateFractalTree"); PushButtonData buttonChristmasTree = new PushButtonData( "Generate a fractal christmas tree from a line", "Christmas Tree", assemblyName, "FractalTreeGenerator.GenerateFractalChristmasTree"); PushButton pushButton1 = panel.AddItem(buttonTree) as PushButton; pushButton1.ToolTip = "Click on a line to turn into a fractal tree"; pushButton1.LargeImage = BmpImageSource("FractalTreeGenerator.Resources.TreeRegular.bmp"); PushButton pushButton2 = panel.AddItem(buttonChristmasTree) as PushButton; pushButton2.ToolTip = "Click on a line to turn into a christmas fractal tree"; pushButton2.LargeImage = BmpImageSource("FractalTreeGenerator.Resources.ChristmasTree.bmp"); //add text input TextBoxData itemDepth = new TextBoxData("treeDepth"); itemDepth.Name = "Tree depth"; //add text input2 TextBoxData itemAngle = new TextBoxData("treeAngle"); itemAngle.Name = "Branches rotation angle"; //add text input3 TextBoxData itemRnd = new TextBoxData("treeRandomness"); itemRnd.Name = "Randomness cooficient"; IList <RibbonItem> stackedItems = panel.AddStackedItems(itemAngle, itemDepth, itemRnd); if (stackedItems.Count > 1) { TextBox item2 = stackedItems[0] as TextBox; item2.Value = GlobVars.rotAngle; item2.ToolTip = "Branches rotation angle"; item2.EnterPressed += Refresh2; //refreshes value picked from textbox on enter press void Refresh2(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.rotAngle = Convert.ToInt32(item2.Value.ToString()); } catch { } } TextBox item1 = stackedItems[1] as TextBox; item1.Value = GlobVars.treeDepth; item1.ToolTip = "Tree depth (do not use more than 10)"; item1.EnterPressed += Refresh; //refreshes value picked from textbox on enter press void Refresh(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; GlobVars.treeDepth = Convert.ToInt32(item1.Value.ToString()); } catch { } } TextBox item3 = stackedItems[2] as TextBox; item3.Value = GlobVars.rndCoof * 100; item3.ToolTip = "Randomness coof, should be between 0 and 50, if more or less will be pinned at 15"; item3.EnterPressed += Refresh3; //refreshes value picked from textbox on enter press void Refresh3(object sender, TextBoxEnterPressedEventArgs args) { try { TextBox textBoxRefresher = sender as TextBox; int rndVal = Convert.ToInt32(item3.Value.ToString()); if (rndVal >= 0 && rndVal <= 50) { GlobVars.rndCoof = rndVal / 100; } } catch { } } } return(Result.Succeeded); }
/// <summary> /// This method is used to create RibbonSample panel, and add wall related command buttons to it: /// 1. contains a SplitButton for user to create Non-Structural or Structural Wall; /// 2. contains a StackedBotton which is consisted with one PushButton and two Comboboxes, /// PushButon is used to reset all the RibbonItem, Comboboxes are use to select Level and WallShape /// 3. contains a RadioButtonGroup for user to select WallType. /// 4. Adds a Slide-Out Panel to existing panel with following functionalities: /// 5. a text box is added to set mark for new wall, mark is a instance parameter for wall, /// Eg: if user set text as "wall", then Mark for each new wall will be "wall1", "wall2", "wall3".... /// 6. a StackedButton which consisted of a PushButton (delete all the walls) and a PulldownButton (move all the walls in X or Y direction) /// </summary> /// <param name="application">An object that is passed to the external application /// which contains the controlled application.</param> private void CreateRibbonSamplePanel(UIControlledApplication application) { // create a Ribbon panel which contains three stackable buttons and one single push button. string firstPanelName = "Ribbon Sample"; RibbonPanel ribbonSamplePanel = application.CreateRibbonPanel(firstPanelName); #region Create a SplitButton for user to create Non-Structural or Structural Wall SplitButtonData splitButtonData = new SplitButtonData("NewWallSplit", "Create Wall"); SplitButton splitButton = ribbonSamplePanel.AddItem(splitButtonData) as SplitButton; PushButton pushButton = splitButton.AddPushButton(new PushButtonData("WallPush", "Wall", AddInPath, "Revit.SDK.Samples.Ribbon.CS.CreateWall")); pushButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWall.png"), UriKind.Absolute)); pushButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWall-S.png"), UriKind.Absolute)); pushButton.ToolTip = "Creates a partition wall in the building model."; pushButton.ToolTipImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWallTooltip.bmp"), UriKind.Absolute)); pushButton = splitButton.AddPushButton(new PushButtonData("StrWallPush", "Structure Wall", AddInPath, "Revit.SDK.Samples.Ribbon.CS.CreateStructureWall")); pushButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "StrcturalWall.png"), UriKind.Absolute)); pushButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "StrcturalWall-S.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); #region Add a StackedButton which is consisted of one PushButton and two Comboboxes PushButtonData pushButtonData = new PushButtonData("Reset", "Reset", AddInPath, "Revit.SDK.Samples.Ribbon.CS.ResetSetting"); ComboBoxData comboBoxDataLevel = new ComboBoxData("LevelsSelector"); ComboBoxData comboBoxDataShape = new ComboBoxData("WallShapeComboBox"); IList<RibbonItem> ribbonItemsStacked = ribbonSamplePanel.AddStackedItems(pushButtonData, comboBoxDataLevel, comboBoxDataShape); ((PushButton)(ribbonItemsStacked[0])).Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Reset.png"), UriKind.Absolute)); //Add options to WallShapeComboBox Autodesk.Revit.UI.ComboBox comboboxWallShape = (Autodesk.Revit.UI.ComboBox)(ribbonItemsStacked[2]); ComboBoxMemberData comboBoxMemberData = new ComboBoxMemberData("RectangleWall", "RectangleWall"); ComboBoxMember comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "RectangleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("CircleWall", "CircleWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CircleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("TriangleWall", "TriangleWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "TriangleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("SquareWall", "SquareWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "SquareWall.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); #region Add a RadioButtonGroup for user to select WallType RadioButtonGroupData radioButtonGroupData = new RadioButtonGroupData("WallTypeSelector"); RadioButtonGroup radioButtonGroup = (RadioButtonGroup)(ribbonSamplePanel.AddItem(radioButtonGroupData)); ToggleButton toggleButton = radioButtonGroup.AddItem(new ToggleButtonData("Generic8", "Generic - 8\"", AddInPath, "Revit.SDK.Samples.Ribbon.CS.Dummy")); toggleButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Generic8.png"), UriKind.Absolute)); toggleButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Generic8-S.png"), UriKind.Absolute)); toggleButton = radioButtonGroup.AddItem(new ToggleButtonData("ExteriorBrick", "Exterior - Brick", AddInPath, "Revit.SDK.Samples.Ribbon.CS.Dummy")); toggleButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "ExteriorBrick.png"), UriKind.Absolute)); toggleButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "ExteriorBrick-S.png"), UriKind.Absolute)); #endregion //slide-out panel: ribbonSamplePanel.AddSlideOut(); #region add a Text box to set the mark for new wall TextBoxData testBoxData = new TextBoxData("WallMark"); Autodesk.Revit.UI.TextBox textBox = (Autodesk.Revit.UI.TextBox)(ribbonSamplePanel.AddItem(testBoxData)); textBox.Value = "new wall"; //default wall mark textBox.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "WallMark.png"), UriKind.Absolute)); textBox.ToolTip = "Set the mark for new wall"; textBox.ShowImageAsButton = true; textBox.EnterPressed += new EventHandler<Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(SetTextBoxValue); #endregion ribbonSamplePanel.AddSeparator(); #region Create a StackedButton which consisted of a PushButton (delete all the walls) and a PulldownButton (move all the walls in X or Y direction) PushButtonData deleteWallsButtonData = new PushButtonData("deleteWalls", "Delete Walls", AddInPath, "Revit.SDK.Samples.Ribbon.CS.DeleteWalls"); deleteWallsButtonData.ToolTip = "Delete all the walls created by the Create Wall tool."; deleteWallsButtonData.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "DeleteWalls.png"), UriKind.Absolute)); PulldownButtonData moveWallsButtonData = new PulldownButtonData("moveWalls", "Move Walls"); moveWallsButtonData.ToolTip = "Move all the walls in X or Y direction"; moveWallsButtonData.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWalls.png"), UriKind.Absolute)); // create stackable buttons IList<RibbonItem> ribbonItems = ribbonSamplePanel.AddStackedItems(deleteWallsButtonData, moveWallsButtonData); // add two push buttons as sub-items of the moveWalls PulldownButton. PulldownButton moveWallItem = ribbonItems[1] as PulldownButton; PushButton moveX = moveWallItem.AddPushButton(new PushButtonData("XDirection", "X Direction", AddInPath, "Revit.SDK.Samples.Ribbon.CS.XMoveWalls")); moveX.ToolTip = "move all walls 10 feet in X direction."; moveX.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWallsXLarge.png"), UriKind.Absolute)); PushButton moveY = moveWallItem.AddPushButton(new PushButtonData("YDirection", "Y Direction", AddInPath, "Revit.SDK.Samples.Ribbon.CS.YMoveWalls")); moveY.ToolTip = "move all walls 10 feet in Y direction."; moveY.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWallsYLarge.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); application.ControlledApplication.DocumentCreated += new EventHandler<Autodesk.Revit.DB.Events.DocumentCreatedEventArgs>(DocumentCreated); }
public MultipleTextBoxControl(int identifier) { InitializeComponent(); _newTextBoxGroup = new TextBoxData(identifier); }
public void Should_not_add_the_READONLY_attribute_if_ReadOnly_is_false() { var textBox = new TextBoxData("World"); var result = textBox.ToString(); result.ShouldBeEqualTo("<input type='text' class='textbox' value='World'/>"); }