Esempio n. 1
0
        /// <summary>
        /// Pulldown button for "Command Data", "DB Element" and "Element Filtering"
        /// </summary>
        public void AddPulldownButton(RibbonPanel panel)
        {
            // Create three push buttons for pulldown button drop down

            // #1
            PushButtonData pushButtonData1 = new PushButtonData("PulldownCommandData", "Command Data", _introLabPath, _introLabName + ".CommandData");

            pushButtonData1.LargeImage = NewBitmapImage("Basics.ico");

            // #2
            PushButtonData pushButtonData2 = new PushButtonData("PulldownDbElement", "DB Element", _introLabPath, _introLabName + ".DBElement");

            pushButtonData2.LargeImage = NewBitmapImage("Basics.ico");

            // #3
            PushButtonData pushButtonData3 = new PushButtonData("PulldownElementFiltering", "Filtering", _introLabPath, _introLabName + ".ElementFiltering");

            pushButtonData3.LargeImage = NewBitmapImage("Basics.ico");

            // Make a pulldown button now
            PulldownButtonData pulldownBtnData = new PulldownButtonData("PulldownButton", "Pulldown");
            PulldownButton     pulldownBtn     = panel.AddItem(pulldownBtnData) as PulldownButton;

            pulldownBtn.AddPushButton(pushButtonData1);
            pulldownBtn.AddPushButton(pushButtonData2);
            pulldownBtn.AddPushButton(pushButtonData3);
        }
        private void AddMenu(UIControlledApplication app)
        {
            RibbonPanel        ribbonPanel = app.CreateRibbonPanel("Revit Family Utilities");
            PulldownButtonData data        = new PulldownButtonData("Options", "Revit Family Utilities");

            RibbonItem     item = ribbonPanel.AddItem(data);
            PulldownButton opt  = item as PulldownButton;

            opt.AddPushButton(new PushButtonData("File Upgrade", "File Upgrade", ExecutingAssemblyPath, "FamilyUtilities.FileUpgrade"));
            opt.AddPushButton(new PushButtonData("Parameter Manager", "Parameter Manager", ExecutingAssemblyPath, "FamilyUtilities.ParameterManager"));
        }
Esempio n. 3
0
        /// <summary>
        /// Stacked Buttons - combination of: push button, dropdown button, combo box and text box.
        /// (no radio button group, split buttons).
        /// Here we define 6 buttons, make grouping of 1, 3, 2 items, and stack them in three layer:
        /// (1) simple push button with "Hello World"
        /// (2) pull down with 3 items: "Command Data", "DB Element" and "Element Filtering".
        /// (3) pull down with 2 items: "Element Modification" and "Model Creation"
        /// </summary>
        public void AddStackedButtons_Complex(RibbonPanel panel)
        {
            // Create six push buttons to group for pull down and stack up

            // #0
            PushButtonData pushButtonData0 = new PushButtonData("StackComplexHelloWorld", "Hello World", _introLabPath, _introLabName + ".HelloWorld");

            pushButtonData0.Image = NewBitmapImage("Basics.ico");

            // #1
            PushButtonData pushButtonData1 = new PushButtonData("StackComplexCommandData", "Command Data", _introLabPath, _introLabName + ".CommandData");

            pushButtonData1.Image = NewBitmapImage("Basics.ico");

            // #2
            PushButtonData pushButtonData2 = new PushButtonData("StackComplexDbElement", "DB Element", _introLabPath, _introLabName + ".DBElement");

            // #3
            PushButtonData pushButtonData3 = new PushButtonData("StackComplexElementFiltering", "Filtering", _introLabPath, _introLabName + ".ElementFiltering");

            // #4
            PushButtonData pushButtonData4 = new PushButtonData("StackComplexElementModification", "Modify", _introLabPath, _introLabName + ".ElementModification");

            // #5
            PushButtonData pushButtonData5 = new PushButtonData("StackComplexModelCreation", "Create", _introLabPath, _introLabName + ".ModelCreation");

            // Make two sets of pull down

            PulldownButtonData pulldownBtnData1 = new PulldownButtonData("StackComplePulldownButton1", "DB Basics");
            PulldownButtonData pulldownBtnData2 = new PulldownButtonData("StackComplePulldownButton2", "Modeling");

            // Create three item stack.
            IList <RibbonItem> stackedItems = panel.AddStackedItems(pushButtonData0, pulldownBtnData1, pulldownBtnData2);
            PulldownButton     pulldownBtn2 = stackedItems[1] as PulldownButton;
            PulldownButton     pulldownBtn3 = stackedItems[2] as PulldownButton;

            pulldownBtn2.Image = NewBitmapImage("Basics.ico");
            pulldownBtn3.Image = NewBitmapImage("House.ico");

            // Add each sub items
            PushButton button1 = pulldownBtn2.AddPushButton(pushButtonData1);
            PushButton button2 = pulldownBtn2.AddPushButton(pushButtonData2);
            PushButton button3 = pulldownBtn2.AddPushButton(pushButtonData3);
            PushButton button4 = pulldownBtn3.AddPushButton(pushButtonData4);
            PushButton button5 = pulldownBtn3.AddPushButton(pushButtonData5);

            // Note: we need to set the image later. if we do in button data, it won't show in the Ribbon.
            button1.Image = NewBitmapImage("Basics.ico");
            button2.Image = NewBitmapImage("Basics.ico");
            button3.Image = NewBitmapImage("Basics.ico");
            button4.Image = NewBitmapImage("Basics.ico");

            button5.Image = NewBitmapImage("Basics.ico");
        }
Esempio n. 4
0
        /// <summary>
        /// Add buttons for the commands we define in this labs.
        /// Here we stack three push buttons and repeat it as we get more.
        /// </summary>
        public void AddUILabsCommandButtons(RibbonPanel panel)
        {
            // Get the location of this dll.
            string assembly = GetType().Assembly.Location;

            // Create three push buttons to stack up
            // #1
            PushButtonData pushButtonData1 = new PushButtonData("UILabsSelection", "Pick Sampler", assembly, _uiLabName + ".UISelection");

            pushButtonData1.Image = NewBitmapImage("basics.ico");

            // #2
            PushButtonData pushButtonData2 = new PushButtonData("UILabsCreateHouse", "Create House Pick", assembly, _uiLabName + ".UICreateHouse");

            pushButtonData2.Image = NewBitmapImage("House.ico");

            // #3
            PushButtonData pushButtonData3 = new PushButtonData("UILabsTaskDialog", "Dialog Sampler", assembly, _uiLabName + ".UITaskDialog");

            pushButtonData3.Image = NewBitmapImage("basics.ico");

            // #4
            PushButtonData pushButtonData4 = new PushButtonData("UILabsCreateHouseDialog", "Create House Dialog", assembly, _uiLabName + ".UICreateHouseDialog");

            pushButtonData4.Image = NewBitmapImage("House.ico");

            // #5
            // Make three sets of pull down
            PulldownButtonData pulldownBtnData1 = new PulldownButtonData("UILabsPulldownButton1", "Selection");
            PulldownButtonData pulldownBtnData2 = new PulldownButtonData("UILabsPulldownButton2", "Task Dialog");

            // Create three item stack.
            IList <RibbonItem> stackedItems = panel.AddStackedItems(pulldownBtnData1, pulldownBtnData2);
            PulldownButton     pulldownBtn1 = stackedItems[0] as PulldownButton;
            PulldownButton     pulldownBtn2 = stackedItems[1] as PulldownButton;

            pulldownBtn1.Image = NewBitmapImage("Basics.ico");
            pulldownBtn2.Image = NewBitmapImage("Basics.ico");

            // Add each sub items
            PushButton button1 = pulldownBtn1.AddPushButton(pushButtonData1);
            PushButton button2 = pulldownBtn1.AddPushButton(pushButtonData2);
            PushButton button3 = pulldownBtn2.AddPushButton(pushButtonData3);
            PushButton button4 = pulldownBtn2.AddPushButton(pushButtonData4);

            // Note: we need to set the image later. if we do in button data, it won't show in the Ribbon.
            button1.Image = NewBitmapImage("Basics.ico");
            button2.Image = NewBitmapImage("Basics.ico");
            button3.Image = NewBitmapImage("Basics.ico");
            button4.Image = NewBitmapImage("Basics.ico");
        }
Esempio n. 5
0
        public void PullDown(RibbonPanel panel)
        {
            //creates a Push button for the get selection command
            PushButtonData bgetselect = new PushButtonData("getselec", "Get Selection", assemblyloca, "Application.getSelection");
            //creates a Push button for the get Collection command
            PushButtonData bgetCollect = new PushButtonData("getcoll", "Get Collection", assemblyloca, "Application.getCollection");
            //creates a pull down menu
            PulldownButtonData pdb1 = new PulldownButtonData("WallsSelection", "Wall Selector");
            //assigns the pulldown menu to our panel
            PulldownButton pdb = panel.AddItem(pdb1) as PulldownButton;

            //adds the buttons above to the pulldown menu
            pdb.AddPushButton(bgetselect);
            pdb.AddPushButton(bgetCollect);
        }
Esempio n. 6
0
        public Result OnStartup(UIControlledApplication uic_app)
        {
            // get existing SOM Ribbon Tab
            var panels = uic_app.GetRibbonPanels("SOM Tools");

            if (null == panels)
            {
                uic_app.CreateRibbonTab("SOM Tools");
            }
            // get or create panel
            RibbonPanel panel = panels.Where(x => x.Name == "SOM-NY").FirstOrDefault();

            if (null == panel)
            {
                panel = uic_app.CreateRibbonPanel("SOM Tools", "SOM NY");
            }

            // pull down button
            PulldownButtonData pdBtnData  = new PulldownButtonData("SOMNY_Utils", "UTILITIES");
            RibbonItem         ribbonItem = panel.AddItem(pdBtnData);
            PulldownButton     pdBtn      = ribbonItem as PulldownButton;

            // get assembly
            string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string ExecutingAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;

            string ExecutingAssemblyDirectory = Path.GetDirectoryName(ExecutingAssemblyPath);


            // add items
            pdBtn.AddPushButton(new PushButtonData("RenumberAreasByPickSeq", "Re-Number Areas By Pick Order", Path.Combine(ExecutingAssemblyDirectory, "RenumberAreasByPickSeq.dll"), "RenumberAreasByPickSeq.Cmd_PickAreasBySeq"));

            return(Result.Succeeded);
        }
Esempio n. 7
0
        //设置PulldownButton类型的介绍信息
        public void SetPulldownButtonAttribute(ref RibbonPanel ribbon, string assembly, string className, PulldownButtonData pdb, string largeImageuri, string toolTip, string longDescription)
        {
            PushButtonData p1 = new PushButtonData("Pillar1", "圆柱", assembly, className);
            PushButtonData p2 = new PushButtonData("Pillar2", "方柱", assembly, className);

            SetCommonAttribute(ref p1, @"D:\workfile\Bridge\Img\Pillar1.png", "圆柱", "圆柱");
            SetCommonAttribute(ref p2, @"D:\workfile\Bridge\Img\Pillar1.png", "方柱", "方柱");
            pdb.LargeImage      = new BitmapImage(new Uri(largeImageuri));
            pdb.ToolTip         = toolTip;
            pdb.LongDescription = longDescription;
            PulldownButton pulldown = ribbon.AddItem(pdb) as PulldownButton;

            //在PulldownButton中添加PushButton
            pulldown.AddPushButton(p1);
            pulldown.AddPushButton(p2);
        }
Esempio n. 8
0
        private void CreateRibbonPanel(UIControlledApplication application)
        {
            string resourceDir   = CommonUtils.Utils.GetResourceDir();
            string buttonIcons32 = Path.Combine(resourceDir, CommonUtils.DefineUtils.ICONS_32_DIR);
            string buttonIcons16 = Path.Combine(resourceDir, CommonUtils.DefineUtils.ICONS_16_DIR);

            // Create a custom ribbon tab
            application.CreateRibbonTab(Define.RevitToolRibbonTab);

            #region About

            string assembly = @"C:\ProgramData\Autodesk\Revit\Addins\2019\OpeningCombiler" + @"\OpeningTools.dll";

            // Add Combine ribbon panel
            RibbonPanel combineRibbonPanel = application.CreateRibbonPanel(Define.RevitToolRibbonTab, Define.CombinePanel);
            assembly = @"C:\ProgramData\Autodesk\Revit\Addins\2019\OpeningCombiler" + @"\CommonOpeningTools.dll";

            // create pull down button for Combine opening
            PulldownButtonData combineDownButton = new PulldownButtonData("Combine Opening", "Combine \nOpening");
            PulldownButton     groupCombine      = combineRibbonPanel.AddItem(combineDownButton) as PulldownButton;
            combineDownButton.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonIcons32, "Combine_Opening32x32.png"), UriKind.Absolute));
            combineDownButton.Image      = new BitmapImage(new Uri(Path.Combine(buttonIcons16, "Combine_Opening16X16.png"), UriKind.Absolute));
            groupCombine.LargeImage      = new BitmapImage(new Uri(Path.Combine(buttonIcons32, "Combine_Opening32x32.png"), UriKind.Absolute));
            groupCombine.Image           = new BitmapImage(new Uri(Path.Combine(buttonIcons16, "Combine_Opening16X16.png"), UriKind.Absolute));

            // add button for synchronize
            PushButtonData synchronoursButtonData = new PushButtonData("Synchronous", "Synchronous", assembly, "CommonTools.OpeningClient.Synchronize.Commandata");
            PushButton     synchronoursBtn        = groupCombine.AddPushButton(synchronoursButtonData) as PushButton;
            synchronoursBtn.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonIcons32, "Combine_Opening_Synchronous32x32.png"), UriKind.Absolute));
            synchronoursBtn.Image      = new BitmapImage(new Uri(Path.Combine(buttonIcons16, "Combine_Opening_Synchronous16x16.png"), UriKind.Absolute));
            synchronoursBtn.ToolTip    = "Synchronous";

            #endregion About
        }
 internal static void AddPullDownButton(PulldownButton pulldown, LinkedScript script, LinkedScriptAssembly lsa)
 {
     if (pulldown.AddPushButton(NewScriptButton(script, lsa.FilePath)) is PushButton pushButton)
     {
         // do stuff with button?
     }
 }
Esempio n. 10
0
        void AddPushButton(string assName,
                           string name,
                           string title,
                           string className,
                           string description,
                           string longDescription,
                           ImageSource image,
                           PulldownButton pulldownButton)
        {
            try
            {
                string path = Path.Combine(addin.DirectoryName, assName);

                PushButtonData buttonData = new PushButtonData(
                    name,
                    title,
                    path,
                    className)
                {
                    ToolTip         = description,
                    LongDescription = longDescription,
                    LargeImage      = image,
                    Image           = image
                };
                PushButton button = pulldownButton.AddPushButton(buttonData);

                //button.SetContextualHelp(help);
                button.Enabled = true;
            }
            catch (Exception ex)
            {
                TaskDialog.Show("ERROR", string.Format("Error creating button for the tool: {0}\n{1}", title, ex.ToString()));
                return;
            }
        }
Esempio n. 11
0
        public static void SetPushDownButton(PulldownButton group, PushButtonData pushButtonData, string toolTip, string uri)
        {
            PushButton pushButton = group.AddPushButton(pushButtonData) as PushButton;

            pushButton.ToolTip = toolTip;
            BitmapImage bitmapImage = new BitmapImage(new Uri(uri));

            pushButton.LargeImage = bitmapImage;
        }
Esempio n. 12
0
        private void AddPushButtonData(string name, string text, string description, string className, PulldownButton pullDown, Source.Source imageSource)
        {
            PushButtonData data   = new PushButtonData(name, text, Assembly.GetExecutingAssembly().Location, className);
            PushButton     button = pullDown.AddPushButton(data) as PushButton;

            button.ToolTip         = description;
            button.LongDescription = string.Format("Версия: {0}\nСборка: {1}-{2}", ModuleData.Version, ModuleData.Build, ModuleData.Date);
            button.ItemText        = text;
            button.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, ModuleData.ManualPage));
            button.LargeImage = new BitmapImage(new Uri(imageSource.Value));
        }
Esempio n. 13
0
        private void AddRibbonPanel(UIControlledApplication app)
        {
            RibbonPanel        rvtRibbonPanel = app.CreateRibbonPanel("STF Exporter: v" + Assembly.GetExecutingAssembly().GetName().Version);
            PulldownButtonData data           = new PulldownButtonData("Options", "STF Export");
            RibbonItem         pb_item        = rvtRibbonPanel.AddItem(data);
            PulldownButton     optionsBtn     = pb_item as PulldownButton;

            optionsBtn.AddPushButton(new PushButtonData("STF Export CP1251", "Export with CP1251 charsets", assyPath, "STFExporter.CmdExportAsCP1251"));
            optionsBtn.AddPushButton(new PushButtonData("STF Export UTF8", "Export with UTF8 charsets", assyPath, "STFExporter.CmdExportAsUTF8"));
            optionsBtn.AddPushButton(new PushButtonData("About..", "About dialog", assyPath, "STFExporter.AboutDlg"));

            optionsBtn.LargeImage      = NewBitmapImage("stfexport.png");
            optionsBtn.ToolTip         = "Export Revit Spaces to STF file";
            optionsBtn.LongDescription = "Exports Spaces in Revit model to STF file for use in application such as DIALux";

            //ContextualHe/lp contextHelp = new ContextualHelp(ContextualHelpType.ChmFile, dir + "/Resources/STFExporter Help.htm");
            ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url, "https://github.com/kmorin/STF-Exporter");

            pb_item.SetContextualHelp(contextHelp);
        }
Esempio n. 14
0
        internal static void AddPushButton(this PulldownButton pullDownButton, Type commandType, string text, string tooltip = default(string), Type availability = null)
        {
            // Create a push button to trigger a command and add it to the pull down button.
            var thisAssembly = Assembly.GetExecutingAssembly();
            var buttonData   = new PushButtonData("cmdRhinoInside." + commandType.Name, text, thisAssembly.Location, commandType.FullName);

            if (pullDownButton.AddPushButton(buttonData) is PushButton pushButton)
            {
                pushButton.ToolTip = tooltip;
                pushButton.AvailabilityClassName = availability?.FullName ?? string.Empty;
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 附加按钮
        /// </summary>
        /// <param name="b1"></param>
        /// <param name="plugins"></param>
        private static void AppendPullButton(PulldownButton b1, List <IFangCommand> plugins)
        {
            foreach (var plugin in plugins)
            {
                PushButtonData data = new PushButtonData(plugin.AlaisName, plugin.AlaisName, plugin.GetType().Assembly.Location, plugin.ModelName);
                PushButton     ps   = b1.AddPushButton(data);

                ps.LargeImage = plugin.ImageURI;
                ps.Image      = plugin.ImageURI;
                ps.SetShortCut(plugin.ShortCutKey);
            }
        }
Esempio n. 16
0
        public override void BuildPanelButtons()
        {
            PushButtonMaker buttonMaker = new PushButtonMaker(new Info());

            buttonMaker.BuildPushButtonData();
            PushButtonData buttonData = buttonMaker.GetPushButtonData();
            PushButton     button     = Panel.AddItem(buttonData) as PushButton;

            #region Visual
            PulldownButtonData visualPulldownButtonData = new PulldownButtonData("Visual", "Visual");
            visualPulldownButtonData.LargeImage =
                AssemblyResourceUtils.GetImageFromResource("Commands/Images/Large/blue/visibility.png");
            PulldownButton visualPulldownButton = Panel.AddItem(visualPulldownButtonData) as PulldownButton;


            #endregion

            PulldownButtonData selectionPulldownButtonData = new PulldownButtonData("Selection", "Selection");
            selectionPulldownButtonData.LargeImage =
                AssemblyResourceUtils.GetImageFromResource("Commands/Images/Large/blue/hands-and-gestures.png");
            PulldownButton selectionPulldownButton = Panel.AddItem(selectionPulldownButtonData) as PulldownButton;

            #region Parameters
            PulldownButtonData parametersPulldownButtonData = new PulldownButtonData("Parameters", "Parameters");
            parametersPulldownButtonData.LargeImage =
                AssemblyResourceUtils.GetImageFromResource("Commands/Images/Large/blue/controls.png");
            PulldownButton parametersPulldownButton = Panel.AddItem(parametersPulldownButtonData) as PulldownButton;

            buttonMaker = new PushButtonMaker(new ShowParameterEditor());
            buttonMaker.BuildPushButtonData();
            buttonData = buttonMaker.GetPushButtonData();
            button     = parametersPulldownButton.AddPushButton(buttonData) as PushButton;

            #endregion

            PulldownButtonData viewsPulldownButtonData = new PulldownButtonData("Views", "Views");
            viewsPulldownButtonData.LargeImage =
                AssemblyResourceUtils.GetImageFromResource("Commands/Images/Large/blue/crop.png");
            PulldownButton viewsPulldownButton = Panel.AddItem(viewsPulldownButtonData) as PulldownButton;


            PulldownButtonData worksharingPulldownButtonData = new PulldownButtonData("Worksharing", "Worksharing");
            worksharingPulldownButtonData.LargeImage =
                AssemblyResourceUtils.GetImageFromResource("Commands/Images/Large/blue/network.png");
            PulldownButton worksharingPulldownButton = Panel.AddItem(worksharingPulldownButtonData) as PulldownButton;


            PulldownButtonData analyzePulldownButtonData = new PulldownButtonData("Analyze", "Analyze");
            analyzePulldownButtonData.LargeImage =
                AssemblyResourceUtils.GetImageFromResource("Commands/Images/Large/blue/analytics.png");
            PulldownButton analyzePulldownButton = Panel.AddItem(analyzePulldownButtonData) as PulldownButton;
        }
Esempio n. 17
0
        private void CreatePythonCommandButtonsOnRibbon()
        {
            Dictionary <string, PulldownButton> pulldownButtons = GetDictionaryWithPulldownButtons();

            foreach (var commandSetting in _settingsInterpreter.PythonCommandSettings)
            {
                PushButtonData dynamicCommandPushButton =
                    CreatePythonPushButtonDataFromSetting(commandSetting);

                PulldownButton parentPulldownButton = pulldownButtons[commandSetting.ParentButton];
                parentPulldownButton.AddPushButton(dynamicCommandPushButton);
            }
        }
Esempio n. 18
0
        private void AddMenu(UIControlledApplication app)
        {
            RibbonPanel        rvtRibbonPanel = app.CreateRibbonPanel("Revit Lookup");
            PulldownButtonData data           = new PulldownButtonData("Options", "Revit Lookup");

            RibbonItem     item       = rvtRibbonPanel.AddItem(data);
            PulldownButton optionsBtn = item as PulldownButton;

            // Add Icons to main RevitLookup Menu
            optionsBtn.Image      = GetEmbeddedImage("RevitLookup.Resources.RLookup-16.png");
            optionsBtn.LargeImage = GetEmbeddedImage("RevitLookup.Resources.RLookup-32.png");
            optionsBtn.AddPushButton(new PushButtonData("HelloWorld", "Hello World...", ExecutingAssemblyPath, "RevitLookup.HelloWorld"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Db..", "Snoop DB...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopDb"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Current Selection...", "Snoop Current Selection...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopModScope"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Pick Face...", "Snoop Pick Face...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopModScopePickSurface"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Pick Edge...", "Snoop Pick Edge...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopModScopePickEdge"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Pick Linked Element...", "Snoop Linked Element...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopModScopeLinkedElement"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Active View...", "Snoop Active View...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopActiveView"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Application...", "Snoop Application...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopApp"));
            optionsBtn.AddPushButton(new PushButtonData("Search and Snoop...", "Search and Snoop...", ExecutingAssemblyPath, "RevitLookup.CmdSearchBy"));
            optionsBtn.AddPushButton(new PushButtonData("Test Framework...", "Test Framework...", ExecutingAssemblyPath, "RevitLookup.CmdTestShell"));
        }
        internal static PushButton AddPushButton <CommandType, AvailabilityType>(PulldownButton pullDownButton, string text, string tooltip)
            where CommandType : IExternalCommand
            where AvailabilityType : IExternalCommandAvailability
        {
            var buttonData = NewPushButtonData <CommandType, AvailabilityType>(text);

            if (pullDownButton.AddPushButton(buttonData) is PushButton pushButton)
            {
                pushButton.ToolTip = tooltip;
                return(pushButton);
            }

            return(null);
        }
Esempio n. 20
0
        private void AddMenu(UIControlledApplication app)
        {
            RibbonPanel rvtRibbonPanel = app.CreateRibbonPanel(name);

#if Pulldown
            PulldownButton btn = rvtRibbonPanel.AddItem(new PulldownButtonData("Options", "Revit to XObject")) as PulldownButton;

            btn.AddPushButton(new PushButtonData("HelloWorld", "Hello World...", location, "RevitToXObject.Command"));
#else
            PushButton btn = rvtRibbonPanel.AddItem(new PushButtonData("Revit To XObject", "Revit to XObject", location, "RevitToXObject.Command")) as PushButton;
#endif
            btn.Image               = GetEmbeddedImage("RevitToXObject.Resources.XObject_16.png");
            btn.LargeImage          = GetEmbeddedImage("RevitToXObject.Resources.XObject_32.png");
            UIControlledApplication = app;
        }
Esempio n. 21
0
        private void CreateVisibilitySwitcherCommandsOnRibbonAsSlideOut()
        {
            _ribbonPanel.AddSlideOut();
            PulldownButtonData pdbd =
                new PulldownButtonData("VisibiitySwitcher", "VisibiitySwitcher");
            PulldownButton pulldownButton = _ribbonPanel.AddItem(pdbd) as PulldownButton;

            foreach (var commandSetting in _settingsInterpreter.VisibilitySwitcherCommandSettings)
            {
                PushButtonData dynamicCommandPushButton =
                    CreateVisibilitySwitcherPushButtonDataFromSetting(commandSetting);
                dynamicCommandPushButton.ToolTip = commandSetting.VisibilityNameRegex;

                pulldownButton.AddPushButton(dynamicCommandPushButton);
            }
        }
Esempio n. 22
0
        public Result OnStartup(UIControlledApplication application)
        {
            application.CreateRibbonTab("UCD场地工具");
            RibbonPanel panel1 = application.CreateRibbonPanel("UCD场地工具", "欢迎页");

            PushButtonData pbd = new PushButtonData("UCD场地工具", "欢迎使用", @"D:\Studay\CSharp\Work\Revit\HelloRevit\bin\Debug\HelloRevit.dll", "HelloRevit.Class1");
            PushButton     pb  = panel1.AddItem(pbd) as PushButton;

            RibbonPanel     panel2    = application.CreateRibbonPanel("UCD场地工具", "工具");
            SplitButtonData splitData = new SplitButtonData("我的集合", "创建工具");
            SplitButton     sb        = panel2.AddItem(splitData) as SplitButton;

            PushButtonData spd = new PushButtonData("UCD场地工具", "创建", @"D:\Studay\CSharp\Work\Revit\Create2\bin\Debug\Create2.dll", "Create2.CreateBox")
            {
                LargeImage = new BitmapImage(new Uri(@"D:\Studay\CSharp\Work\Revit\Ribbon1\img\sign_road.png"))
            };

            sb.AddPushButton(spd);
            panel2.AddSeparator();

            PulldownButtonData pdbd    = new PulldownButtonData("UCD场地工具", "检查");
            PushButtonData     pushbtn = new PushButtonData("UCD场地工具", "碰撞检查", @"D:\Studay\CSharp\Work\Revit\Collision\bin\Debug\Collision.dll", "Collision.Class1");
            PulldownButton     btn     = panel2.AddItem(pushbtn) as PulldownButton;

            btn.LongDescription = "检查当前物体是否碰撞";
            btn.AddPushButton(pushbtn);

            RibbonPanel  panel3 = application.CreateRibbonPanel("UCD场地工具", "文件");
            ComboBoxData cbd    = new ComboBoxData("选项");
            ComboBox     cBox   = panel3.AddItem(cbd) as ComboBox;

            if (cBox != null)
            {
                cBox.ItemText        = "选择操作";
                cBox.ToolTip         = "请选择想要进行的操作";
                cBox.LongDescription = "选择一直接关闭,选择二关闭并修改";
                ComboBoxMemberData cbmd  = new ComboBoxMemberData("A", "关闭");
                ComboBoxMemberData cbmd2 = new ComboBoxMemberData("B", "关闭并修改");
                cbmd.GroupName = "编辑操作";
                cBox.AddItem(cbmd);
                cBox.AddItem(cbmd2);
            }

            cBox.CurrentChanged += Change;
            cBox.CurrentChanged += Closed;
            return(Result.Succeeded);
        }
Esempio n. 23
0
        private void AddMenu(UIControlledApplication app)
        {
            Autodesk.Revit.UI.RibbonPanel rvtRibbonPanel = app.CreateRibbonPanel("Revit Lookup");
            PulldownButtonData            data           = new PulldownButtonData("Options", "Revit Lookup");

            RibbonItem     item       = rvtRibbonPanel.AddItem(data);
            PulldownButton optionsBtn = item as PulldownButton;

            optionsBtn.AddPushButton(new PushButtonData("HelloWorld", "Hello World...", ExecutingAssemblyPath, "RevitLookup.HelloWorld"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Db..", "Snoop DB...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopDb"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Current Selection...", "Snoop Current Selection...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopModScope"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Active View...", "Snoop Active View...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopActiveView"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Application...", "Snoop Application...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopApp"));
            optionsBtn.AddPushButton(new PushButtonData("Test Framework...", "Test Framework...", ExecutingAssemblyPath, "RevitLookup.CmdTestShell"));
            optionsBtn.AddPushButton(new PushButtonData("Events...", "Events...", ExecutingAssemblyPath, "RevitLookup.CmdEvents"));
        }
Esempio n. 24
0
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon panel
            String tabName = "Archilizer";
            String version = "1.0.1";

            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch (Exception)
            {
            }
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Purge +");

            // Get dll assembly path
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData delBackupsBtn = CreatePushButton("Delete Backups", "1. Delete Backups", thisAssemblyPath, "Archilizer_Purge.CommandDeleteBackups",
                                                            "Deletes those pesky .00??.rvt files.", "purge.png", "purge_small.png");

            PushButtonData dwgBtn = CreatePushButton("Imported DWG Files", "2. Imported DWG Files", thisAssemblyPath, "Archilizer_Purge.PurgeImportedDWG",
                                                     "Purges imported (but not linked) DWG files in the current project.", "purge.png", "purge_small.png");

            PushButtonData dwgLinesBtn = CreatePushButton("DWG Line Patterns", "3. DWG Line Patterns", thisAssemblyPath, "Archilizer_Purge.PurgeImportedLinePatterns",
                                                          "Purges line patterns brought by imported DWG files.", "purge.png", "purge_small.png");

            PushButtonData viewsBtn = CreatePushButton("Views not on Sheets", "4. Views not on Sheets", thisAssemblyPath, "Archilizer_Purge.CommandViewsNotOnSheets",
                                                       "Purges Views not placed on Sheets. Use at your own risk!", "purge.png", "purge_small.png");

            PushButtonData vtemplateBtn = CreatePushButton("Unused View Templates", "5. Unused View Templates", thisAssemblyPath, "Archilizer_Purge.PurgeUnusedTemplates",
                                                           "Purges Unused View Templates.", "purge.png", "purge_small.png");

            PushButtonData filtersBtn = CreatePushButton("Unused Filters", "6. Unused Filters", thisAssemblyPath, "Archilizer_Purge.PurgeFilters",
                                                         "Purges Unused Filters (Filters that have never been assigned to a View or a View Template).", "purge.png", "purge_small.png");

            PulldownButtonData pd1 = new PulldownButtonData("purgeButton", "Purge");

            pd1.ToolTip = String.Format("v{0}", version);
            BitmapImage pdImage = new BitmapImage(new Uri(String.Format("pack://application:,,,/Archilizer_Purge;component/Resources/{0}", "purge.png")));

            pd1.LargeImage = pdImage;
            pd1.Image      = pdImage;
            PulldownButton pd = ribbonPanel.AddItem(pd1) as PulldownButton;

            pd.AddPushButton(delBackupsBtn);
            pd.AddPushButton(dwgBtn);
            pd.AddPushButton(dwgLinesBtn);
            pd.AddPushButton(viewsBtn);
            pd.AddPushButton(vtemplateBtn);
            pd.AddPushButton(filtersBtn);
        }
Esempio n. 25
0
        /// <summary>
        /// Add sample item to pulldown menu
        /// </summary>
        /// <param name="pullDownButton">Pulldown menu</param>
        /// <param name="item">Sample item to be added</param>
        private void AddSampleToPulldownMenu(PulldownButton pullDownButton, SampleItem item)
        {
            PushButtonData pushButtonData = new PushButtonData(item.DisplayName, item.DisplayName, item.Assembly, item.ClassName);
            PushButton     pushButton     = pullDownButton.AddPushButton(pushButtonData);

            if (!string.IsNullOrEmpty(item.LargeImage))
            {
                BitmapImage largeImageSource = new BitmapImage(new Uri(item.LargeImage, UriKind.Absolute));
                pushButton.LargeImage = largeImageSource;
            }
            if (!string.IsNullOrEmpty(item.Image))
            {
                BitmapImage imageSource = new BitmapImage(new Uri(item.Image, UriKind.Absolute));
                pushButton.Image = imageSource;
            }

            pushButton.ToolTip = item.Description;
        }
Esempio n. 26
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            RibbonPanel        rvtRibbonPanel = application.CreateRibbonPanel("CadFaster, Inc.");
            PulldownButtonData data           = new PulldownButtonData("Options", "CadFaster, Inc.");

            RibbonItem     item       = rvtRibbonPanel.AddItem(data);
            PulldownButton optionsBtn = item as PulldownButton;

            optionsBtn.AddPushButton(new PushButtonData("ExeWrite", "ExeWrite",
                                                        @"C:\CadFaster\Revit\CF_RevitBridge.dll", "ExeWriter.CF_RevitBridge"));
            //PushButton pushButton = ribbonPanel.AddPushButton("ExeWrite", "ExeWrite",
            //@"G:\Projects\reload_addin\RevitPlugin\Bridge\bin\Debug\Bridge.dll", "rev.Bridge");

            Uri         uriImageMain   = new Uri(@"C:\CadFaster\Revit\Images\Company.gif");
            BitmapImage largeImageMain = new BitmapImage(uriImageMain);

            optionsBtn.LargeImage = largeImageMain;

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
Esempio n. 27
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            RibbonPanel        rvtRibbonPanel        = application.CreateRibbonPanel("CadFaster, Inc.");
            PulldownButtonData data                  = new PulldownButtonData("Options", "CadFaster, Inc.");
            string             ExecutingAssemblyPath = Assembly.GetExecutingAssembly().Location;
            string             DllAssemblyPath       = Path.GetDirectoryName(Assembly.GetAssembly(typeof(CF_RevitDLL)).CodeBase);
            RibbonItem         item                  = rvtRibbonPanel.AddItem(data);
            PulldownButton     optionsBtn            = item as PulldownButton;

            optionsBtn.AddPushButton(new PushButtonData("ExeWriter", "ExeWriter",
                                                        ExecutingAssemblyPath, "ExeWriter.Cl_Exewriter"));

            //PushButton pushButton = ribbonPanel.AddPushButton("ExeWrite", "ExeWrite",
            //@"G:\Projects\reload_addin\RevitPlugin\Bridge\bin\Debug\Bridge.dll", "rev.Bridge");

            Uri         uriImageMain   = new Uri(@"C:\Projects\CadFasterHSFWriterSDK\bin\Images\Company.gif");
            BitmapImage largeImageMain = new BitmapImage(uriImageMain);

            optionsBtn.LargeImage = largeImageMain;

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
Esempio n. 28
0
        internal static void CreateUI(RibbonPanel ribbonPanel)
        {
            if (ribbonPanel.AddItem(new PulldownButtonData("cmdRhinoInside.Help", "Help")) is PulldownButton pullDownButton)
            {
                helpButton            = pullDownButton;
                helpButton.Image      = ImageBuilder.BuildImage("?");
                helpButton.LargeImage = ImageBuilder.BuildLargeImage("?");

                helpButton.AddPushButton(typeof(CommandSampleFiles), "Sample files", "Opens sample files folder", typeof(AllwaysAvailable));
                helpButton.AddPushButton(typeof(CommandAPIDocs), "APIDocs", "Opens apidocs.co website", typeof(AllwaysAvailable));
                helpButton.AddPushButton(typeof(CommandTheBuildingCoder), "TheBuildingCoder", "Opens thebuildingcoder.typepad.com website", typeof(AllwaysAvailable));
                helpButton.AddSeparator();
                helpButton.AddPushButton(typeof(CommandRhinoDevDocs), "Rhino Dev Docs", "Opens developer.rhino3d.com website", typeof(AllwaysAvailable));
                helpButton.AddPushButton(typeof(CommandDiscourse), "McNeel Discourse", "Opens discourse.mcneel.com website", typeof(AllwaysAvailable));
                helpButton.AddSeparator();
                helpButton.AddPushButton(typeof(CommandCheckForUpdates), "Updates", "Checks if there are updates in GitHub", typeof(AllwaysAvailable));
                helpButton.AddPushButton(typeof(CommandAbout), "About", "Opens GitHub Repo website", typeof(AllwaysAvailable));
            }

            CommandCheckForUpdates.CheckUpdates();
        }
Esempio n. 29
0
        internal static PushButton AddPushButton(this PulldownButton pullDownButton, Type commandType, string text = null, string tooltip = null, Type availability = null)
        {
            var buttonData = new PushButtonData
                             (
                commandType.Name,
                text ?? commandType.Name,
                commandType.Assembly.Location,
                commandType.FullName
                             );

            if (pullDownButton.AddPushButton(buttonData) is PushButton pushButton)
            {
                pushButton.ToolTip = tooltip;
                if (availability != null)
                {
                    pushButton.AvailabilityClassName = availability.FullName;
                }

                return(pushButton);
            }

            return(null);
        }
Esempio n. 30
0
        internal static void CreateUI(RibbonPanel ribbonPanel)
        {
            if (ribbonPanel.AddItem(new PulldownButtonData("cmdRhinoInside.Help", "Help")) is PulldownButton pullDownButton)
            {
                helpButton            = pullDownButton;
                helpButton.LargeImage = ImageBuilder.BuildLargeImage("?");

                helpButton.AddPushButton(typeof(APIDocsCommand), "APIDocs", "Opens apidocs.co website", typeof(AllwaysAvailable));
                helpButton.AddPushButton(typeof(TheBuildingCoderCommand), "TheBuildingCoder", "Opens thebuildingcoder.typepad.com website", typeof(AllwaysAvailable));
                helpButton.AddSeparator();
                helpButton.AddPushButton(typeof(RhinoDevDocsCommand), "Rhino Dev Docs", "Opens developer.rhino3d.com website", typeof(AllwaysAvailable));
                helpButton.AddPushButton(typeof(DiscourseCommand), "McNeel Discourse", "Opens discourse.mcneel.com website", typeof(AllwaysAvailable));
                helpButton.AddSeparator();
#if DEBUG
                helpButton.AddPushButton(typeof(CheckForUpdatesCommand), "Check for updates", "Checks if there are updates in GitHub", typeof(AllwaysAvailable));
#endif
                helpButton.AddPushButton(typeof(AboutCommand), "About", "Opens GitHub Repo website", typeof(AllwaysAvailable));
            }

            CheckForUpdatesCommand.CheckUpdates();
        }
Esempio n. 31
0
        /// <summary>
        /// Add sample item to pulldown menu
        /// </summary>
        /// <param name="pullDownButton">Pulldown menu</param>
        /// <param name="item">Sample item to be added</param>
        private void AddSampleToPulldownMenu(PulldownButton pullDownButton, SampleItem item)
        {
            PushButtonData pushButtonData = new PushButtonData(item.DisplayName, item.DisplayName, item.Assembly, item.ClassName);
            PushButton pushButton = pullDownButton.AddPushButton(pushButtonData);
            if (!string.IsNullOrEmpty(item.LargeImage))
            {
                BitmapImage largeImageSource = new BitmapImage(new Uri(item.LargeImage, UriKind.Absolute));
                pushButton.LargeImage = largeImageSource;
            }
            if (!string.IsNullOrEmpty(item.Image))
            {
                BitmapImage imageSource = new BitmapImage(new Uri(item.Image, UriKind.Absolute));
                pushButton.Image = imageSource;
            }

            pushButton.ToolTip = item.Description;
        }