Ejemplo n.º 1
0
        public Result OnStartup(UIControlledApplication application)
        {
            var rootPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\\Autodesk\\Revit\\Addins\\2011\\BIMXchangeAdmin.bundle";

            const string str = "CDWKS.RevitAddon.Indexer2011.dll";
            var ribbonPanel = application.CreateRibbonPanel("BIMXchange Admin");
            #region Content Indexer
            var pushButtonDataIndexer = new PushButtonData("Content Indexer", "Content Indexer", string.Format("{0}\\{1}", rootPath, str),
                                                     "CDWKS.RevitAddon.Indexer2011.IndexerCommand");
            var ribbonItemIndexer = ribbonPanel.AddItem(pushButtonDataIndexer);
            var pushButtonIndexer = ribbonItemIndexer as PushButton;

            pushButtonIndexer.LargeImage = (new BitmapImage(new Uri(string.Format("{0}\\Library_32.png", rootPath))));
            #endregion

            #region Content TreeCreator
            var pushButtonDataTreeCreator = new PushButtonData("Library Tree", "Library Tree", string.Format("{0}\\{1}", rootPath, str),
                                                     "CDWKS.RevitAddon.Indexer2011.TreeViewCreator");
            var ribbonItemTreeCreator = ribbonPanel.AddItem(pushButtonDataTreeCreator);
            var pushButtonTreeCreator = ribbonItemTreeCreator as PushButton;

            pushButtonTreeCreator.LargeImage = (new BitmapImage(new Uri(string.Format("{0}\\Library_32.png", rootPath))));
            #endregion
            return Result.Succeeded;
        }
        /// <summary>
        /// Read in a PushButton tag and produce a PushButtonData object that can be used to
        /// add the PushButton to the UI (e.g. a RibbonPanel or SplitButton)
        /// </summary>
        private PushButtonData BuildPushButtonData(Assembly addinAssembly, XElement xmlPushButton)
        {
            var script = xmlPushButton.Attribute("src").Value;       // e.g. "helloworld.py"
            var scriptName = Path.GetFileNameWithoutExtension(script);  // e.g. "helloworld"
            var pbName = "pb_" + scriptName;                            // e.g. "pb_helloworld  ("pb" stands for "PushButton")
            var className = "ec_" + scriptName;                         // e.g. "ec_helloworld" ("ec" stands for "ExternalCommand")
            var text = xmlPushButton.Attribute("text").Value;           // the user visible text on the button

            var result = new PushButtonData(pbName, text, addinAssembly.Location, className);

            if (IsValidPath(xmlPushButton.Attribute("largeImage")))
            {
                var largeImagePath = GetAbsolutePath(xmlPushButton.Attribute("largeImage").Value);
                result.LargeImage = BitmapDecoder.Create(File.OpenRead(largeImagePath), BitmapCreateOptions.None, BitmapCacheOption.None).Frames[0];
            }
            else
            {
                result.LargeImage = GetEmbeddedPng("RevitPythonShell.RpsRuntime.Resources.PythonScript32x32.png");
            }

            if (IsValidPath(xmlPushButton.Attribute("smallImage")))
            {
                var smallImagePath = GetAbsolutePath(xmlPushButton.Attribute("smallImage").Value);
                result.Image = BitmapDecoder.Create(File.OpenRead(smallImagePath), BitmapCreateOptions.None, BitmapCacheOption.None).Frames[0];
            }
            else
            {
                result.Image = GetEmbeddedPng("RevitPythonShell.RpsRuntime.Resources.PythonScript16x16.png");
            }

            return result;
        }
Ejemplo n.º 3
0
        void CreateRibbonPanel( 
            UIControlledApplication a)
        {
            Assembly exe = Assembly.GetExecutingAssembly();
              string path = exe.Location;

              string className = GetType().FullName.Replace(
            "App", "Command" );

              RibbonPanel p = a.CreateRibbonPanel(
            "DirectShape OBJ Loader" );

              PushButtonData d = new PushButtonData(
              "DirectObjLoader_Command",
              "DirectShape\r\nOBJ Loader",
              path, "DirectObjLoader.Command" );

              d.ToolTip = "Load a WaveFront OBJ model mesh "
            + "into a DirectShape Revit element";

              d.Image = NewBitmapImage( exe,
            "ImgDirectObjLoader16.png" );

              d.LargeImage = NewBitmapImage( exe,
            "ImgDirectObjLoader32.png" );

              d.LongDescription = d.ToolTip;

              d.SetContextualHelp( new ContextualHelp(
            ContextualHelpType.Url,
            Command.TroubleshootingUrl ) );

              p.AddItem( d );
        }
    public Result OnStartup(UIControlledApplication application)
    {
      // get the executing assembly
      System.Reflection.Assembly dotNetAssembly = 
        System.Reflection.Assembly.GetExecutingAssembly();

      // create the push button data for our command
      PushButtonData pbdWallOpeningArea = new PushButtonData(
        "ADNP_WALL_OPENING_AREA", "Wall Opening Area",
        dotNetAssembly.Location,
        "ADNPlugin.Revit.WallOpeningArea.ADNPCommand");
      pbdWallOpeningArea.LargeImage =
        LoadPNGImageFromResource(
        "ADNPlugin.Revit.WallOpeningArea.icon32.png");
      pbdWallOpeningArea.LongDescription =
        "This plugin can be used to calculate the sum of openings " +
        "on a wall that are smaller than a specified value.";

      // get PIOTM panel
      RibbonPanel piotmPanel = GetPIOTMPanel(application);

      // finally add the item
      piotmPanel.AddItem(pbdWallOpeningArea);

      return Result.Succeeded;
    }
Ejemplo n.º 5
0
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            String tabName = "Grimshaw";
            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Grimshaw Architects");

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

            #region Curve Total Length Button
            PushButtonData buttonData = new PushButtonData("cmdCurveTotalLength",
               "Total Length", thisAssemblyPath, "GrimshawRibbon.CurveTotalLength");
            PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;
            pushButton.ToolTip = "Select Multiple Lines to Obtain Total Length";
            // Add image icon to
            Uri uriImage = new Uri(@"D:\Stuff\RevitVisualStudio\CurveTotalLength\CurveTotalLength\bin\Debug\CurveTotalLength.png");
            BitmapImage largeImage = new BitmapImage(uriImage);
            pushButton.LargeImage = largeImage;
            #endregion // Curve Total Length Button

            #region Workset 3d View, Upper Case Views on Sheet and Delete Reference Planes Buttons
            // Create two push buttons
            // Project Management Commands
            PushButtonData pushButton1 = new PushButtonData("cmdWorkset3dView", "Make 3D View/Workset", thisAssemblyPath, "GrimshawRibbon.Workset3dView");
            pushButton1.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\Workset3dView\Workset3dView\bin\Debug\favicon.png"));
            pushButton1.ToolTip = "Create one 3D View per workset with all elemets on that workset isolated.";

            PushButtonData pushButton2 = new PushButtonData("cmdUpperCaseViewsOnSheets", "UpperCase Sheet Views", thisAssemblyPath, "GrimshawRibbon.UpperCaseViewsOnSheets");
            pushButton2.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\UpperCaseViewsOnSheets\UpperCaseViewsOnSheets\bin\Debug\UpperCaseViewsOnSheets.png"));
            pushButton2.ToolTip = "Rename all Views in the Project to 'uppercase' if its on a Sheet and 'lowercase' if its not on a Sheet.";

            PushButtonData pushButton3 = new PushButtonData("cmdDeleteReferencePlanes", "Delete Reference Planes", thisAssemblyPath, "GrimshawRibbon.DeleteReferencePlanes");
            pushButton3.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\DeleteReferencePlanes\DeleteReferencePlanes\bin\Debug\deleteReferencePlanes.png"));
            pushButton3.ToolTip = "Delete all unnamed reference planes in the project.";

            // Add the buttons to the panel
            List<RibbonItem> projectButtons = new List<RibbonItem>();
            projectButtons.AddRange(ribbonPanel.AddStackedItems(pushButton1, pushButton2, pushButton3));
            #endregion // Workset 3d View, Upper Case Views on Sheet and Delete Reference Planes Buttons

            #region Prevent Deletion Button
            PushButtonData preventDelButtonData = new PushButtonData("cmdPreventDeletion",
               "Prevent Deletion", thisAssemblyPath, "GrimshawRibbon.PreventDeletion");
            PushButton preventDelButton = ribbonPanel.AddItem(preventDelButtonData) as PushButton;
            preventDelButton.ToolTip = "Prevent elements from being deleted.";
            // Add image icon to
            Uri preventDelImage = new Uri(@"D:\Stuff\RevitVisualStudio\PreventDeletion\PreventDeletion\bin\Debug\preventDeletion.png");
            BitmapImage preventDellargeImage = new BitmapImage(preventDelImage);
            preventDelButton.LargeImage = preventDellargeImage;
            #endregion // Prevent Deletion Button
        }
Ejemplo n.º 6
0
 public void CreateView(RibbonPanel panel)
 {
     //This where we setup the command it's using in this case the HelloWorld.CS
     PushButtonData pushButtondataHello = new PushButtonData("CreateView", "Update View Data", assemblyloca, "Application.ProjectSetup");
     // This is how we add the button to our Panel
     PushButton pushButtonHello = panel.AddItem(pushButtondataHello) as PushButton;
     //This is how we add an Icon
     //Make sure you reference WindowsBase and PresentationCore, and import System.Windows.Media.Imaging namespace.
     pushButtonHello.LargeImage = new BitmapImage(new Uri(@"C:\Users\jay.dunn\AppData\Roaming\Autodesk\Revit\Addins\2014\Images\bulb.png"));
     //Add a tooltip
     pushButtonHello.ToolTip = "This tool Creates Views for all Levels in a Project";
 }
Ejemplo n.º 7
0
        public Result OnStartup(UIControlledApplication application)
        {
            RibbonPanel ribbonPanel = application.CreateRibbonPanel("NewRibbonPanel");

            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            PushButtonData buttonData = new PushButtonData("cmdViewCreator", "Project Startup", thisAssemblyPath, "ViewCreator");
            PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;

            Uri uriImage = new Uri(@"C:\Users\jay.dunn\Documents\Visual Studio 2013\Projects\ViewCreator - Copy\TLC.jpg");
            BitmapImage largeImage = new BitmapImage(uriImage);
            pushButton.LargeImage = largeImage;
        }
Ejemplo n.º 8
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);
 }
Ejemplo n.º 9
0
        public void updateDoor(RibbonPanel panel)
        {
            //This where we setup the command it's using in this case the HelloWorld.CS
            PushButtonData pushButtondataHello = new PushButtonData("updateDoor", "Update Door Data", assemblyloca, "Application.updateDoor");
            // This is how we add the button to our Panel
            PushButton pushButtonHello = panel.AddItem(pushButtondataHello) as PushButton;
            //This is how we add an Icon
            //Make sure you reference WindowsBase and PresentationCore, and import System.Windows.Media.Imaging namespace.
            pushButtonHello.LargeImage = new BitmapImage(new Uri(@"C:\Users\Gytaco\AppData\Roaming\Autodesk\Revit\Addins\2014\Images\image.png"));
            //Add a tooltip
            pushButtonHello.ToolTip = "This tool updates the doors to contain ToRoom data in the comments parameter";

            PushButtonData importTextbutton = new PushButtonData("importData", "Import Comments for Walls", assemblyloca, "Application.importData");
            PushButton importText = panel.AddItem(importTextbutton) as PushButton;
        }
Ejemplo n.º 10
0
        private void AddRibbonPanel(UIControlledApplication app)
        {
            RibbonPanel panel = app.CreateRibbonPanel("STF Exporter: v" + Assembly.GetExecutingAssembly().GetName().Version);

            PushButtonData pbd_STF = new PushButtonData("STFExport", "Export STF File", assyPath, "STFExporter.Command");
            PushButton pb_STFbutton = panel.AddItem(pbd_STF) as PushButton;
            pb_STFbutton.LargeImage = iconImage("STFExporter.icons.stfexport_32.png");
            pb_STFbutton.ToolTip = "Export Revit Spaces to STF File";
            pb_STFbutton.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_STFbutton.SetContextualHelp(contextHelp);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Add buttons for our three commands 
        /// to the ribbon panel.
        /// </summary>
        void PopulatePanel( RibbonPanel p )
        {
            string path = Assembly.GetExecutingAssembly()
            .Location;

              RibbonItemData i1 = new PushButtonData(
              "RvtVa3c_Command", "Va3c \r\n Export",
              path, "RvtVa3c.Command" );

              i1.ToolTip = "Export three.js JSON scene "
            + "for va3c AEC viewer";

              //p.AddStackedItems( i1, i2, i3 );

              p.AddItem( i1 );
        }
Ejemplo n.º 12
0
        private RibbonPanel CreateRibbonPanel(UIControlledApplication application)
        {
            // create a Ribbon panel which contains three stackable buttons and one single push button.
              string firstPanelName = "BIM Source";
              RibbonPanel ribbonPanel = application.CreateRibbonPanel(firstPanelName);

              //Create First button:
              PushButtonData pbDataAddParameterToFamily = new PushButtonData("AddParameterToFamily", "Bind Parameters \nTo Family",
              AddInPath, "BIMSource.SPWriter.Commands");
              PushButton pbAddParameterToFamily = ribbonPanel.AddItem(pbDataAddParameterToFamily) as PushButton;
              pbAddParameterToFamily.ToolTip = "Bind Shared Parameters From External File to Family";
              pbAddParameterToFamily.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "BIMSource.SPWriter.32.png"), UriKind.Absolute));
              pbAddParameterToFamily.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "BIMSource.SPWriter.16.png"), UriKind.Absolute));

              return ribbonPanel;
        }
Ejemplo n.º 13
0
        public Result OnStartup(UIControlledApplication application)
        {
            var rootPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\\Autodesk\\Revit\\Addins\\2012\\BIMXchangeTaco.bundle";
            var panel = application.CreateRibbonPanel("Taco");

            var pdata = new PushButtonData("Taco Pump Finder", "Taco Pump Finder",
                                           string.Format("{0}\\CDWKS.RevitAddon.Taco2012.dll", rootPath), "CDWKS.RevitAddon.Taco2012.Command");
            var btnBrowser = (PushButton) panel.AddItem(pdata);
            if (File.Exists(string.Format("{0}\\Library_32.png", rootPath)))
            {
                btnBrowser.LargeImage = new BitmapImage(new Uri(string.Format("{0}\\Library_32.png", rootPath)));
            }
            if (File.Exists(string.Format("{0}\\Library_16.png", rootPath)))
            {
                btnBrowser.Image = new BitmapImage(new Uri(rootPath + @"\Library_16.png"));
            }
            return Result.Succeeded;
        }
Ejemplo n.º 14
0
        public Result OnStartup(UIControlledApplication application)
        {
            var rootPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +  @"\\Autodesk\\Revit\\Addins\\2011\\BIMXchange.bundle";
            var version = application.ControlledApplication.VersionName;
            var panel = application.CreateRibbonPanel("ENGworks");

            var pdata = new PushButtonData("BIMXchange v4.0", "BIMXchange v4.0",
                                           rootPath + @"\CDWKS.RevitAddon.BXC2011.dll", "CDWKS.RevitAddon.BXC2011.Command");
            var btnBrowser = (PushButton) panel.AddItem(pdata);
            if (File.Exists(rootPath + @"\Library_32.png"))
            {
                btnBrowser.LargeImage = new BitmapImage(new Uri(rootPath + @"\Library_32.png"));
            }
            if (File.Exists(rootPath + @"\Library_16.png"))
            {
                btnBrowser.Image = new BitmapImage(new Uri(rootPath + @"\Library_16.png"));
            }
            return Result.Succeeded;
        }
Ejemplo n.º 15
0
        public Result OnStartup(UIControlledApplication application)
        {
            var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\\Autodesk\\Revit\\Addins\\2013\\BIMXchange.bundle";

            const string str = "CDWKS.RevitAddon.BXC2013.dll";
            var ribbonPanel = application.CreateRibbonPanel("ENGworks");
            var pushButtonDatum = new PushButtonData("BIMXchange v4.0", "BIMXchange v4.0", string.Format("{0}\\{1}",path,str),
                                                     "CDWKS.RevitAddon.BXC2013.Command");
            var ribbonItem = ribbonPanel.AddItem(pushButtonDatum);
            var pushButton = ribbonItem as PushButton;
            var contextHelp = new ContextualHelp(
                ContextualHelpType.ChmFile,
                path + @"\Contents\Resources\ENGworks.BIMXchange.htm");
            pushButton.SetContextualHelp(contextHelp);
            var str1 = path.Substring(0, path.Length - str.Length);
            var uri = new Uri(string.Concat(path, "\\Library_32.png"));
            pushButton.LargeImage = (new BitmapImage(uri));
            return Result.Succeeded;
        }
Ejemplo n.º 16
0
        private RibbonPanel CreateRibbonPanel(UIControlledApplication application)
        {
            // create a Ribbon panel which contains three stackable buttons and one single push button.
            string firstPanelName = "openRevit Add-Ins";
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(firstPanelName);

            //Create First button:
            PushButtonData pbDataParamToCSV = new PushButtonData("ParamToCSV", "Export Family \nParameters",
                AddInPath, "opnRvt.Parameters.ParamToCSV");
            PushButton pbParamToCSV = ribbonPanel.AddItem(pbDataParamToCSV) as PushButton;
            pbParamToCSV.ToolTip = "Export Family Parameters To CSV File";
            pbParamToCSV.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.export-excel-icon.png"), UriKind.Absolute));
            pbParamToCSV.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.export-excel-icon-s.png"), UriKind.Absolute));

            //Create Second button:
            PushButtonData pbDataAddParameterToFamily = new PushButtonData("AddParameterToFamily", "Bind Parameters \nTo Family",
                AddInPath, "opnRvt.Parameters.AddParameterToFamily");
            PushButton pbAddParameterToFamily = ribbonPanel.AddItem(pbDataAddParameterToFamily) as PushButton;
            pbAddParameterToFamily.ToolTip = "Bind Shared Parameters From External File to Family";
            pbAddParameterToFamily.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.table-import-icon.png"), UriKind.Absolute));
            pbAddParameterToFamily.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.table-import-icon-s.png"), UriKind.Absolute));

            ////Create Third button:
            //PushButtonData pbDataParamRecover = new PushButtonData("ParamRecover", "Recover Shared \nParameters",
            //    AddInPath, "opnRvt.Parameters.ParamRecover");
            //PushButton pbParamRecover = ribbonPanel.AddItem(pbDataParamRecover) as PushButton;
            //pbParamRecover.ToolTip = "Recover Shared Parameters To CSV File";
            //pbParamRecover.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.export-excel-icon.png"), UriKind.Absolute));
            //pbParamRecover.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.export-excel-icon-s.png"), UriKind.Absolute));

            ////Create Fourth button:
            //PushButtonData pbDataAddParameterToFamilies = new PushButtonData("AddParameterToFamilies", "Batch Process \nFolder",
            //    AddInPath, "opnRvt.Parameters.AddParameterToFamilies");
            //PushButton pbAddParameterToFamilies = ribbonPanel.AddItem(pbDataAddParameterToFamilies) as PushButton;
            //pbAddParameterToFamilies.ToolTip = "Batch Process an Entire Folder of Families";
            //pbAddParameterToFamilies.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.table-import-icon.png"), UriKind.Absolute));
            //pbAddParameterToFamilies.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "opnRvt.table-import-icon-s.png"), UriKind.Absolute));

            return ribbonPanel;
        }
Ejemplo n.º 17
0
        public Result OnStartup(UIControlledApplication a)
        {
            // Add a new ribbon panel
            RibbonPanel ribbonPanel = a.CreateRibbonPanel("Sheet Index Tools");

            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            string AddInPath = typeof(App).Assembly.Location;
            string AddFolder = Path.GetDirectoryName(AddInPath);
            string helpPath = AddFolder + "\\PrintIndexHelp.html";
            ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url,helpPath);

            PushButtonData button1Data = new PushButtonData("cmdPfI",
                "Print Index", thisAssemblyPath, "PrintIndex.Command");

            PushButton pushButton1 = ribbonPanel.AddItem(button1Data) as PushButton;
            pushButton1.ToolTip = "Click to select your sheet index and save as a printable set.";
            pushButton1.LargeImage = new BitmapImage(new Uri(Path.Combine(AddFolder, "PanelIconButton.bmp"),UriKind.Absolute));
            pushButton1.SetContextualHelp(contextHelp);

            return Result.Succeeded;
        }
Ejemplo n.º 18
0
        public Result OnStartup(
            UIControlledApplication a)
        {
            Assembly exe = Assembly.GetExecutingAssembly();
              string path = exe.Location;

              // Create ribbon panel

              RibbonPanel p = a.CreateRibbonPanel( Caption );

              // Create command button

              PushButtonData d = new PushButtonData(
            _name, _name, path,
            _namespace_prefix + _class_name );

              d.ToolTip = _tooltip;

              RibbonItem i = p.AddItem( d );

              return Result.Succeeded;
        }
 Result IExternalApplication.OnStartup(UIControlledApplication application)
 {
     try
      {
     string str = "STL Exporter";
     RibbonPanel panel = application.CreateRibbonPanel(str);
     string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     PushButtonData data = new PushButtonData("STL Exporter for Revit", "STL Exporter for Revit", directoryName + @"\STLExport.dll", "BIM.STLExport.STLExportCommand");
     PushButton button = panel.AddItem(data) as PushButton;
     button.LargeImage = LoadPNGImageFromResource("BIM.STLExport.Resources.STLExporter_32.png");
     button.ToolTip = "The STL Exporter for Revit is designed to produce a stereolithography file (STL) of your building model.";
     button.LongDescription = "The STL Exporter for the Autodesk Revit Platform is a proof-of-concept project designed to create an STL file from a 3D building information model, thereby enabling easier 3D printing.";
     ContextualHelp help = new ContextualHelp(ContextualHelpType.ChmFile, directoryName + @"\Resources\ADSKSTLExporterHelp.htm");
     button.SetContextualHelp(help);
     return Result.Succeeded;
      }
      catch (Exception exception)
      {
     MessageBox.Show(exception.ToString(), "STL Exporter for Revit");
     return Result.Failed;
      }
 }
Ejemplo n.º 20
0
		Result IExternalApplication.OnStartup(UIControlledApplication application)
		{
			//initialize AssemblyName using reflection
			FileLocations.AssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
			//initialize AddInDirectory. The addin should be stored in a directory named after the assembly
			FileLocations.AddInDirectory = application.ControlledApplication.AllUsersAddinsLocation + "\\" + FileLocations.AssemblyName + "\\";

			//load image resources
			BitmapImage largeIcon = GetEmbeddedImageResource("iconLarge.png");
			BitmapImage smallIcon = GetEmbeddedImageResource("iconSmall.png");

			PushButtonData getShotsCommandPushButtonData = new PushButtonData(
					"GetShotsButton", //name of the button
					"Drone Mission", //text on the button
					FileLocations.AddInDirectory + FileLocations.AssemblyName + ".dll",
					"RevitMyDrone.DroneBase.Commands.GetShotsCommand");
			getShotsCommandPushButtonData.LargeImage = largeIcon;

			RibbonPanel DroneBaseRibbonPanel = application.CreateRibbonPanel("Revit-My-Drone");
			DroneBaseRibbonPanel.AddItem(getShotsCommandPushButtonData);

			return Result.Succeeded;
		}
Ejemplo n.º 21
0
        // Both OnStartup and OnShutdown must be implemented as public method
        public Result OnStartup(UIControlledApplication application)
        {
            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel("Extract Beacons");

            // Create a push button in panel
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            PushButtonData buttonData = new PushButtonData("cmdYZFamily",
               "Extract Beacons", thisAssemblyPath, "ExtractXYZ.XYZFamily");

            PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;

            // Optionally, other properties may be assigned to the button
            // a) tool-tip
            pushButton.ToolTip = "Output the beacon's XYZ-coordinates into text file .";

            Uri uriImage = new Uri(@"pack://application:,,,/XYZFamily;component/Resources/cartesiancoordinates.png");

            BitmapImage largeImage = new BitmapImage(uriImage);
            pushButton.LargeImage = largeImage;

            return Result.Succeeded;
        }
Ejemplo n.º 22
0
        private void AddRibbonPanel(UIControlledApplication app)
        {
            RibbonPanel panel = app.CreateRibbonPanel("NWC View Exporter");
            PushButtonData pbd_Options = new PushButtonData("Export Options", "Export Options", assyPath, "NWCViewExporter.Options");
            PushButtonData pbd_Sub = new PushButtonData("Subscribe", "Auto NWC ON", assyPath, "NWCViewExporter.SubscribeToEvent");
            pbd_Sub.LargeImage = NewBitmapImage("sub.png");
            pbd_Sub.ToolTip = "Turn ON Automatic NWC file creation after each save.";
            pbd_Sub.LongDescription = "Automatically creates an NWC Navisworks file after each time the project is saved. The selected view in the options dialog is used as the exported view. The NWC file is saved in the directory specified in the options dialog.";
            PushButtonData pbd_Unsub = new PushButtonData("Unsubscribe", "Auto NWC OFF", assyPath, "NWCViewExporter.UnsubscribeFromEvent");
            pbd_Unsub.LargeImage = NewBitmapImage("unsub.png");
            pbd_Unsub.ToolTip = "Turn OFF Automatic NWC file creation.";
            pbd_Unsub.LongDescription = "Turns off the automatic NWC file creator.";

            PushButton pb_Options = panel.AddItem(pbd_Options) as PushButton;
            //pb_Options.LargeImage = NewBitmapImage("options.png");
            pb_Options.LargeImage = GetEmbeddedImage("NWCViewExporter.options.png");
            pb_Options.ToolTip = "Set Options for Automatic NWC Creation";
            pb_Options.LongDescription = "Sets the view to use for Automatic NWC creation on each save as well as the destination folder to save the NWC file.";

            panel.AddSeparator();
            IList<RibbonItem> stacked = panel.AddStackedItems(pbd_Sub, pbd_Unsub);

            //Context help
            ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.ChmFile, dir + "/Resources/help.htm");

            pb_Options.SetContextualHelp(contextHelp);

            foreach (RibbonItem ri in stacked)
            {
                ri.SetContextualHelp(contextHelp); //set contextHelp for stacked items;
                if (ri.Name == "Subscribe")
                    ri.Enabled = true;
                else
                    ri.Enabled = false;
            }
        }
Ejemplo n.º 23
0
        // define a method that will create our tab and button
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            String tabName = "Grimshaw";
            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Tools");

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

            // create push button for CurveTotalLength
            PushButtonData b1Data = new PushButtonData(
                "cmdCurveTotalLength", 
                "Total" + System.Environment.NewLine + "  Length  ", 
                thisAssemblyPath,
                "TotalLength.CurveTotalLength");

            PushButton pb1 = ribbonPanel.AddItem(b1Data) as PushButton;
            pb1.ToolTip = "Select Multiple Lines to Obtain Total Length";
            BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/GrimshawRibbon;component/Resources/totalLength.png"));
            pb1.LargeImage = pb1Image;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Create a custom ribbon panel and populate
        /// it with our commands, saving the resulting
        /// ribbon items for later access.
        /// </summary>
        static void AddRibbonPanel(
            UIControlledApplication a)
        {
            string[] tooltip = new string[] {
            "Upload selected sheets and categories to cloud.",
            "Upload selected rooms to cloud.",
            "Upload all rooms to cloud.",
            "Update furniture from the last cloud edit.",
            "Subscribe to or unsubscribe from updates.",
            "About " + Caption + ": ..."
              };

              string[] text = new string[] {
            "Upload Sheets",
            "Upload Rooms",
            "Upload All Rooms",
            "Update Furniture",
            "Subscribe",
            "About..."
              };

              string[] classNameStem = new string[] {
            "UploadSheets",
            "UploadRooms",
            "UploadAllRooms",
            "Update",
            "Subscribe",
            "About"
              };

              string[] iconName = new string[] {
            "2Up",
            "1Up",
            "2Up",
            "1Down",
            "ZigZagRed",
            "Question"
              };

              int n = classNameStem.Length;

              Debug.Assert( text.Length == n,
            "expected equal number of text and class name entries" );

              _buttons = new RibbonItem[n];

              RibbonPanel panel
            = a.CreateRibbonPanel( Caption );

              SplitButtonData splitBtnData
            = new SplitButtonData( Caption, Caption );

              SplitButton splitBtn = panel.AddItem(
            splitBtnData ) as SplitButton;

              Assembly asm = typeof( App ).Assembly;

              for( int i = 0; i < n; ++i )
              {
            PushButtonData d = new PushButtonData(
              classNameStem[i], text[i], _path,
              _namespace + "." + _cmd_prefix
              + classNameStem[i] );

            d.ToolTip = tooltip[i];

            d.Image = GetBitmapImage( asm,
              IconResourcePath( iconName[i], "16" ) );

            d.LargeImage = GetBitmapImage( asm,
              IconResourcePath( iconName[i], "32" ) );

            d.ToolTipImage = GetBitmapImage( asm,
              IconResourcePath( iconName[i], "" ) );

            _buttons[i] = splitBtn.AddPushButton( d );
              }
        }
Ejemplo n.º 25
0
        public Result OnStartup(UIControlledApplication application)
        {
            DotNet.Utilities.LogHelper.LogSearch();
            //string plugin_Revit_Family_Platform = GenDllPath + "SEPD.RevitFamilyManager.dll";
            string plugin_Revit_Family_Platform = Assembly.GetExecutingAssembly().Location;
            //string HelpPath = GenDllPath + "SepdHelper.dll";
            string HelpPath = Assembly.GetExecutingAssembly().Location;

            //MessageBox.Show(plugin_Revit_Family_Platform +"\n\n" +HelpPath);
            //-----------------------------------------------------------------------------------------------//
            //添加一个新的选项卡
            application.CreateRibbonTab("SEPD通用功能s");
            //添加新的信息交互ribbon面板

            RibbonPanel creatInfoFamilyPlatform = application.CreateRibbonPanel("SEPD通用功能s", "族库管理");
            RibbonPanel creatInfoFamilyBatch    = application.CreateRibbonPanel("SEPD通用功能s", "批量工具");
            //RibbonPanel creatInfoTransformer = application.CreateRibbonPanel("SEPD通用功能", "信息交互");
            RibbonPanel creatInfoTransformerHelp = application.CreateRibbonPanel("SEPD通用功能s", "快速帮助");

            //----------------------------------------------------------------------------------------------//
            #region 创建一个为族库上传平台的按钮
            PushButtonData CreateRevitManagerUploadData   = new PushButtonData("1", "族库上传管理", plugin_Revit_Family_Platform, "SEPD.RevitFamilyManager.RevitFamilyManagerMainUB");
            PushButton     CreateRevitManagerUploadButton = creatInfoFamilyPlatform.AddItem(CreateRevitManagerUploadData) as PushButton;
            //CreateRevitManagerUploadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            CreateRevitManagerUploadButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.族管理上传ICO);
            //creatInfoFamilyPlatform.AddItem(CreateRevitManagerUploadData);
            //creatInfoFamilyPlatform.AddSeparator();
            CreateRevitManagerUploadButton.ToolTip         = "族库上传管理";
            CreateRevitManagerUploadButton.LongDescription = "进入族库上传平台";
            #endregion
            //----------------------------------------------------------------------------------------------//
            #region 创建一个为族库下载平台的按钮
            PushButtonData CreateRevitManagerDownloadData   = new PushButtonData("2", "族库下载管理", plugin_Revit_Family_Platform, "SEPD.RevitFamilyManager.RevitFamilyManagerMainDB");
            PushButton     CreateRevitManagerDownloadButton = creatInfoFamilyPlatform.AddItem(CreateRevitManagerDownloadData) as PushButton;
            //CreateRevitManagerDownloadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            CreateRevitManagerDownloadButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.族管理下载ICO);
            //creatInfoFamilyPlatform.AddItem(CreateRevitManagerDownloadData);
            //creatInfoFamilyPlatform.AddSeparator();
            CreateRevitManagerDownloadButton.ToolTip         = "族库下载管理";
            CreateRevitManagerDownloadButton.LongDescription = "进入族库下载平台";
            #endregion
            //-----------------------------------------------------------------------------------------------//
            #region 创建一个为族库删改管理平台的按钮
            PushButtonData CreateRevitManagerRfaInfoChange       = new PushButtonData("3", "族库删改管理", plugin_Revit_Family_Platform, "SEPD.RevitFamilyManager.RevitFamilyManagerMainMB");
            PushButton     CreateRevitManagerRfaInfoChangeButton = creatInfoFamilyPlatform.AddItem(CreateRevitManagerRfaInfoChange) as PushButton;
            //CreateRevitManagerUploadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            //CreateRevitManagerDownloadButton.LargeImage = new BitmapImage(new Uri(str + "\\SepdBuliding\\ICONpm" + "\\ICON-RevitFamilyBacthAlter.png", UriKind.RelativeOrAbsolute));
            //CreateRevitManagerBatchChangeButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.族管理上传ICO);
            CreateRevitManagerRfaInfoChangeButton.LargeImage      = Func.ChangeBitmapToImageSource(Resource1.族库删改管理);
            CreateRevitManagerRfaInfoChangeButton.ToolTip         = "实例图元属性批量修改";
            CreateRevitManagerRfaInfoChangeButton.LongDescription = "实例图元属性从excel批量修改";
            #endregion
            //-----------------------------------------------------------------------------------------------//
            #region 创建一个为族库批量上传平台的按钮
            //PushButtonData CreateRevitManagerBatchUploadData = new PushButtonData("3", "族库批量上传", plugin_Revit_Family_Platform, "SEPD.RevitFamilyManager.RevitFamilyManagerMainULS");
            //PushButton CreateRevitManagerBatchUploadButton = creatInfoFamilyBatch.AddItem(CreateRevitManagerBatchUploadData) as PushButton;
            ////CreateRevitManagerUploadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            //CreateRevitManagerBatchUploadButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.族批量上传);
            ////creatInfoFamilyPlatform.AddItem(CreateRevitManagerUploadData);
            ////creatInfoFamilyPlatform.AddSeparator();
            //CreateRevitManagerBatchUploadButton.ToolTip = "族库批量上传";
            //CreateRevitManagerBatchUploadButton.LongDescription = "进入族库批量上传平台";
            #endregion
            //----------------------------------------------------------------------------------------------//
            #region 创建一个为属性批量提取的按钮
            PushButtonData CreateRevitManagerBatchGrub       = new PushButtonData("4", "属性批量提取", plugin_Revit_Family_Platform, "SEPD.RevitFamilyManager.RevitFamilyManagerMainIO");
            PushButton     CreateRevitManagerBatchGrubButton = creatInfoFamilyBatch.AddItem(CreateRevitManagerBatchGrub) as PushButton;
            //CreateRevitManagerUploadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            CreateRevitManagerBatchGrubButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.族属性批量提取);
            //creatInfoFamilyPlatform.AddItem(CreateRevitManagerUploadData);
            //creatInfoFamilyPlatform.AddSeparator();
            CreateRevitManagerBatchGrubButton.ToolTip         = "属性批量提取";
            CreateRevitManagerBatchGrubButton.LongDescription = "从rfa文件中进行属性批量提取生产excel表格";
            #endregion
            //----------------------------------------------------------------------------------------------//
            #region 创建一个为属性批量修改的按钮
            PushButtonData CreateRevitManagerBatchChange       = new PushButtonData("5", "属性批量修改", plugin_Revit_Family_Platform, "SEPD.RevitFamilyManager.RevitFamilyManagerMainEP");
            PushButton     CreateRevitManagerBatchChangeButton = creatInfoFamilyBatch.AddItem(CreateRevitManagerBatchChange) as PushButton;
            //CreateRevitManagerUploadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            CreateRevitManagerBatchChangeButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.属性批量修改);
            //creatInfoFamilyPlatform.AddItem(CreateRevitManagerUploadData);
            //creatInfoFamilyPlatform.AddSeparator();
            CreateRevitManagerBatchChangeButton.ToolTip         = "实例图元属性批量修改";
            CreateRevitManagerBatchChangeButton.LongDescription = "实例图元属性从excel批量修改";
            #endregion
            //----------------------------------------------------------------------------------------------//

            #region 创建一个IFC文件批量打开保存的按钮
            PushButtonData CreateIFCtoRVT       = new PushButtonData("7", "IFC批量转换", plugin_Revit_Family_Platform, "SEPD.IFCtoRVT.IFCtoRVTMain");
            PushButton     CreateIFCtoRVTButton = creatInfoFamilyBatch.AddItem(CreateIFCtoRVT) as PushButton;
            //CreateRevitManagerUploadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            //CreateRevitManagerDownloadButton.LargeImage = new BitmapImage(new Uri(str + "\\SepdBuliding\\ICONpm" + "\\ICON-RevitFamilyBacthAlter.png", UriKind.RelativeOrAbsolute));
            //CreateRevitManagerBatchChangeButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.族管理上传ICO);
            CreateIFCtoRVTButton.LargeImage      = Func.ChangeBitmapToImageSource(Resource1.IFC文件转RVT文件);
            CreateIFCtoRVTButton.ToolTip         = "IFC文件转RVT文件";
            CreateIFCtoRVTButton.LongDescription = "IFC文件转RVT文件";
            #endregion
            //-----------------------------------------------------------------------------------------------//
            #region 创建一个参数统计的按钮
            PushButtonData CreateSuperCount       = new PushButtonData("8", "参数统计", plugin_Revit_Family_Platform, "SEPD.RevitFamilyManager.RevitFamilyManagerMainSTC");
            PushButton     CreateSuperCountButton = creatInfoFamilyBatch.AddItem(CreateSuperCount) as PushButton;
            //CreateRevitManagerUploadButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\ICON-RevitFamilyPlatform.png"));
            //CreateRevitManagerDownloadButton.LargeImage = new BitmapImage(new Uri(str + "\\SepdBuliding\\ICONpm" + "\\ICON-RevitFamilyBacthAlter.png", UriKind.RelativeOrAbsolute));
            //CreateRevitManagerBatchChangeButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.族管理上传ICO);
            CreateSuperCountButton.LargeImage      = Func.ChangeBitmapToImageSource(Resource1.参数统计);
            CreateSuperCountButton.ToolTip         = "参数统计";
            CreateSuperCountButton.LongDescription = "参数统计";
            #endregion
            //-----------------------------------------------------------------------------------------------//
            #region 创建一个为帮助的按钮
            PushButtonData CreatHelpData   = new PushButtonData("1", "帮助", HelpPath, "SepdHelper.Helper");
            PushButton     CreatHelpButton = creatInfoTransformerHelp.AddItem(CreatHelpData) as PushButton;
            //CreatHelpButton.LargeImage = new BitmapImage(new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2016\SepdBuliding\ICONpm\帮助说明文档.png", UriKind.RelativeOrAbsolute));
            CreatHelpButton.LargeImage = Func.ChangeBitmapToImageSource(Resource1.帮助说明文档);
            //creatInfoTransformerHelp.AddItem(CreatHelpData);
            //creatInfoTransformerHelp.AddSeparator();
            CreatHelpButton.ToolTip         = "帮助";
            CreatHelpButton.LongDescription = "点击按钮进行帮助查看";
            #endregion

            return(Result.Succeeded);
        }
Ejemplo n.º 26
0
 public void SetCommonAttribute(ref PushButtonData pbd, string largeImageuri, string toolTip, string longDescription)
 {
     pbd.LargeImage      = new BitmapImage(new Uri(largeImageuri));
     pbd.ToolTip         = toolTip;
     pbd.LongDescription = longDescription;
 }
Ejemplo n.º 27
0
        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);
        }
Ejemplo n.º 28
0
        public Result OnStartup(UIControlledApplication application)
        {
            uiCtrlApp = application;
            try
            {
                #region initial setup
                // retrieve assembly path
                string assemblyPath = Assembly.GetExecutingAssembly().Location;

                // create the ribbon tab
                string tabName = "PE Revit Tools";
                application.CreateRibbonTab(tabName);

                // create the DT panel
                string      dtPanelName = "DT Tools";
                RibbonPanel dtPanel     = application.CreateRibbonPanel(tabName, dtPanelName);

                //create the DU panel
                string      duPanelName = "DU Tools";
                RibbonPanel duPanel     = application.CreateRibbonPanel(tabName, duPanelName);
                #endregion

                #region DT panel
                // button 1 image
                BitmapImage modelMetricsImg = new BitmapImage(new Uri("pack://application:,,,/PERevitTab;component/Assets/Images/modelMetricsBtn.png")); // add the uri

                // button 2 image
                BitmapImage createWorksetsImg = new BitmapImage(new Uri("pack://application:,,,/PERevitTab;component/Assets/Images/worksetCreatorBtn.png")); // add the uri

                // button 3 image
                BitmapImage UDPInterfaceImg = new BitmapImage(new Uri("pack://application:,,,/PERevitTab;component/Assets/Images/worksetCreatorBtn.png")); // add the uri

                // button 1
                PushButtonData modelMetricsData = new PushButtonData("Model Metrics", "Run \n" + "Model Metrics", assemblyPath, "PERevitTab.Commands.DT.ModelMetrics");
                PushButton     modelMetrics     = dtPanel.AddItem(modelMetricsData) as PushButton;
                modelMetrics.LargeImage = modelMetricsImg;
                modelMetrics.ToolTip    = "Collects model metrics";

                // button 2
                PushButtonData createWorksetsData = new PushButtonData("Create Worksets", "Create \n" + "Worksets", assemblyPath, "PERevitTab.Commands.DT.CreateWorksets");
                PushButton     createWorksets     = dtPanel.AddItem(createWorksetsData) as PushButton;
                createWorksets.LargeImage = createWorksetsImg;
                createWorksets.ToolTip    = "Creates worksets";

                // button 3
                PushButtonData UDPInterfaceData = new PushButtonData("Connect to Sharepoint", "Connect \n" + "to Sharepoint", assemblyPath, "PERevitTab.Commands.DT.UDPLauncher");
                PushButton     UDPInterface     = dtPanel.AddItem(UDPInterfaceData) as PushButton;
                UDPInterface.LargeImage = UDPInterfaceImg;
                UDPInterface.ToolTip    = "Connect to Sharepoint";

                #endregion

                #region DU panel
                // TODO add logging to keep track of how many times each button is used
                // button 1 image
                BitmapImage runDynamo1Img = new BitmapImage(new Uri("pack://application:,,,/PERevitTab;component/Assets/Images/duBtn.png")); // add the uri

                // button 2 image
                BitmapImage runDynamo2Img = new BitmapImage(new Uri("pack://application:,,,/PERevitTab;component/Assets/Images/duBtn.png")); // add the uri

                // button 3 image
                BitmapImage runDynamo3Img = new BitmapImage(new Uri("pack://application:,,,/PERevitTab;component/Assets/Images/duBtn.png")); // add the uri

                // button 4 image
                BitmapImage runDynamo4Img = new BitmapImage(new Uri("pack://application:,,,/PERevitTab;component/Assets/Images/duBtn.png")); // add the uri

                // button 1
                PushButtonData runDynamo1Data = new PushButtonData("Renumber Views", "Renumber \n" + "Views on Sheets", assemblyPath, "PERevitTab.Commands.DU.RunDynamo1");
                PushButton     runDynamo1     = duPanel.AddItem(runDynamo1Data) as PushButton;
                runDynamo1.LargeImage = runDynamo1Img;
                runDynamo1.ToolTip    = "Renumbers viewports on multiple sheets. The bottom left corners of Viewports within an inch in height are counted as a row. Numbers start from the bottom and goes right to left.";

                // button 2
                PushButtonData runDynamo2Data = new PushButtonData("Align Views", "Align \n" + "Views", assemblyPath, "PERevitTab.Commands.DU.RunDynamo2");
                PushButton     runDynamo2     = duPanel.AddItem(runDynamo2Data) as PushButton;
                runDynamo2.LargeImage = runDynamo2Img;
                runDynamo2.ToolTip    = "Aligns Views on multiple sheets to the location of the referenced view. Choose whether to align by the corner or the center of the views.";

                //button 3
                PushButtonData runDynamo3Data = new PushButtonData("Add Views to Sheets", "Add Views to \n" + "Sheets - Selection", assemblyPath, "PERevitTab.Commands.DU.RunDynamo3");
                PushButton     runDynamo3     = duPanel.AddItem(runDynamo3Data) as PushButton;
                runDynamo3.LargeImage = runDynamo3Img;
                runDynamo3.ToolTip    = "Choose a Sheet, then select view references (elevation and section tags, callouts) to be added to the sheet.";

                //button 4
                PushButtonData runDynamo4Data = new PushButtonData("Add Views to Sheets2", "Add Views to \n" + "Sheets - Selection", assemblyPath, "PERevitTab.Commands.DU.RunDynamo4");
                PushButton     runDynamo4     = duPanel.AddItem(runDynamo4Data) as PushButton;
                runDynamo4.LargeImage = runDynamo4Img;
                runDynamo4.ToolTip    = "Choose a Sheet, then select view references (elevation and section tags, callouts) to be added to the sheet.";
                #endregion

                #region idling event
                uiCtrlApp.Idling += OnIdling;
                #endregion
            }
            catch (Exception err)
            {
                // TODO: add better error handling
                TaskDialog.Show("Error", err.Message.ToString());
            }
            return(Result.Succeeded);
        }
Ejemplo n.º 29
0
        public Result OnStartup(UIControlledApplication a)
        {
            #region Tab
            try
            {
                a.CreateRibbonTab(AR_RIBBON_TAB);
            }
            catch (Exception) { }
            List <RibbonPanel> panels = a.GetRibbonPanels(AR_RIBBON_TAB);
            #endregion
            #region Panel Системы
            //Создание панели
            RibbonPanel panelSys = null;
            foreach (RibbonPanel pnl in panels)
            {
                if (pnl.Name == AR_RIBBON_PANEL_SYSTEMS)
                {
                    panelSys = pnl;
                    break;
                }
            }
            if (panelSys == null)
            {
                panelSys = a.CreateRibbonPanel(AR_RIBBON_TAB, AR_RIBBON_PANEL_SYSTEMS);
            }

            //Кнопка "Назначение параметра СЭ_Имя системы"
            {
                PushButtonData btnCommandSetSENameSysData = new PushButtonData(
                    "СЭ_Имя системы",
                    "СЭ_Имя системы",
                    Assembly.GetExecutingAssembly().Location,
                    "StroyExp.CommandSetSENameSys"
                    )
                {
                    ToolTip         = "Назначение параметра СЭ_Имя системы",
                    LongDescription = @"Задает значение для параметра ""СЭ_Имя системы"" в соответствии с параметром ""Описание"" типа инженерной системы",
                };
                PushButton btnCommandSetSENameSys    = panelSys.AddItem(btnCommandSetSENameSysData) as PushButton;
                Image      btnCommandSetSENameSysImg = Properties.Resources.SetParam;
                btnCommandSetSENameSys.LargeImage = Convert(btnCommandSetSENameSysImg); //new BitmapImage(new Uri(@"/Resources/Icons/SetParam.png"));
                btnCommandSetSENameSys.Enabled    = true;
            }
            #endregion
            #region Panel Архитектура
            RibbonPanel panelArch = null;
            foreach (RibbonPanel pnl in panels)
            {
                if (pnl.Name == AR_RIBBON_PANEL_ARCHITECTURE)
                {
                    panelArch = pnl;
                    break;
                }
            }
            if (panelArch == null)
            {
                panelArch = a.CreateRibbonPanel(AR_RIBBON_PANEL_ARCHITECTURE);
            }

            //Кнопка "Отделка"
            {
                PushButtonData btnDataSetWallFinishRoomParams = new PushButtonData(
                    "Отделка",
                    "Отделка",
                    Assembly.GetExecutingAssembly().Location,
                    "SetWallFinishRoomParams.Command"
                    )
                {
                    ToolTip         = "Назначение параметров отделки",
                    LongDescription = @"",
                };
                PushButton btnSetWallFinishRoomParams    = panelArch.AddItem(btnDataSetWallFinishRoomParams) as PushButton;
                Image      btnSetWallFinishRoomParamsImg = Properties.Resources.SetParam;
                btnCommandSetSENameSys.LargeImage = Convert(btnCommandSetSENameSysImg); //new BitmapImage(new Uri(@"/Resources/Icons/SetParam.png"));
                btnCommandSetSENameSys.Enabled    = true;
            }
            #endregion
            return(Result.Succeeded);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Add a button to a Ribbon Tab
        /// </summary>
        /// <param name="Rpanel">The name of the ribbon panel</param>
        /// <param name="ButtonName">The Name of the Button</param>
        /// <param name="ButtonText">Command Text</param>
        /// <param name="ImagePath16">Small Image</param>
        /// <param name="ImagePath32">Large Image</param>
        /// <param name="dllPath">Path to the DLL file</param>
        /// <param name="dllClass">Full qualified class descriptor</param>
        /// <param name="Tooltip">Tooltip to add to the button</param>
        /// <returns></returns>
        /// <remarks></remarks>
        private bool AddButton(string Rpanel,
                               string ButtonName,
                               string ButtonText,
                               string ImagePath16,
                               string ImagePath32,
          string dllPath,
          string dllClass, string Tooltip)
        {
            try
            {
                // The Ribbon Panel
                RibbonPanel m_RibbonPanel = null;

                // Find the Panel within the Case Tab
                List<RibbonPanel> m_RP = new List<RibbonPanel>();
                m_RP = m_uiApp.GetRibbonPanels("Case Design Inc.");
                foreach (RibbonPanel x in m_RP)
                {
                    if (x.Name.ToUpper() == Rpanel.ToUpper())
                    {
                        m_RibbonPanel = x;
                    }
                }

                // Create the Panel if it doesn't Exist
                if (m_RibbonPanel == null)
                {
                    m_RibbonPanel = m_uiApp.CreateRibbonPanel("Case Design Inc.", Rpanel);
                }

                // Create the Pushbutton Data
                PushButtonData m_PushButtonData = new PushButtonData(ButtonName, ButtonText, dllPath, dllClass);
                if (!string.IsNullOrEmpty(ImagePath16))
                {
                    try
                    {
                        m_PushButtonData.Image = LoadPngImgSource(ImagePath16);
                    }
                    catch
                    {
                    }
                }
                if (!string.IsNullOrEmpty(ImagePath32))
                {
                    try
                    {
                        m_PushButtonData.LargeImage = LoadPngImgSource(ImagePath32);
                    }
                    catch
                    {
                    }
                }
                m_PushButtonData.ToolTip = Tooltip;

                // Add the button to the tab
                m_RibbonPanel.AddItem(m_PushButtonData);

            }
            catch
            {
            }

            return true;
        }
Ejemplo n.º 31
0
        private void AddMenu(UIControlledApplication application)
        {
            RibbonPanel rvtRibbonPanel = application.CreateRibbonPanel("MyRevitAddins");

            //ConnectConnectors
            PushButtonData data = new PushButtonData("ConnectConnectors", "Cons", ExecutingAssemblyPath,
                                                     "MyRibbonPanel.ConnectConnectors");

            data.ToolTip =
                @"Zero elements selected -> Connect ALL unconnected connectors

One element selected -> Connect the element to adjacent
                        elements

One element selected + CTRL -> Disconnect the element

One element selected + SHIFT -> Connect a special pipe accessory
                                support if placed at connection

Two elements selected -> If disconnected - connect
                         If connected - disconnect

More than two elements selected + CTRL
                         -> Disconnect all selected elements";
            data.Image      = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgConnectConnectors16.png");
            data.LargeImage = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgConnectConnectors32.png");
            PushButton connectCons = rvtRibbonPanel.AddItem(data) as PushButton;

            //PipeInsulationVisibility
            data            = new PushButtonData("PipeInsulationVisibility", "Visible", ExecutingAssemblyPath, "MyRibbonPanel.PipeInsulationVisibility");
            data.ToolTip    = "Toggle visibility of pipe insulation in current view.";
            data.Image      = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPipeInsulationVisibility16.png");
            data.LargeImage = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPipeInsulationVisibility32.png");
            PushButton pipeInsulationVisibility = rvtRibbonPanel.AddItem(data) as PushButton;

            //PlaceSupports
            data            = new PushButtonData("PlaceSupports", "Supports", ExecutingAssemblyPath, "MyRibbonPanel.PlaceSupports");
            data.ToolTip    = myRibbonPanelToolTip;
            data.Image      = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPlaceSupport16.png");
            data.LargeImage = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPlaceSupport32.png");
            PushButton placeSupports = rvtRibbonPanel.AddItem(data) as PushButton;

            //PED
            data            = new PushButtonData("PED", "PED", ExecutingAssemblyPath, "MyRibbonPanel.PEDclass");
            data.ToolTip    = "LMB: Append PED data.\nCtrl+LMB: Overwrite PED data.";
            data.Image      = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPED16.png");
            data.LargeImage = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPED32.png");
            PushButton PED = rvtRibbonPanel.AddItem(data) as PushButton;

            //MEPUtils
            data            = new PushButtonData("MEPUtils", "MEP", ExecutingAssemblyPath, "MyRibbonPanel.MEPUtilsCaller");
            data.ToolTip    = myRibbonPanelToolTip;
            data.Image      = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgMEPUtils16.png");
            data.LargeImage = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgMEPUtils32.png");
            PushButton MEPUtils = rvtRibbonPanel.AddItem(data) as PushButton;

            //PDFExporter
            data            = new PushButtonData("PDFExport", "PDF", ExecutingAssemblyPath, "MyRibbonPanel.PDFExport");
            data.ToolTip    = "Exports selected sheet set to PDF.\nRequires BlueBeam";
            data.Image      = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPDF16.png");
            data.LargeImage = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgPDF32.png");
            PushButton PDFExporter = rvtRibbonPanel.AddItem(data) as PushButton;

            //PED
            data            = new PushButtonData("Mark", "Mark", ExecutingAssemblyPath, "MyRibbonPanel.SetMarkCaller");
            data.ToolTip    = "Sets the mark of selected element(s).";
            data.Image      = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgSetMark16.png");
            data.LargeImage = NewBitmapImage(exe, "MyRibbonPanel.Resources.ImgSetMark32.png");
            PushButton SetMark = rvtRibbonPanel.AddItem(data) as PushButton;
        }
        /// <summary>
        /// Add the button to Revit UI for an external command.
        /// </summary>
        /// <param name="uic_app">A handle to the application
        /// being started.</param>
        /// <param name="cmd_type">The command type. It must to
        /// implement the IExternalCommand interface.</param>
        /// <param name="default_resources_type">The type which
        /// contains the default values of necessary resources.
        /// </param>
        public static void AddButton(
            UIControlledApplication uic_app, Type cmd_type,
            Type default_resources_type)
        {
            if (uic_app == null)
            {
                throw new ArgumentNullException(nameof(uic_app)
                                                );
            }

            if (cmd_type == null)
            {
                throw new ArgumentNullException(nameof(
                                                    cmd_type));
            }

            if (cmd_type.GetInterface(typeof(IExternalCommand)
                                      .FullName) == null)
            {
                throw new ArgumentException(nameof(cmd_type));
            }

            if (default_resources_type == null)
            {
                throw new ArgumentNullException(nameof(
                                                    default_resources_type));
            }

            // The target ribbon tab name.
            string tab_name = GetResourceString(cmd_type,
                                                default_resources_type, ResourceKeyNames
                                                .RibbonTabName);

            try {
                /* Through the using of the tabs_dict
                 * dictionary I try to minimize the exceptions
                 * count. */
                if (!tabs_dict.ContainsKey(tab_name))
                {
                    uic_app.CreateRibbonTab(tab_name);
                    tabs_dict.Add(tab_name, tab_name);
                }
            }
            catch { }

            // The target ribbon panel name
            string panel_name = GetResourceString(cmd_type,
                                                  default_resources_type, ResourceKeyNames
                                                  .RibbonPanelName);

            RibbonPanel panel = uic_app.GetRibbonPanels(
                tab_name).FirstOrDefault(
                n => n.Name.Equals(panel_name, StringComparison
                                   .InvariantCulture));

            if (panel == null)
            {
                panel = uic_app.CreateRibbonPanel(tab_name,
                                                  panel_name);
            }

            string this_assembly_path = Assembly
                                        .GetExecutingAssembly().Location;

            // Get localized help file name
            string help_file = Path.Combine(Path
                                            .GetDirectoryName(this_assembly_path),
                                            GetResourceString(cmd_type,
                                                              default_resources_type, ResourceKeyNames
                                                              .HelpFileName));

            ContextualHelp help = new ContextualHelp(
                ContextualHelpType.ChmFile, help_file);

            // Help topic id (inside of help file).
            help.HelpTopicUrl = GetResourceString(cmd_type,
                                                  default_resources_type, ResourceKeyNames
                                                  .HelpTopicId);

            string cmd_name = cmd_type.Name;

            string cmd_text = GetResourceString(cmd_type,
                                                default_resources_type, ResourceKeyNames
                                                .ButtonCaption);

            string cmd_tooltip = GetResourceString(cmd_type,
                                                   default_resources_type, ResourceKeyNames
                                                   .ButtonTooltipText);

            string long_description = GetResourceString(
                cmd_type, default_resources_type,
                ResourceKeyNames.ButtonLongDescription);

            PushButtonData button_data = new PushButtonData(
                cmd_name, cmd_text,
                this_assembly_path, cmd_type.FullName);

            // Get corresponding class name which implements
            // the IExternalCommandAvailability interface
            var aviability_type = GetResourceString(cmd_type,
                                                    default_resources_type, ResourceKeyNames
                                                    .CommandAvailabilityType);

            var av_type = Type.GetType(aviability_type);

            if (av_type != null && av_type.GetInterface(typeof(
                                                            IExternalCommandAvailability).FullName)
                != null)
            {
                button_data.AvailabilityClassName = av_type
                                                    .FullName;
            }

            PushButton push_button = panel.AddItem(
                button_data) as PushButton;

            push_button.ToolTip = cmd_tooltip;

            BitmapSource btn_src_img = GetResourceImage(
                cmd_type, default_resources_type,
                ResourceKeyNames.ButtonImage);

            push_button.LargeImage = btn_src_img;

            BitmapSource ttp_bitmap_src = GetResourceImage(
                cmd_type, default_resources_type,
                ResourceKeyNames.ButtonTooltipImage);

            push_button.ToolTipImage    = ttp_bitmap_src;
            push_button.LongDescription = long_description;
            push_button.SetContextualHelp(help);
        }
Ejemplo n.º 33
0
        void CreateRibbonItems(UIControlledApplication a)
        {
            // get the path of our dll
            string addInPath = GetType().Assembly.Location;
            string imgDir    = FindFolderInParents(Path.GetDirectoryName(addInPath), "Images");

            const string panelName = "Lab 6 Panel";

            const string cmd1     = "XtraCs.Lab1_1_HelloWorld";
            const string name1    = "HelloWorld";
            const string text1    = "Hello World";
            const string tooltip1 = "Run Lab1_1_HelloWorld command";
            const string img1     = "ImgHelloWorld.png";
            const string img31    = "ImgHelloWorldSmall.png";

            const string cmd2     = "XtraCs.Lab1_2_CommandArguments";
            const string name2    = "CommandArguments";
            const string text2    = "Command Arguments";
            const string tooltip2 = "Run Lab1_2_CommandArguments command";
            const string img2     = "ImgCommandArguments.png";
            const string img32    = "ImgCommandArgumentsSmall.png";

            const string name3    = "Lab1Commands";
            const string text3    = "Lab 1 Commands";
            const string tooltip3 = "Run a Lab 1 command";
            const string img33    = "ImgCommandSmall.png";

            // create a Ribbon Panel

            RibbonPanel panel = a.CreateRibbonPanel(panelName);

            // add a button for Lab1's Hello World command

            PushButtonData pbd = new PushButtonData(name1, text1, addInPath, cmd1);
            PushButton     pb1 = panel.AddItem(pbd) as PushButton;

            pb1.ToolTip    = tooltip1;
            pb1.LargeImage = new BitmapImage(new Uri(Path.Combine(imgDir, img1)));

            // add a vertical separation line in the panel
            panel.AddSeparator();

            // prepare data for creating stackable buttons
            PushButtonData pbd1 = new PushButtonData(name1 + " 2", text1, addInPath, cmd1);

            pbd1.ToolTip = tooltip1;
            pbd1.Image   = new BitmapImage(new Uri(Path.Combine(imgDir, img31)));

            PushButtonData pbd2 = new PushButtonData(name2, text2, addInPath, cmd2);

            pbd2.ToolTip = tooltip2;
            pbd2.Image   = new BitmapImage(new Uri(Path.Combine(imgDir, img32)));

            PulldownButtonData pbd3 = new PulldownButtonData(name3, text3);

            pbd3.ToolTip = tooltip3;
            pbd3.Image   = new BitmapImage(new Uri(Path.Combine(imgDir, img33)));

            // add stackable buttons
            IList <RibbonItem> ribbonItems = panel.AddStackedItems(pbd1, pbd2, pbd3);

            // add two push buttons as sub-items of the Lab 1 commands
            PulldownButton pb3 = ribbonItems[2] as PulldownButton;

            pbd = new PushButtonData(name1, text1, addInPath, cmd1);
            PushButton pb3_1 = pb3.AddPushButton(pbd);

            pb3_1.ToolTip    = tooltip1;
            pb3_1.LargeImage = new BitmapImage(new Uri(Path.Combine(imgDir, img1)));

            pbd = new PushButtonData(name2, text2, addInPath, cmd2);
            PushButton pb3_2 = pb3.AddPushButton(pbd);

            pb3_2.ToolTip    = tooltip2;
            pb3_2.LargeImage = new BitmapImage(new Uri(Path.Combine(imgDir, img2)));
        }
Ejemplo n.º 34
0
        public Result OnStartup(UIControlledApplication application)
        {
            #region//Application info
            string tabName          = "BimBuildings";
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            string website          = "www.bimbuildings.nl";
            #endregion

            #region//Create RibbonTab Bimbuildings
            application.CreateRibbonTab(tabName);

            #region//Create RibbonPanel Test
            RibbonPanel test = application.CreateRibbonPanel(tabName, "Test");

            #region//Create PushButtonData
            PushButtonData HelloWorld = new PushButtonData("Test", "Test", thisAssemblyPath, "BimBuildings.ViewsOnSheets");
            #endregion

            #region//Create Buttons
            test.AddItem(HelloWorld);
            #endregion
            #endregion

            #region//Create RibbonPanel Dimensions
            RibbonPanel dimensions = application.CreateRibbonPanel(tabName, "Dimensions");
            RibbonPanel export     = application.CreateRibbonPanel(tabName, "Export");

            #region//Create PushButtonData
            PushButtonData annotationSingle    = new PushButtonData("AnnotationSingle", "Single\nAnnotation", thisAssemblyPath, "BimBuildings.Command.Annotations.AutoDimension.FacedoAnnotationSingle");
            PushButtonData annotationMultiple  = new PushButtonData("AnnotationMultiple", "Multiple\nAnnotation", thisAssemblyPath, "BimBuildings.Command.Annotations.AutoDimension.FacedoAnnotationMultiple");
            PushButtonData annotationDelete    = new PushButtonData("AnnotationDelete", "Delete", thisAssemblyPath, "BimBuildings.Command.Annotations.AutoDimension.FacedoAnnotationDelete");
            PushButtonData annotationDeleteAll = new PushButtonData("AnnotationDeleteAll", "Delete All", thisAssemblyPath, "BimBuildings.Command.Annotations.AutoDimension.FacedoAnnotationDeleteAll");
            PushButtonData annotationSettings  = new PushButtonData("AnnotationSettings", "Settings", thisAssemblyPath, "BimBuildings.Command.Annotations.AutoDimension.FacedoAnnotationSettings");

            PushButtonData exportSchedules = new PushButtonData("ExportSchedules", "Export\nSchedules", thisAssemblyPath, "BimBuildings.Command.Export.ExportSchedules.ExportSchedules");
            #endregion

            #region//Set LargeImage 32x32
            BitmapImage singleLargeImage = GetBitmapImage("Dimensions 32x32.png");
            annotationSingle.LargeImage = singleLargeImage;

            BitmapImage multipleLargeImage = GetBitmapImage("Dimensions 32x32.png");
            annotationMultiple.LargeImage = multipleLargeImage;

            BitmapImage deleteLargeImage = GetBitmapImage("Delete 16x16.png");
            annotationDelete.LargeImage = deleteLargeImage;

            BitmapImage deleteAllLargeImage = GetBitmapImage("Delete 16x16.png");
            annotationDeleteAll.LargeImage = deleteAllLargeImage;

            BitmapImage settingsLargeImage = GetBitmapImage("Settings 16x16.png");
            annotationSettings.LargeImage = settingsLargeImage;

            BitmapImage exportLargeImage = GetBitmapImage("Excel 32x32.png");
            exportSchedules.LargeImage = exportLargeImage;
            #endregion

            #region//Set SmallImage 16x16
            BitmapImage singleSmallImage = GetBitmapImage("Dimensions 16x16.png");
            annotationSingle.Image = singleSmallImage;

            BitmapImage multipleSmallImage = GetBitmapImage("Dimensions 16x16.png");
            annotationMultiple.Image = multipleSmallImage;

            BitmapImage deleteSmallImage = GetBitmapImage("Delete 16x16.png");
            annotationDelete.Image = deleteSmallImage;

            BitmapImage deleteAllSmallImage = GetBitmapImage("Delete 16x16.png");
            annotationDeleteAll.Image = deleteAllSmallImage;

            BitmapImage settingsSmallImage = GetBitmapImage("Settings 16x16.png");
            annotationSettings.Image = settingsSmallImage;

            BitmapImage exportSmallImage = GetBitmapImage("Excel 16x16.png");
            exportSchedules.Image = exportSmallImage;
            #endregion

            #region//Create Buttons
            dimensions.AddItem(annotationSingle);
            dimensions.AddItem(annotationMultiple);
            dimensions.AddSeparator();
            dimensions.AddStackedItems(annotationDelete, annotationDeleteAll, annotationSettings);

            export.AddItem(exportSchedules);
            #endregion

            #endregion
            #endregion

            return(Result.Succeeded);
        }
Ejemplo n.º 35
0
        public Result OnStartup(UIControlledApplication a)
        {
            a.CreateRibbonTab("Familien Browser"); //Familien Browser Families Browser

            RibbonPanel G17 = a.CreateRibbonPanel("Familien Browser", "Familien Browser");

            string path = Assembly.GetExecutingAssembly().Location;

            SingleInstallEvent handler = new SingleInstallEvent();

            ExternalEvent exEvent = ExternalEvent.Create(handler);

            DockPanel dockPanel = new DockPanel(exEvent, handler);

            DockablePaneId dpID = new DockablePaneId(new Guid("FA0C04E6-F9E7-413A-9D33-CFE32622E7B8"));

            a.RegisterDockablePane(dpID, "Familien Browser", dockPanel);

            PushButtonData btnShow = new PushButtonData("ShowPanel", "Panel\nanzeigen", path, "RevitFamilyBrowser.Revit_Classes.ShowPanel"); //Panel anzeigen ShowPanel

            btnShow.LargeImage = Tools.GetImage(Resources.IconShowPanel.GetHbitmap());

            RibbonItem ri1 = G17.AddItem(btnShow);

            PushButtonData btnFolder = new PushButtonData("OpenFolder", "Verzeichnis\nöffnen", path, "RevitFamilyBrowser.Revit_Classes.FolderSelect");   //Verzeichnis  öffnen

            btnFolder.LargeImage = Tools.GetImage(Resources.OpenFolder.GetHbitmap());

            RibbonItem ri2 = G17.AddItem(btnFolder);

            PushButtonData btnSpace = new PushButtonData("Space", "Grid Elements\nInstall", path, "RevitFamilyBrowser.Revit_Classes.Space");

            btnSpace.LargeImage = Tools.GetImage(Resources.Grid.GetHbitmap());

            btnSpace.ToolTip =
                "1. Select item form browser.\n2. Pick room in project\n3. Adjust item position and quantity.";

            RibbonItem ri3 = G17.AddItem(btnSpace);

            G17.AddSeparator();

            PushButtonData btnSettings = new PushButtonData("Settings", "Settings", path, "RevitFamilyBrowser.Revit_Classes.Settings");

            btnSettings.LargeImage = Tools.GetImage(Resources.settings.GetHbitmap());

            RibbonItem ri4 = G17.AddItem(btnSettings);

            // a.ControlledApplication.DocumentChanged += OnDocChanged;

            a.ControlledApplication.DocumentOpened += OnDocOpened;

            a.ViewActivated += OnViewActivated;

            if (File.Exists(Properties.Settings.Default.SettingPath))
            {
                Properties.Settings.Default.RootFolder = File.ReadAllText(Properties.Settings.Default.SettingPath);

                Properties.Settings.Default.Save();
            }
            return(Result.Succeeded);
        }
Ejemplo n.º 36
0
        private static void AddUngroupedCommands(string dllfullpath, RibbonPanel ribbonPanel, List <Command> commands)
        {
            // add canned commands as stacked pushbuttons (try to pack 3 commands per pushbutton, then 2)
            while (commands.Count > 4 || commands.Count == 3)
            {
                // remove first three commands from the list
                var command0 = commands[0];
                var command1 = commands[1];
                var command2 = commands[2];
                commands.RemoveAt(0);
                commands.RemoveAt(0);
                commands.RemoveAt(0);

                PushButtonData pbdA = new PushButtonData(command0.Name, command0.Name, dllfullpath, "Command" + command0.Index);
                pbdA.Image      = command0.SmallImage;
                pbdA.LargeImage = command0.LargeImage;

                PushButtonData pbdB = new PushButtonData(command1.Name, command1.Name, dllfullpath, "Command" + command1.Index);
                pbdB.Image      = command1.SmallImage;
                pbdB.LargeImage = command1.LargeImage;

                PushButtonData pbdC = new PushButtonData(command2.Name, command2.Name, dllfullpath, "Command" + command2.Index);
                pbdC.Image      = command2.SmallImage;
                pbdC.LargeImage = command2.LargeImage;

                ribbonPanel.AddStackedItems(pbdA, pbdB, pbdC);
            }
            if (commands.Count == 4)
            {
                // remove first two commands from the list
                var command0 = commands[0];
                var command1 = commands[1];
                commands.RemoveAt(0);
                commands.RemoveAt(0);

                PushButtonData pbdA = new PushButtonData(command0.Name, command0.Name, dllfullpath, "Command" + command0.Index);
                pbdA.Image      = command0.SmallImage;
                pbdA.LargeImage = command0.LargeImage;

                PushButtonData pbdB = new PushButtonData(command1.Name, command1.Name, dllfullpath, "Command" + command1.Index);
                pbdB.Image      = command0.SmallImage;
                pbdB.LargeImage = command0.LargeImage;

                ribbonPanel.AddStackedItems(pbdA, pbdB);
            }
            if (commands.Count == 2)
            {
                // remove first two commands from the list
                var command0 = commands[0];
                var command1 = commands[1];
                commands.RemoveAt(0);
                commands.RemoveAt(0);
                PushButtonData pbdA = new PushButtonData(command0.Name, command0.Name, dllfullpath, "Command" + command0.Index);
                pbdA.Image      = command0.SmallImage;
                pbdA.LargeImage = command0.LargeImage;

                PushButtonData pbdB = new PushButtonData(command1.Name, command1.Name, dllfullpath, "Command" + command1.Index);
                pbdB.Image      = command1.SmallImage;
                pbdB.LargeImage = command1.LargeImage;

                ribbonPanel.AddStackedItems(pbdA, pbdB);
            }
            if (commands.Count == 1)
            {
                // only one command defined, show as a big button...
                var            command = commands[0];
                PushButtonData pbd     = new PushButtonData(command.Name, command.Name, dllfullpath, "Command" + command.Index);
                pbd.Image      = command.SmallImage;
                pbd.LargeImage = command.LargeImage;
                ribbonPanel.AddItem(pbd);
            }
        }
Ejemplo n.º 37
0
        public Result OnStartup(UIControlledApplication application)
        {
            address = new Uri(addr + application.ControlledApplication.VersionNumber);
            uicApp = application;


            _app = this;
            serverActive = Properties.Settings.Default.defaultServerOn;
            // Create the button
            try
            {
                BitmapSource bms;
                PushButtonData lyrebirdButton;
                //StartServer();
                if (disableButton)
                {
                    bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_On.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                    lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird Server\nDisabled", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                    {
                        LargeImage = bms,
                        ToolTip = "The Lyrebird Server is currently disabled in this session of Revit.  This is most likely because you have more than one session of Revit and the server can only run in one.",
                    };
                    Properties.Settings.Default.enableServer = false;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    if (serverActive)
                    {
                        bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_On.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                        lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird\nServer On", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                        {
                            LargeImage = bms,
                            ToolTip = "The Lyrebird Server currently on and will accept requests for data and can create objects.  Push button to toggle the server off.",
                        };
                        StartServer();
                        //ServiceOn();
                    }
                    else
                    {
                        bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Off.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                        lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird\nServer Off", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                        {
                            LargeImage = bms,
                            ToolTip = "The Lyrebird Server is currently off and will not accept requests for data or create objects.  Push button to toggle the server on.",
                        };
                    }
                    Properties.Settings.Default.enableServer = true;
                    Properties.Settings.Default.Save();
                }

                // Settings button
                BitmapSource setBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Settings.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData settingsButtonData = new PushButtonData("Lyrebird Settings", "Lyrebird Settings", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.SettingsCmd")
                {
                    LargeImage = setBMS,
                    ToolTip = "Lyrebird Server settings.",
                };

                // Selection button
                BitmapSource selBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Select.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData selectionButtonData = new PushButtonData("Select Run", "Select Run", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.SelectRunElementsCmd")
                {
                    LargeImage = selBMS,
                    ToolTip = "Select elements created from Lyrebird",
                };

                // Selection button
                BitmapSource delBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_RemoveData.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData removeButtonData = new PushButtonData("Remove Data", "Remove Data", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.RemoveDataCmd")
                {
                    LargeImage = delBMS,
                    ToolTip = "Remove Lyrebird data from selected elements",
                };

                // Create the tab if necessary
                const string tabName = "LMN";
                Autodesk.Windows.RibbonControl ribbon = Autodesk.Windows.ComponentManager.Ribbon;
                Autodesk.Windows.RibbonTab tab = null;
                foreach (Autodesk.Windows.RibbonTab t in ribbon.Tabs)
                {
                    if (t.Id == tabName)
                    {
                        tab = t;
                    }
                }
                if (tab == null)
                {
                    application.CreateRibbonTab(tabName);
                }

                bool found = false;
                List<RibbonPanel> panels = application.GetRibbonPanels(tabName);
                RibbonPanel panel = null;
                foreach (RibbonPanel rp in panels)
                {
                    if (rp.Name == "Utilities")
                    {
                        panel = rp;
                        found = true;
                    }
                }

                SplitButtonData sbd = new SplitButtonData("Lyrebird", "Lyrebird");

                if (!found)
                {
                    // Create the panel
                    RibbonPanel utilitiesPanel = application.CreateRibbonPanel(tabName, "Utilities");

                    // Split button
                    SplitButton sb = utilitiesPanel.AddItem(sbd) as SplitButton;
                    serverButton = sb.AddPushButton(lyrebirdButton) as PushButton;
                    PushButton settingsButton = sb.AddPushButton(settingsButtonData) as PushButton;
                    PushButton selButton = sb.AddPushButton(selectionButtonData) as PushButton;
                    PushButton removeButton = sb.AddPushButton(removeButtonData) as PushButton;
                    sb.IsSynchronizedWithCurrentItem = false;
                }
                else
                {
                    SplitButton sb = panel.AddItem(sbd) as SplitButton;
                    serverButton = sb.AddPushButton(lyrebirdButton) as PushButton;
                    PushButton settingsButton = sb.AddPushButton(settingsButtonData) as PushButton;
                    PushButton selButton = sb.AddPushButton(selectionButtonData) as PushButton;
                    PushButton removeButton = sb.AddPushButton(removeButtonData) as PushButton;
                    sb.IsSynchronizedWithCurrentItem = false;
                }

                if (disableButton)
                {
                    serverButton.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                TaskDialog.Show("Error", ex.ToString());
            }

            return Result.Succeeded;
        }
Ejemplo n.º 38
0
        public Result OnStartup(UIControlledApplication application)
        {
            #region Пример интересной реализации

            /*
             * // метод который позволяет размстить кнопку на системной панели.. но метод на нее не привязать
             *
             * adWin.RibbonControl ribbon = adWin.ComponentManager.Ribbon;
             *
             * adWin.RibbonTab modifyTab = ribbon.Tabs.Where(xxx => xxx.Id == "Modify").FirstOrDefault();
             * adWin.RibbonPanel geometryPanel = modifyTab.Panels.Where(xxx => xxx.Source.Id == "geometry_shr").FirstOrDefault();
             *
             * adWin.RibbonButton button = new adWin.RibbonButton();
             * button.Name = "VSumButton";
             * button.Image = new BitmapImage(new Uri(@"C:\Users\Sidorin\Source\Repos\KSP-VolumesSum\KSP-VolumesSum\res\sum-16.png"));
             * button.LargeImage = new BitmapImage(new Uri(@"C:\Users\Sidorin\Source\Repos\KSP-VolumesSum\KSP-VolumesSum\res\sum-32.png"));
             * button.Id = "ID_VSumButton";
             * button.AllowInStatusBar = true;
             * button.AllowInToolBar = true;
             * button.GroupLocation = Autodesk.Private.Windows.RibbonItemGroupLocation.Last;
             * button.IsEnabled = true;
             * button.IsToolTipEnabled = true;
             * button.IsVisible = true;
             * button.ShowImage = true; //  true;
             * button.ShowText = false;
             * button.ShowToolTipOnDisabled = true;
             * button.Text = "Подсчет объемов";
             * button.ToolTip = "Считает объемы выделенных элементов";
             * //                button.MinHeight = 0;
             * //                button.MinWidth = 0;
             * button.Size = adWin.RibbonItemSize.Standard;
             * button.ResizeStyle = adWin.RibbonItemResizeStyles.HideText;
             * button.IsCheckable = true;
             * button.KeyTip = "KEYVSUM";
             *
             * geometryPanel.Source.Items.Add(button);
             * adWin.ComponentManager.UIElementActivated +=
             *  new EventHandler<adWin.UIElementActivatedEventArgs>(CommandForButton);
             *
             * adWin.RibbonControl ribbon = adWin.ComponentManager.Ribbon;
             * foreach (adWin.RibbonTab tab in ribbon.Tabs)
             * {
             *  foreach (adWin.RibbonPanel panel in tab.Panels)
             *  {
             *      foreach (adWin.RibbonItem ribbonItem in panel.Source.Items)
             *      {
             *          str += tab.Id + " : " + panel.Source.Id + " : " + ribbonItem.Id + Environment.NewLine;
             *      }
             *
             *  }
             *  str += tab.Id + Environment.NewLine;
             * }
             * TaskDialog.Show("123", str);
             *
             * //str += " -----> " + modifyTab.Id + geometryPanel.Source.Id;
             *
             * //TaskDialog.Show("123", str);
             *
             */
            #endregion

            List <RibbonPanel> panels = application.GetRibbonPanels();
            string             str    = "";

            application.CreateRibbonTab(TabName);
            RibbonPanel panelVS = application.CreateRibbonPanel(TabName, PanelName);

            string path = Assembly.GetExecutingAssembly().Location;

            PushButtonData SumBtnData = new PushButtonData(ButtonName, ButtonText, path, "KSP_VolumesSum.VSum")
            {
                ToolTipImage = new BitmapImage(new Uri(Path.GetDirectoryName(path) + "\\res\\sum-32.png", UriKind.Absolute)),
                ToolTip      = "Суммирует объемы элементов модели, если они есть"
            };
            PushButton SumBtn = panelVS.AddItem(SumBtnData) as PushButton;
            SumBtn.LargeImage = new BitmapImage(new Uri(Path.GetDirectoryName(path) + "\\res\\sum-32.png", UriKind.Absolute));

            PlaceButtonOnModifyRibbon();



            return(Result.Succeeded);
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Create a custom ribbon panel and populate
        /// it with our commands, saving the resulting
        /// ribbon items for later access.
        /// </summary>
        static void AddRibbonPanel(
            UIControlledApplication a)
        {
            string[] tooltip = new string[] {
                //"Upload selected sheets and categories to cloud.",
                "Upload selected rooms to cloud.",
                "Upload all rooms to cloud.",
                "Update furniture from the last cloud edit.",
                "Subscribe to or unsubscribe from updates.",
                "About " + Caption + ": ..."
            };

            string[] text = new string[] {
                //"Upload Sheets",
                "Upload Rooms",
                "Upload All Rooms",
                "Update Furniture",
                "Subscribe",
                "About..."
            };

            string[] classNameStem = new string[] {
                //"UploadSheets",
                "UploadRooms",
                "UploadAllRooms",
                "Update",
                "Subscribe",
                "About"
            };

            string[] iconName = new string[] {
                //"2Up",
                "1Up",
                "2Up",
                "1Down",
                "ZigZagRed",
                "Question"
            };

            int n = classNameStem.Length;

            Debug.Assert(text.Length == n,
                         "expected equal number of text and class name entries");

            _buttons = new RibbonItem[n];

            RibbonPanel panel
                = a.CreateRibbonPanel(Caption);

            SplitButtonData splitBtnData
                = new SplitButtonData(Caption, Caption);

            SplitButton splitBtn = panel.AddItem(
                splitBtnData) as SplitButton;

            Assembly asm = typeof(App).Assembly;

            for (int i = 0; i < n; ++i)
            {
                PushButtonData d = new PushButtonData(
                    classNameStem[i], text[i], _path,
                    _namespace + "." + _cmd_prefix
                    + classNameStem[i]);

                d.ToolTip = tooltip[i];

                d.Image = GetBitmapImage(asm,
                                         IconResourcePath(iconName[i], "16"));

                d.LargeImage = GetBitmapImage(asm,
                                              IconResourcePath(iconName[i], "32"));

                d.ToolTipImage = GetBitmapImage(asm,
                                                IconResourcePath(iconName[i], ""));

                _buttons[i] = splitBtn.AddPushButton(d);
            }
        }
        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);
        }
Ejemplo n.º 41
0
        public Result OnStartup(UIControlledApplication uicapp)
        {
            Instance = this;

            ModelHandler      = new ModelRequestHandler();
            ModelEvent        = ExternalEvent.Create(ModelHandler);
            HistoryHandler    = new HistoryRequestHandler();
            HistoryEvent      = ExternalEvent.Create(HistoryHandler);
            DiscussionHandler = new DiscussionRequestHandler();
            DiscussionEvent   = ExternalEvent.Create(DiscussionHandler);

            //Register panel
            PaletteUtilities.RegisterPalette(uicapp);

            _uicapp = uicapp;

            // Obtenir le chemin du dll assembly
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            // Créer des onglets
            string nomOnglet = "Manh Hoang";
            Onglet onglet    = new Onglet();

            onglet.Ajouter(uicapp, nomOnglet);
            Bouton button = new Bouton();

            //********************Create panel*******************
            Ruban       panneau           = new Ruban();
            RibbonPanel rbAuth            = panneau.Ajouter(uicapp, nomOnglet, "Authentification");
            RibbonPanel rbVerification    = panneau.Ajouter(uicapp, nomOnglet, "Verification");
            RibbonPanel rbDatabase        = panneau.Ajouter(uicapp, nomOnglet, "Database");
            RibbonPanel ribbonPanel       = panneau.Ajouter(uicapp, nomOnglet, "Update Data");
            RibbonPanel rib_panelProprety = panneau.Ajouter(uicapp, nomOnglet, "Palette d'historiques");

            rbDatabase.Visible        = false;
            ribbonPanel.Visible       = false;
            rib_panelProprety.Visible = false;


            PushButtonData login = new PushButtonData("Connecter", "Login", thisAssemblyPath, "BIM4PM.UI.CmdRevit.CmdLogin");

            login.AvailabilityClassName = "BIM4PM.UI.AvailabilityButtonLogin";
            _button = rbAuth.AddItem(login);

            rbAuth.AddSeparator();

            PushButtonData logout = new PushButtonData("Logout", "Logout", thisAssemblyPath, "BIM4PM.UI.CmdRevit.CmdLogout");

            logout.AvailabilityClassName = "BIM4PM.UI.AvailabilityButtonLogout";
            rbAuth.AddItem(logout);

            PushButtonData Test = new PushButtonData("Test", "Test", thisAssemblyPath, "BIM4PM.UI.CmdRevit.CmdGetData");

            rbAuth.AddItem(Test);


            uicapp.ViewActivated += new EventHandler <ViewActivatedEventArgs>(onViewActivated); //for panel proprety
            uicapp.ControlledApplication.DocumentOpened  += OnDocumentOpened;
            uicapp.ControlledApplication.DocumentCreated += OnDocumentCreated;
            uicapp.ControlledApplication.DocumentClosing += OnDocumentClosing;
            uicapp.ControlledApplication.DocumentClosed  += OnDocumentClosed;
            uicapp.ControlledApplication.DocumentSaved   += OnDocumentSave;
            uicapp.ControlledApplication.DocumentSynchronizedWithCentral += OnDocumentSynchronized;
            uicapp.ControlledApplication.DocumentChanged += OnDocumentChanged;

            return(Result.Succeeded);
        }
Ejemplo n.º 42
0
        void createRibbonButton(UIControlledApplication application)
        {
            application.CreateRibbonTab("AddIn Integration");
            RibbonPanel rp = application.CreateRibbonPanel("AddIn Integration", "Testing");

            PushButtonData pbd = new PushButtonData("Wall", "Goto WikiHelp for wall creation",
                                                    addinAssmeblyPath,
                                                    "Revit.SDK.Samples.UIAPI.CS.CalcCommand");
            ContextualHelp ch = new ContextualHelp(ContextualHelpType.ContextId, "HID_OBJECTS_WALL");

            pbd.SetContextualHelp(ch);
            pbd.LongDescription = "We redirect the wiki help for this button to Wall creation.";
            pbd.LargeImage      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd.Image           = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);

            PushButton pb = rp.AddItem(pbd) as PushButton;

            pb.Enabled = true;
            pb.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";

            PushButtonData pbd1 = new PushButtonData("GotoGoogle", "Go to Google",
                                                     addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.CalcCommand");
            ContextualHelp ch1 = new ContextualHelp(ContextualHelpType.Url, "http://www.google.com/");

            pbd1.SetContextualHelp(ch1);
            pbd1.LongDescription = "Go to google.";
            pbd1.LargeImage      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd1.Image           = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb1 = rp.AddItem(pbd1) as PushButton;

            pb1.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";

            PushButtonData pbd2 = new PushButtonData("GotoRevitAddInUtilityHelpFile", "Go to Revit Add-In Utility",
                                                     addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.CalcCommand");

            ContextualHelp ch2 = new ContextualHelp(ContextualHelpType.ChmFile, Path.GetDirectoryName(addinAssmeblyPath) + @"\RevitAddInUtility.chm");

            ch2.HelpTopicUrl = @"html/3374f8f0-dccc-e1df-d269-229ed8c60e93.htm";
            pbd2.SetContextualHelp(ch2);
            pbd2.LongDescription = "Go to Revit Add-In Utility.";
            pbd2.LargeImage      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd2.Image           = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb2 = rp.AddItem(pbd2) as PushButton;

            pb2.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";


            PushButtonData pbd3 = new PushButtonData("PreviewControl", "Preview all views",
                                                     addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.PreviewCommand");

            pbd3.LargeImage = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd3.Image      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb3 = rp.AddItem(pbd3) as PushButton;

            pb3.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";


            PushButtonData pbd5 = new PushButtonData("Drag_And_Drop", "Drag and Drop", addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.DragAndDropCommand");

            pbd5.LargeImage = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd5.Image      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb5 = rp.AddItem(pbd5) as PushButton;

            pb5.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";
        }
Ejemplo n.º 43
0
        /// <summary>
        ///   Add a pushbutton to a panel
        /// </summary>
        /// <param name="rPanel"></param>
        /// <param name="buttonName"></param>
        /// <param name="buttonText"></param>
        /// <param name="imagePath16"></param>
        /// <param name="imagePath32"></param>
        /// <param name="dllPath"></param>
        /// <param name="dllClass"></param>
        /// <param name="toolTip"></param>
        /// <param name="pbAvail"></param>
        /// <param name="separatorBeforeButton"></param>
        private void AddButton(RibbonPanel rPanel,
                               string buttonName,
                               string buttonText,
                               string imagePath16,
                               string imagePath32,
                               string dllPath,
                               string dllClass,
                               string toolTip,
                               string pbAvail,
                               bool separatorBeforeButton)
        {
            //File path must exist
            if (!File.Exists(dllPath))
            {
                return;
            }

            //Separator??
            if (separatorBeforeButton)
            {
                rPanel.AddSeparator();
            }

            try
            {
                //Create the pbData
                PushButtonData m_mPushButtonData = new PushButtonData(
                    buttonName,
                    buttonText,
                    dllPath,
                    dllClass);

                if (!string.IsNullOrEmpty(imagePath16))
                {
                    try
                    {
                        m_mPushButtonData.Image = LoadPngImageSource(imagePath16);
                    }
                    catch (Exception m_e)
                    {
                        throw new Exception(m_e.Message);
                    }
                }

                if (!string.IsNullOrEmpty(imagePath32))
                {
                    try
                    {
                        m_mPushButtonData.LargeImage = LoadPngImageSource(imagePath32);
                    }
                    catch (Exception m_e)
                    {
                        throw new Exception(m_e.Message);
                    }
                }

                m_mPushButtonData.ToolTip = toolTip;

                //Availability?
                if (!string.IsNullOrEmpty(pbAvail))
                {
                    m_mPushButtonData.AvailabilityClassName = pbAvail;
                }

                //Add button to the ribbon
                rPanel.AddItem(m_mPushButtonData);
                ContextualHelp help = new ContextualHelp(ContextualHelpType.ChmFile, _path + "/help.htm");
                m_mPushButtonData.SetContextualHelp(help);
            }
            catch (Exception m_e)
            {
                throw new Exception(m_e.Message);
            }
        }
Ejemplo n.º 44
0
        public Result OnStartup(
            UIControlledApplication a)
        {
            Assembly exe  = Assembly.GetExecutingAssembly();
            string   path = exe.Location;

            // Create ribbon panel

            RibbonPanel p = a.CreateRibbonPanel(Caption);

            // Create DXF button

            PushButtonData d = new PushButtonData(
                _name, _name, path,
                _namespace_prefix + _class_name);

            d.ToolTip         = string.Format(_tooltip_format, _name);
            d.Image           = NewBitmapImage(exe, "cnc_icon_16x16_size.png");
            d.LargeImage      = NewBitmapImage(exe, "cnc_icon_32x32_size.png");
            d.LongDescription = string.Format(_tooltip_long_description_format, _name);
            d.ToolTipImage    = NewBitmapImage(exe, "cnc_icon_full_size.png");

            p.AddItem(d);

            // Create SAT button

            d = new PushButtonData(
                _name2, _name2, path,
                _namespace_prefix + _class_name2);

            d.ToolTip         = string.Format(_tooltip_format, _name2);
            d.Image           = NewBitmapImage(exe, "cnc_icon_16x16_size.png");
            d.LargeImage      = NewBitmapImage(exe, "cnc_icon_32x32_size.png");
            d.LongDescription = string.Format(_tooltip_long_description_format, _name2);
            d.ToolTipImage    = NewBitmapImage(exe, "cnc_icon_full_size.png");

            p.AddItem(d);

            // Create shared parameters button

            d = new PushButtonData(
                _name3, _name3, path,
                _namespace_prefix + _class_name3);

            d.ToolTip
                = "Create shared parameters for tracking export history";

            d.LongDescription
                = "Create and bind shared parameters to the "
                  + "Parts category for tracking export history:\r\n\r\n"
                  + " * CncFabIsExported - Boolean\r\n"
                  + " * CncFabExportedFirst - Text timestamp ISO 8601\r\n"
                  + " * CncFabExportedLast - Text timestamp ISO 8601";

            d.ToolTipImage = NewBitmapImage(exe,
                                            "cnc_icon_full_size.png");

            p.AddItem(d);

            return(Result.Succeeded);
        }
Ejemplo n.º 45
0
 //设置PulldownButton类型的介绍信息
 public void SetPushButtonAttribute(ref RibbonPanel ribbon, PushButtonData pbd, string largeImageuri, string toolTip, string longDescription)
 {
     SetCommonAttribute(ref pbd, largeImageuri, toolTip, longDescription);
     RibbonButton ribbonButton = ribbon.AddItem(pbd) as PushButton;
 }
Ejemplo n.º 46
0
        public Result OnStartup(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            string tabName = "CRM Tools";

            application.CreateRibbonTab(tabName);

            string REVIT_VERSION = "v2018";

            string commandsPath = "";

            commandsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + REVIT_VERSION + @"\Commands\";

            string iconsPath = "";

            iconsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + REVIT_VERSION + @"\RevitIcons\";

            #region CreateRevitSheets

            // Create a push button
            PushButtonData btnCreateRevitSheets = new PushButtonData("cmdCreateRevitSheets", " Create \nSheets", commandsPath + "CreateRevitSheets.dll", "CreateRevitSheets.Class1");
            btnCreateRevitSheets.ToolTip         = "Create multiple Sheets at once. Assign Views to Sheets.";
            btnCreateRevitSheets.LongDescription = "Manually create Sheets or load them from a (.csv) file. " +
                                                   "CSV files can be created with Microsoft Excel. The Sheet Number must be in Column A and the Sheet Name must be in Column B. Each Sheet should have its own Row. " +
                                                   "Sheet 1 in Row 1, Sheet 2 in Row 2, etc.";

            // create bitmap image for button
            Uri         uriLargeImage_CreateRevitSheets = new Uri(iconsPath + @"32x32\cmdRevitSheetsImage_32x32.bmp");
            BitmapImage largeImage_CreateRevitSheets    = new BitmapImage(uriLargeImage_CreateRevitSheets);

            // create bitmap image for button
            Uri         uriSmallImage_CreateRevitSheets = new Uri(iconsPath + @"16x16\cmdRevitSheetsImage_16x16.bmp");
            BitmapImage smallImage_CreateRevitSheets    = new BitmapImage(uriSmallImage_CreateRevitSheets);

            btnCreateRevitSheets.LargeImage = largeImage_CreateRevitSheets;
            btnCreateRevitSheets.Image      = smallImage_CreateRevitSheets;

            #endregion

            #region SharedParameterCreator

            // Create a push button
            PushButtonData btnSharedParameterCreator = new PushButtonData("cmdSharedParameterCreator", "Shared \nParameter Creator", commandsPath + "SharedParameterCreator.dll", "SharedParameterCreator.Class1");
            btnSharedParameterCreator.ToolTip         = "Create a Shared Parameter file from a CSV (Comma delimited) (.csv) file list";
            btnSharedParameterCreator.LongDescription = "Create large numbers of Shared Parameters. To use this program, first a file with the .csv extension must be created, which can be stored anywhere. " +
                                                        "CSV files can be created with Microsoft Excel.\n\n" +
                                                        "Column A: Category (e.g. Mechanical Equipment)\n" +
                                                        "Column B: Shared Parameter Group (User Determined)\n" +
                                                        "Column C: Data Type (e.g. Number, Integer, Text, YesNo)\n" +
                                                        "Column D: Binding Type (e.g. Instance, Type)\n" +
                                                        "Column E: Parameter Name (User Determined)\n\n" +
                                                        "Parameters are grouped under Data in Properties if Insert into Project Parameters is selected";

            // create bitmap image for button
            Uri         uriLargeImage_SharedParameterCreator = new Uri(iconsPath + @"32x32\cmdSharedParameterCreator_32x32.bmp");
            BitmapImage largeImage_SharedParameterCreator    = new BitmapImage(uriLargeImage_SharedParameterCreator);

            // create bitmap image for button
            Uri         uriSmallImage_SharedParameterCreator = new Uri(iconsPath + @"16x16\cmdSharedParameterCreator_16x16.bmp");
            BitmapImage smallImage_SharedParameterCreator    = new BitmapImage(uriSmallImage_SharedParameterCreator);

            btnSharedParameterCreator.LargeImage = largeImage_SharedParameterCreator;
            btnSharedParameterCreator.Image      = smallImage_SharedParameterCreator;

            #endregion

            #region CreateSheetSet

            // Create a push button
            PushButtonData btnCreateSheetSet = new PushButtonData("cmdCreateSheetSet", "Create \nSheet Set", commandsPath + "CreateSheetSet.dll", "CreateSheetSet.Class1");
            btnCreateSheetSet.ToolTip         = "Create a Sheet Set based on revision properties";
            btnCreateSheetSet.LongDescription = "Select between Revision Description, Revision Number, and Revision Date to create a Sheet Set containing all the drawings associated with that property";

            // create bitmap image for button
            Uri         uriLargeImage_CreateSheetSet = new Uri(iconsPath + @"32x32\cmdCreateSheetSet_32x32.bmp");
            BitmapImage largeImage_CreateSheetSet    = new BitmapImage(uriLargeImage_CreateSheetSet);

            // create bitmap image for button
            Uri         uriSmallImage_CreateSheetSet = new Uri(iconsPath + @"16x16\cmdCreateSheetSet_16x16.bmp");
            BitmapImage smallImage_CreateSheetSet    = new BitmapImage(uriSmallImage_CreateSheetSet);

            btnCreateSheetSet.LargeImage = largeImage_CreateSheetSet;
            btnCreateSheetSet.Image      = smallImage_CreateSheetSet;

            #endregion

            #region SheetRenamer

            PushButtonData btnSheetRenamer = new PushButtonData("cmdSheetRenamer", "Sheet \nRenamer", commandsPath + "SheetRenamer.dll", "SheetRenamer.Class1");
            btnSheetRenamer.ToolTip         = "Renames all PDF files in a directory to the following naming convention: Project Number-Sheet Number_Current Revision";
            btnSheetRenamer.LongDescription = "Create a sheet set within Revit and assign the sheets you want to print. Once the sheets are printed, browse to the directory where they are saved. " +
                                              "Select the sheet set that you used to print and click OK.\n\n" +
                                              "NOTE: Ensure that the Project Number is set within Project Information for proper file naming.";

            // create bitmap image for button
            Uri         uriLargeImage_SheetRenamer = new Uri(iconsPath + @"32x32\cmdSheetRenamer_32x32.bmp");
            BitmapImage largeImage_SheetRenamer    = new BitmapImage(uriLargeImage_SheetRenamer);

            // create bitmap image for button
            Uri         uriSmallImage_SheetRenamer = new Uri(iconsPath + @"16x16\cmdSheetRenamer_16x16.bmp");
            BitmapImage smallImage_SheetRenamer    = new BitmapImage(uriSmallImage_SheetRenamer);

            btnSheetRenamer.LargeImage = largeImage_SheetRenamer;
            btnSheetRenamer.Image      = smallImage_SheetRenamer;

            #endregion

            #region ProjectParameters

            PushButtonData btnProjectParameters = new PushButtonData("cmdProjectParameters", "Insert into \nProject Parameters", commandsPath + "ProjectParameters.dll", "ProjectParameters.Class1");
            btnProjectParameters.ToolTip         = "Insert Shared Parameters into Project Parameters";
            btnProjectParameters.LongDescription = "1) Make sure a Shared Parameter file is loaded in Manage->Shared Parameters\n" +
                                                   "2) Click Load to fill the view with the Shared Parameters from the file\n" +
                                                   "3) Right click to set the Binding type (e.g. Instance or Type). This value must be set before selecting a Category.\n" +
                                                   "4) Right click to set the element Category (e.g. Mechanical Equipment, Walls, etc.)\n" +
                                                   "5) Right click to set the Properties Group. This is the category it will be grouped under in the Properties window.\n" +
                                                   "6) Click Insert to insert the Shared Parameters into Project Parameters";

            // create bitmap image for button
            Uri         uriLargeImage_ProjectParameters = new Uri(iconsPath + @"32x32\cmdProjectParameters_32x32.bmp");
            BitmapImage largeImage_ProjectParameters    = new BitmapImage(uriLargeImage_ProjectParameters);

            // create bitmap image for button
            Uri         uriSmallImage_ProjectParameters = new Uri(iconsPath + @"16x16\cmdProjectParameters_16x16.bmp");
            BitmapImage smallImage_ProjectParameters    = new BitmapImage(uriSmallImage_ProjectParameters);

            btnProjectParameters.LargeImage = largeImage_ProjectParameters;
            btnProjectParameters.Image      = smallImage_ProjectParameters;

            #endregion

            #region RevisionOnSheets

            // Create a push button
            PushButtonData btnRevisionOnSheets = new PushButtonData("cmdRevisionOnSheets", "Revision \nOn Sheets", commandsPath + "RevisionOnSheets.dll", "RevisionOnSheets.Class1");
            btnRevisionOnSheets.ToolTip         = "Apply or unapply a revision to multiple sheets at once";
            btnRevisionOnSheets.LongDescription = "Select the revision sequence from the drop-down list that you want to apply or unapply from the list of sheets in the project";

            // create bitmap image for button
            Uri         uriLargeImage_RevisionOnSheets = new Uri(iconsPath + @"32x32\cmdRevisionOnSheets_32x32.bmp");
            BitmapImage largeImage_RevisionOnSheets    = new BitmapImage(uriLargeImage_RevisionOnSheets);

            // create bitmap image for button
            Uri         uriSmallImage_RevisionOnSheets = new Uri(iconsPath + @"16x16\cmdRevisionOnSheets_16x16.bmp");
            BitmapImage smallImage_RevisionOnSheets    = new BitmapImage(uriSmallImage_RevisionOnSheets);

            btnRevisionOnSheets.LargeImage = largeImage_RevisionOnSheets;
            btnRevisionOnSheets.Image      = smallImage_RevisionOnSheets;

            #endregion

            #region About

            // Create a push button
            PushButtonData btnAbout = new PushButtonData("cmdAbout", "About \nCRM Tools", commandsPath + "About.dll", "About.Class1");
            btnAbout.ToolTip = "Release information";

            // create bitmap image for button
            Uri         uriLargeImage_About = new Uri(iconsPath + @"32x32\cmdAbout_32x32.bmp");
            BitmapImage largeImage_About    = new BitmapImage(uriLargeImage_About);

            // create bitmap image for button
            Uri         uriSmallImage_About = new Uri(iconsPath + @"16x16\cmdAbout_16x16.bmp");
            BitmapImage smallImage_About    = new BitmapImage(uriSmallImage_About);

            btnAbout.LargeImage = largeImage_About;
            btnAbout.Image      = smallImage_About;

            #endregion

            #region ProductionPanelItems

            // Create a ribbon panel
            RibbonPanel pnlProductionPanel = application.CreateRibbonPanel(tabName, "Production");
            // Add the buttons to the panel
            List <RibbonItem> productionButtons = new List <RibbonItem>();
            // Add the buttons to the panel
            productionButtons.Add(pnlProductionPanel.AddItem(btnCreateRevitSheets));
            productionButtons.Add(pnlProductionPanel.AddItem(btnSharedParameterCreator));
            productionButtons.Add(pnlProductionPanel.AddItem(btnCreateSheetSet));
            productionButtons.Add(pnlProductionPanel.AddItem(btnSheetRenamer));
            productionButtons.Add(pnlProductionPanel.AddItem(btnProjectParameters));
            productionButtons.Add(pnlProductionPanel.AddItem(btnRevisionOnSheets));

            #endregion

            #region About

            // Create a ribbon panel
            RibbonPanel pnlInfo = application.CreateRibbonPanel(tabName, "Info");
            // Add the buttons to the panel
            List <RibbonItem> aboutButton = new List <RibbonItem>();
            aboutButton.Add(pnlInfo.AddItem(btnAbout));

            #endregion

            return(Result.Succeeded);
        }
Ejemplo n.º 47
0
    Result IExternalApplication.OnStartup(
      UIControlledApplication application)
    {
      try
      {
        // create a Ribbon panel which contains three 
        // stackable buttons and one single push button

        string firstPanelName = "Upgrader";
        RibbonPanel panel = application.CreateRibbonPanel(
          firstPanelName);

        // set the information about the command we will 
        // be assigning to the button 

        PushButtonData pushButtonData = new PushButtonData(
          "FileUpgrader", 
          "File Upgrader", 
          AddInPath, 
          "ADNPlugin.Revit.FileUpgrader.Command");

        //' add a button to the panel 

        PushButton pushButton = panel.AddItem(pushButtonData)
          as PushButton;

        //' add an icon 

        pushButton.LargeImage = LoadPNGImageFromResource(
        "ADNPlugin.Revit.FileUpgrader.upgrade_32by32.png");

        // add a tooltip 
        pushButton.ToolTip = 
          "Upgrade old version Revit documents to current one.";

        // long description

        pushButton.LongDescription =
             "Specify the Source folder that contains a set of Revit files, " + 
             "and Destination folders where you want to save upgraded files.";

        // Context (F1) Help - new in 2013 
        //string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); // %AppData% 

        string path;
        path = System.IO.Path.GetDirectoryName(
           System.Reflection.Assembly.GetExecutingAssembly().Location);

        ContextualHelp contextHelp = new ContextualHelp(
            ContextualHelpType.ChmFile,
            path + "/Resources/ADNFileUpgraderHelp.htm"); // hard coding for simplicity. 

        pushButton.SetContextualHelp(contextHelp);

        return Autodesk.Revit.UI.Result.Succeeded;
      }
      catch (Exception ex)
      {
        MessageBox.Show(ex.ToString(), "File Upgrader Ribbon");
        return Autodesk.Revit.UI.Result.Failed;
      }
    }
Ejemplo n.º 48
0
        /// <summary>
        /// Create our custom ribbon panel and populate
        /// it with our commands, saving the resulting
        /// ribbon items for later access.
        /// </summary>
        static void AddRibbonPanel(
            UIControlledApplication a)
        {
            string[] tooltip = new string[] {
            "Create and bind shared parameter definition.",
            "Export shared parameter values one by one creating new and updating existing documents.",
            "Export shared parameter values in batch after deleting all existing project documents.",
            "Import shared parameter values.",
            "Subscribe to or unsubscribe from updates.",
            "About " + Caption + ": ..."
              };

              string[] text = new string[] {
            "Bind Shared Parameter",
            "Export one by one",
            "Export batch",
            "Import",
            "Subscribe",
            "About..."
              };

              string[] classNameStem = new string[] {
            "1_CreateAndBindSharedParameter",
            "2a_ExportSharedParameterValues",
            "2b_ExportSharedParameterValuesBatch",
            "3_ImportSharedParameterValues",
            "4_Subscribe",
            "0_About"
              };

              string[] iconName = new string[] {
            "Knot",
            "1Up",
            "2Up",
            "1Down",
            "ZigZagRed",
            "Question"
              };

              int n = classNameStem.Length;

              Debug.Assert( text.Length == n
            && tooltip.Length == n
            && iconName.Length == n,
            "expected equal number of text and class name entries" );

              Debug.Assert(
            text[_subscribeButtonIndex].Equals( _subscribe ),
            "Did you set the correct _subscribeButtonIndex?" );

              _buttons = new RibbonItem[n];

              RibbonPanel panel
            = a.CreateRibbonPanel( Caption );

              SplitButtonData splitBtnData
            = new SplitButtonData( Caption, Caption );

              SplitButton splitBtn = panel.AddItem(
            splitBtnData ) as SplitButton;

              Assembly asm = typeof( App ).Assembly;

              for ( int i = 0; i < n; ++i )
              {
            PushButtonData d = new PushButtonData(
              classNameStem[i], text[i], _path,
              _namespace + "." + _cmd_prefix
              + classNameStem[i] );

            d.ToolTip = tooltip[i];

            d.Image = GetBitmapImage( asm,
              IconResourcePath( iconName[i], "16" ) );

            d.LargeImage = GetBitmapImage( asm,
              IconResourcePath( iconName[i], "32" ) );

            d.ToolTipImage = GetBitmapImage( asm,
              IconResourcePath( iconName[i], "" ) );

            _buttons[i] = splitBtn.AddPushButton( d );
              }
        }
Ejemplo n.º 49
0
        // Both OnStartup and OnShutdown must be implemented as public method
        public Result OnStartup(UIControlledApplication application)
        {
            Global.UpdateAppConfig("lang_2052", "/Resources/Langs/2052.xaml");
            Global.UpdateAppConfig("lang_1033", "/Resources/Langs/1033.xaml");

            //Global.SetCurrentLanguage(System.Threading.Thread.CurrentThread.CurrentCulture.LCID);

            application.ControlledApplication.DocumentOpened += new EventHandler <DocumentOpenedEventArgs>(Application_DocumentOpened);
            RibbonPanel rpanel = application.CreateRibbonPanel("Facade Helper");

            string         thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            PushButtonData bndataAppconfig  =
                new PushButtonData("cmdConfig", "全局设置",
                                   thisAssemblyPath, "FacadeHelper.Config_Command");
            PushButtonData bndataProcessElements =
                new PushButtonData("cmdProcessElements", "构件处理",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_Process_Elements");
            PushButtonData bndataZone =
                new PushButtonData("cmdZone", "分区处理",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_Zone");
            PushButtonData bndataFixzone =
                new PushButtonData("cmdFixZone", "分区修复",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_FixZone");
            PushButtonData bndataFamilyParam =
                new PushButtonData("cmdFamilyParam", "族参初始",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_AddFamilyParameters");
            PushButtonData bndataSelectfilter =
                new PushButtonData("cmdSelectFilter", "选择过滤",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_SelectFilter");
            PushButtonData bndataCodeMapping =
                new PushButtonData("cmdCodeMapping", "编码映射",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_CodeMapping");

            bndataAppconfig.LargeImage = System.Windows.Interop.Imaging
                                         .CreateBitmapSourceFromHBitmap(Properties.Resources.config32.GetHbitmap(),
                                                                        IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataProcessElements.LargeImage = System.Windows.Interop.Imaging.
                                               CreateBitmapSourceFromHBitmap(Properties.Resources.level32.GetHbitmap(),
                                                                             IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataZone.LargeImage = System.Windows.Interop.Imaging
                                    .CreateBitmapSourceFromHBitmap(Properties.Resources.se32.GetHbitmap(),
                                                                   IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataFixzone.LargeImage = System.Windows.Interop.Imaging
                                       .CreateBitmapSourceFromHBitmap(Properties.Resources.fix32.GetHbitmap(),
                                                                      IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataFamilyParam.LargeImage = System.Windows.Interop.Imaging
                                           .CreateBitmapSourceFromHBitmap(Properties.Resources.sv32.GetHbitmap(),
                                                                          IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataSelectfilter.LargeImage = System.Windows.Interop.Imaging
                                            .CreateBitmapSourceFromHBitmap(Properties.Resources.filter32.GetHbitmap(),
                                                                           IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataCodeMapping.LargeImage = System.Windows.Interop.Imaging
                                           .CreateBitmapSourceFromHBitmap(Properties.Resources.code32.GetHbitmap(),
                                                                          IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            rpanel.AddItem(bndataAppconfig);
            rpanel.AddItem(bndataZone);
            rpanel.AddItem(bndataFixzone);
            rpanel.AddSeparator();
            rpanel.AddItem(bndataFamilyParam);
            rpanel.AddItem(bndataSelectfilter);
            rpanel.AddItem(bndataCodeMapping);
            return(Result.Succeeded);
        }
Ejemplo n.º 50
0
 public void PullDown(RibbonPanel panel)
 {
     //creates a Push button for the get selection command
     PushButtonData bgetselect = new PushButtonData("getselec", "Get Selection", assemblyloca, "Application.App");
 }
Ejemplo n.º 51
0
        void CreateRibbonTab(
            UIControlledApplication a)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            string ass_path = assembly.Location;
            string ass_name = assembly.GetName().Name;

            // Create ribbon tab

            string tab_name = Caption;

            try
            {
                a.CreateRibbonTab(tab_name);
            }
            catch (Autodesk.Revit.Exceptions.ArgumentException)
            {
                // Assume error is due to tab already existing
            }

            PushButtonData pbCommand = new PushButtonData(
                "Import", "Import", ass_path,
                ass_name + ".Command");

            PushButtonData pbCommandOpt = new PushButtonData(
                "Settings", "Settings", ass_path,
                ass_name + ".CmdSettings");

            pbCommand.LargeImage = NewBitmapImage(assembly,
                                                  "rvtmetaprop.iCommand.png");

            pbCommandOpt.LargeImage = NewBitmapImage(assembly,
                                                     "rvtmetaprop.iCmdSettings.png");

            // Add button tips (when data, must be
            // defined prior to adding button.)

            pbCommand.ToolTip = "Import meta properties.";

            pbCommand.LongDescription = "Import meta properties"
                                        + " modified or added in the Forge configurator"
                                        + " sample.";

            //   Add new ribbon panel.

            string panel_name = Caption;

            RibbonPanel new_panel = a.CreateRibbonPanel(
                tab_name, panel_name);

            // add button to ribbon panel

            SplitButtonData split_buttonData
                = new SplitButtonData(
                      "splitButton", "metaprop");

            _split_button = new_panel.AddItem(
                split_buttonData) as SplitButton;

            _split_button.AddPushButton(pbCommand);
            _split_button.AddPushButton(pbCommandOpt);
        }
Ejemplo n.º 52
0
        public void AddTCOMDrops_WTA_TCOM_Ribbon(UIControlledApplication a)
        {
            string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string ExecutingAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
            // create ribbon tab
            String thisNewTabName = "WTA-TCOM";

            try {
                a.CreateRibbonTab(thisNewTabName);
            } catch (Autodesk.Revit.Exceptions.ArgumentException) {
                // Assume error generated is due to "WTA" already existing
            }
            //   Create a push button in the ribbon panel
            //PushButtonData pbData = new PushButtonData("QVis", "   QVis   ", ExecutingAssemblyPath, ExecutingAssemblyName + ".QVisCommand");
            //   Add new ribbon panel.
            String      thisNewPanelName   = "TCOM Drops";
            RibbonPanel thisNewRibbonPanel = a.CreateRibbonPanel(thisNewTabName, thisNewPanelName);
            // add button to ribbon panel
            //PushButton pushButton = thisNewRibbonPanel.AddItem(pbData) as PushButton;
            //   Set the large image shown on button
            //Note that the full image name is namespace_prefix + "." + the actual imageName);
            //pushButton.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), "PlunkOMaticTCOM.QVis.png");


            // provide button tips
            //pushButton.ToolTip = "Floats a form with buttons to toggle visibilities.";
            //pushButton.LongDescription = "On this form, the way the buttons look indicate the current visibility status.";

            //   Create push button in this ribbon panel
            PushButtonData pbData2DH    = new PushButtonData("2D Hosted", "2D Hosted", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop2DHInstance");
            PushButtonData pbData4DH    = new PushButtonData("4D Hosted", "4D Hosted", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop4DHInstance");
            PushButtonData pbDataAPH    = new PushButtonData("AP Hosted", "AP Hosted", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDropAPHInstance");
            PushButtonData pbData2DN    = new PushButtonData(" 2D Free ", " 2D Free ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop2DNHInstance");
            PushButtonData pbData4DN    = new PushButtonData(" 4D Free ", " 4D Free ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop4DNHInstance");
            PushButtonData pbDataAPN    = new PushButtonData(" AP Free ", " AP Free ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDropAPNHInstance");
            PushButtonData pbData2PTTAG = new PushButtonData(" 2PT TAG ", " 2PT TAG ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickTag");


            // add button tips (when data, must be defined prior to adding button.)
            pbData2DH.ToolTip    = "2D Hosted Drop";
            pbData4DH.ToolTip    = "4D Hosted Drop";
            pbDataAPH.ToolTip    = "AP Hosted Drop";
            pbData2DN.ToolTip    = "2D Non Hosted Drop";
            pbData4DN.ToolTip    = "4D Non Hosted Drop";
            pbDataAPN.ToolTip    = "AP Non Hosted Drop";
            pbData2PTTAG.ToolTip = "Tag a drop with two picks.";

            string lDesc       = " => Places a drop of the INSTANCE value indicated and then prompts for the TAG location. The drops's Workset will be TCOM.";
            string lDesc2PTTAG = " => Tags an existing drop with two picks. First pick selects drop. Second pick is tag location. Press ESC to exit the command.";

            pbData2DH.LongDescription    = pbData2DH.ToolTip + lDesc;
            pbData4DH.LongDescription    = pbData4DH.ToolTip + lDesc;
            pbDataAPH.LongDescription    = pbDataAPH.ToolTip + lDesc;
            pbData2DN.LongDescription    = pbData2DN.ToolTip + lDesc;
            pbData4DN.LongDescription    = pbData4DN.ToolTip + lDesc;
            pbDataAPN.LongDescription    = pbDataAPN.ToolTip + lDesc;
            pbData2PTTAG.LongDescription = lDesc2PTTAG;

            // add button to ribbon panel
            thisNewRibbonPanel.AddItem(pbData2PTTAG);
            List <RibbonItem> projectButtons = new List <RibbonItem>();

            projectButtons.AddRange(thisNewRibbonPanel.AddStackedItems(pbData2DH, pbData4DH, pbDataAPH));
            projectButtons.AddRange(thisNewRibbonPanel.AddStackedItems(pbData2DN, pbData4DN, pbDataAPN));
        } // AddTCOMDrops_WTA-TCOM_Ribbon
Ejemplo n.º 53
0
 /// <summary>
 /// Utility for adding icons to the button.
 /// </summary>
 /// <param name="button">The push button.</param>
 /// <param name="icon">The icon.</param>
 private static void SetIconsForPushButtonData(PushButtonData button, System.Drawing.Icon icon)
 {
     button.LargeImage = GetStdIcon(icon);
     button.Image      = GetSmallIcon(icon);
 }
Ejemplo n.º 54
0
        /// <summary>
        /// Create a ribbon panel for the MEP sample application.
        /// We present a column of three buttons: Electrical, HVAC and About.
        /// The first two include subitems, the third does not.
        /// </summary>
        static void AddRibbonPanel(
            UIControlledApplication a)
        {
            const int nElectricalCommands = 3;

            const string m = "AdnRme.Cmd"; // namespace and command prefix

            string path = Assembly.GetExecutingAssembly().Location;

            string[] text = new string[] {
                "Electrical Connectors",
                "Electrical System Browser",
                //"Electrical Hierarchy",
                //"Electrical Hierarchy 2",
                "Unhosted elements",
                "Assign flow to terminals",
                "Change size",
                "Populate CFM per SF on spaces",
                "Reset demo",
                "About..."
            };

            string[] classNameStem = new string[] {
                "ElectricalConnectors",
                "ElectricalSystemBrowser",
                //"ElectricalHierarchy",
                //"ElectricalHierarchy2",
                "UnhostedElements",
                "AssignFlowToTerminals",
                "ChangeSize",
                "PopulateCfmPerSf",
                "ResetDemo",
                "About"
            };

            int n = classNameStem.Length;

            Debug.Assert(text.Length == n,
                         "expected equal number of text and class name entries");

            // Create three stacked buttons for the HVAC,
            // electrical and about commands, respectively:

            RibbonPanel panel = a.CreateRibbonPanel(
                "MEP Sample");

            PulldownButtonData d1 = new PulldownButtonData(
                "Electrical", "Electrical");

            d1.ToolTip = "Electrical Commands";

            PulldownButtonData d2 = new PulldownButtonData(
                "Hvac", "HVAC");

            d2.ToolTip = "HVAC Commands";

            n = n - 1;

            PushButtonData d3 = new PushButtonData(
                classNameStem[n], text[n], path, m + classNameStem[n]);

            d3.ToolTip = "About the HVAC and Electrical MEP Sample.";

            IList <RibbonItem> ribbonItems = panel.AddStackedItems(
                d1, d2, d3);

            // Add subitems to the HVAC and
            // electrical pulldown buttons:

            PulldownButton pulldown;
            PushButton     pb;
            int            i, j;

            for (i = 0; i < n; ++i)
            {
                j        = i < nElectricalCommands ? 0 : 1;
                pulldown = ribbonItems[j] as PulldownButton;

                PushButtonData pbd = new PushButtonData(
                    text[i], text[i], path, m + classNameStem[i]);

                pb = pulldown.AddPushButton(pbd);

                pb.ToolTip = text[i];
            }
        }
Ejemplo n.º 55
0
        // <summary>
        // Add a button to a Ribbon Tab
        // </summary>
        // <param name="rpanel">The ribbon panel</param>
        // <param name="buttonName">The Name of the Button</param>
        // <param name="buttonText">Command Text</param>
        // <param name="imagePath16">Small Image</param>
        // <param name="imagePath32">Large Image</param>
        // <param name="dllPath">Path to the DLL file</param>
        // <param name="dllClass">Full qualified class descriptor</param>
        // <param name="tooltip">Tooltip to add to the button</param>
        // <param name="pbAvail">Pushbutton availability class, blank if none</param>
        // <remarks></remarks>
        private void AddButton(Autodesk.Revit.UI.RibbonPanel rpanel, string buttonName, string buttonText, string dllPath, string dllClass, string imagePath16, string imagePath32, string toolTip, string pbAvail)
        {
            PushButtonData m_pbData = GetPushButtonData(buttonName, buttonText, dllPath, dllClass, imagePath16, imagePath32, toolTip, pbAvail);

            rpanel.AddItem(m_pbData);
        }
Ejemplo n.º 56
0
        public static Result BuildRegularRibbon(UIControlledApplication uiControlledApp)
        {
            UiControlledApplication = uiControlledApp;

            void BuildRibbonTab(string tabName) => UiControlledApplication.CreateRibbonTab(tabName);

            void BuildRibbonPanels()
            {
                void BuildRibbonPanel(string panelName)
                {
                    RibbonPanel ribbonPanel = UiControlledApplication.CreateRibbonPanel(RegularTabName, panelName);

                    RibbonPanels.Add(panelName, ribbonPanel);
                }

                List <string> allPanelNames = RegularToolObjects
                                              .Select(x => x.RegularToolGroup.GetEnumDescription())
                                              .Distinct()
                                              .ToList();

                foreach (string panelName in allPanelNames)
                {
                    BuildRibbonPanel(panelName);
                }
            }

            void BuildRibbonButtons()
            {
                void BuildRibbonButton(RegularTool regularTool)
                {
                    string      toolGroupFriendlyName = regularTool.RegularToolGroup.GetEnumDescription();
                    RibbonPanel ribbonPanel           = RibbonPanels[toolGroupFriendlyName];

                    if (ribbonPanel == null)
                    {
                        return;
                    }

                    switch (regularTool.RibbonButtonType)
                    {
                    case RibbonButtonType.PushButton:
                        PushButtonData pushButtonData = new PushButtonData(regularTool.InternalName, regularTool.DisplayName, AssemblyPath, regularTool.FullClassName);
                        if (!(ribbonPanel.AddItem(pushButtonData) is PushButton pushButton))
                        {
                            break;
                        }
                        pushButton.ToolTip = regularTool.Description;
                        if (regularTool.BitmapImage != null)
                        {
                            pushButton.LargeImage = regularTool.BitmapImage;
                        }
                        break;

                    case RibbonButtonType.PulldownButtonHeader:
                        PulldownButtonData pulldownButtonData = new PulldownButtonData(regularTool.InternalName, regularTool.DisplayName);
                        if (!(ribbonPanel.AddItem(pulldownButtonData) is PulldownButton pulldownButton))
                        {
                            break;
                        }
                        pulldownButton.ToolTip = regularTool.Description;
                        if (regularTool.BitmapImage != null)
                        {
                            pulldownButton.LargeImage = regularTool.BitmapImage;
                        }
                        string condensedTopButtonName = StringUtils.StripToAlphanumeric(regularTool.InternalName);
                        foreach (RegularTool dropdownRegularTool in regularTool.DropdownButtonData)
                        {
                            string         condensedDropdownButtonName = StringUtils.StripToAlphanumeric(dropdownRegularTool.InternalName);
                            string         className = $"Regular.Tools.{condensedTopButtonName}.{condensedDropdownButtonName}";
                            PushButtonData dropdownPushButtonData = new PushButtonData
                                                                    (
                                dropdownRegularTool.InternalName,
                                dropdownRegularTool.DisplayName,
                                AssemblyPath,
                                className
                                                                    );
                            PushButton dropdownPushButton = pulldownButton.AddPushButton(dropdownPushButtonData);
                            if (dropdownRegularTool.BitmapImage != null)
                            {
                                dropdownPushButton.LargeImage = dropdownRegularTool.BitmapImage;
                            }
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                // Looping through all defined buttons, creating them and adding them to their respective panels
                foreach (RegularTool regularTool in RegularToolObjects)
                {
                    BuildRibbonButton(regularTool);
                }
            }

            BuildRibbonTab(RegularTabName);
            BuildRibbonPanels();
            BuildRibbonButtons();
            return(Result.Succeeded);
        }
Ejemplo n.º 57
0
        public Result OnStartup(
            UIControlledApplication a)
        {
            Assembly exe = Assembly.GetExecutingAssembly();
              string path = exe.Location;

              // Create ribbon panel

              RibbonPanel p = a.CreateRibbonPanel( Caption );

              // Create DXF button

              PushButtonData d = new PushButtonData(
            _name, _name, path,
            _namespace_prefix + _class_name );

              d.ToolTip = string.Format( _tooltip_format, _name );
              d.Image = NewBitmapImage( exe, "cnc_icon_16x16_size.png" );
              d.LargeImage = NewBitmapImage( exe, "cnc_icon_32x32_size.png" );
              d.LongDescription = string.Format( _tooltip_long_description_format, _name );
              d.ToolTipImage = NewBitmapImage( exe, "cnc_icon_full_size.png" );

              p.AddItem( d );

              // Create SAT button

              d = new PushButtonData(
            _name2, _name2, path,
            _namespace_prefix + _class_name2 );

              d.ToolTip = string.Format( _tooltip_format, _name2 );
              d.Image = NewBitmapImage( exe, "cnc_icon_16x16_size.png" );
              d.LargeImage = NewBitmapImage( exe, "cnc_icon_32x32_size.png" );
              d.LongDescription = string.Format( _tooltip_long_description_format, _name2 );
              d.ToolTipImage = NewBitmapImage( exe, "cnc_icon_full_size.png" );

              p.AddItem( d );

              // Create shared parameters button

              d = new PushButtonData(
            _name3, _name3, path,
            _namespace_prefix + _class_name3 );

              d.ToolTip
            = "Create shared parameters for tracking export history";

              d.LongDescription
            = "Create and bind shared parameters to the "
            + "Parts category for tracking export history:\r\n\r\n"
            + " * CncFabIsExported - Boolean\r\n"
            + " * CncFabExportedFirst - Text timestamp ISO 8601\r\n"
            + " * CncFabExportedLast - Text timestamp ISO 8601";

              d.ToolTipImage = NewBitmapImage( exe,
            "cnc_icon_full_size.png" );

              p.AddItem( d );

              return Result.Succeeded;
        }
Ejemplo n.º 58
0
 public static void AddPushButton(Autodesk.Revit.UI.RibbonPanel ribbonPanel, PushButtonData pushButtonData)
 {
     PushButton pushButton = ribbonPanel.AddItem(pushButtonData) as PushButton;
 }
Ejemplo n.º 59
0
        public Result OnStartup(UIControlledApplication a)
        {
            //string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            //string xmlFileName = Path.Combine(assemblyFolder, "FamilyData.xml");
            //if (!File.Exists(xmlFileName))
            //{
            //    XmlWriter writer = XmlWriter.Create(xmlFileName);
            //}
            DownloadDataBase();
            //Create ribbon tab
            string tabName = "Familien Manager";

            a.CreateRibbonTab(tabName);

            #region Ribbon buttons
            //Create buttons
            string path = Assembly.GetExecutingAssembly().Location;

            //1 Electrical Fixture - Elektroinstallationen
            PushButtonData buttonElectricalFixture = new PushButtonData("Elektroinstallationen", "Elektro-\ninstallationen", path, "RevitFamilyManager.Families.ElectricalFixture");
            buttonElectricalFixture.ToolTip    = "Shows telephon devices families";
            buttonElectricalFixture.LargeImage = GetImage(Resources.Electroinstallation.GetHbitmap());

            //2 Communication - Kommunikationsgeräte
            PushButtonData buttonCommunication = new PushButtonData("Kommunikationsgeräte", "Kommunikations-\ngeräte", path, "RevitFamilyManager.Families.Communication");
            buttonCommunication.ToolTip    = "Shows telephon devices families";
            buttonCommunication.LargeImage = GetImage(Resources.Kommunication.GetHbitmap());

            //3 Data - Datengeräte
            PushButtonData buttonData = new PushButtonData("Datengeräte", "Daten-\ngeräte", path, "RevitFamilyManager.Families.Data");
            buttonData.ToolTip    = "Shows telephon devices families";
            buttonData.LargeImage = GetImage(Resources.Daten.GetHbitmap());

            //4 FireAlarm - Brandmeldegeräte
            PushButtonData buttonFireAlarm = new PushButtonData("Brandmeldegeräte", "Brandmelde-\ngeräte", path, "RevitFamilyManager.Families.FireAlarm");
            buttonFireAlarm.ToolTip    = "Shows telephon devices families";
            buttonFireAlarm.LargeImage = GetImage(Resources.Brandmelder.GetHbitmap());

            //5 Lighting - Lichtschalter
            PushButtonData buttonLighting = new PushButtonData("Lichtschalter", "Lichtschalter", path, "RevitFamilyManager.Families.Lighting");
            buttonLighting.ToolTip    = "Shows telephon devices families";
            buttonLighting.LargeImage = GetImage(Resources.Lichtschalter.GetHbitmap());

            //5 LightingFixtures - Leuchten
            PushButtonData buttonLightingFixtures = new PushButtonData("Leuchten", "Leuchten", path, "RevitFamilyManager.Families.LightingFixture");
            buttonLightingFixtures.ToolTip    = "Shows telephon devices families";
            buttonLightingFixtures.LargeImage = GetImage(Resources.Leuchte.GetHbitmap());

            //7 NurseCall - Notrufgeräte
            PushButtonData buttonNurseCall = new PushButtonData("Notrufgeräte", " Notruf-\ngeräte ", path, "RevitFamilyManager.Families.NurceCall");
            buttonNurseCall.ToolTip    = "Shows telephon devices families";
            buttonNurseCall.LargeImage = GetImage(Resources.Notruf.GetHbitmap());

            //8 Security - Sicherheitsgeräte
            PushButtonData buttonSecurity = new PushButtonData("Sicherheitsgeräte", "Sicherheits-\ngeräte", path, "RevitFamilyManager.Families.Security");
            buttonSecurity.ToolTip    = "Shows telephon devices families";
            buttonSecurity.LargeImage = GetImage(Resources.Sicherheit.GetHbitmap());

            //9 Phone - Telefongeräte
            PushButtonData buttonPhone = new PushButtonData("Telefongeräte", " Telefon-\ngeräte ", path, "RevitFamilyManager.Families.Phone");
            buttonPhone.ToolTip    = "Shows telephon devices families";
            buttonPhone.LargeImage = GetImage(Resources.Telefon.GetHbitmap());

            //10 Electroinstallation - Elektrische Ausstattung
            PushButtonData buttonElectroinstallation = new PushButtonData("ElektrischeAusstattung", "Elektrische\nAusstattung", path, "RevitFamilyManager.Families.Electroinstallation");
            buttonElectroinstallation.ToolTip    = "Shows telephon devices families";
            buttonElectroinstallation.LargeImage = GetImage(Resources.ElektrischeAusstattung.GetHbitmap());

            //11 Annotation - Beschriftungen
            PushButtonData buttonAnnotation = new PushButtonData("Beschriftungen", "Beschriftungen", path, "RevitFamilyManager.Families.Descriptions");
            buttonAnnotation.ToolTip    = "Shows telephon devices families";
            buttonAnnotation.LargeImage = GetImage(Resources.Description.GetHbitmap());

            //12 CableTrayFitting - Leerrohrformteile
            PushButtonData buttonCableTrayFittings = new PushButtonData("Leerrohrformteile", "Leerrohrform-\nteile", path, "RevitFamilyManager.Families.CableTrayFitting");
            buttonCableTrayFittings.ToolTip    = "Shows telephon devices families";
            buttonCableTrayFittings.LargeImage = GetImage(Resources.Kabeltrassenformteil.GetHbitmap());

            //13 Earthing - Erdung
            PushButtonData buttonEarthing = new PushButtonData("Erdung", "Erdung", path, "RevitFamilyManager.Families.Earthing");
            buttonEarthing.ToolTip    = "Shows earthing families";
            buttonEarthing.LargeImage = GetImage(Resources.Erdnung.GetHbitmap());

            //14 GenericModels - Allgemeines Modell
            PushButtonData buttonGenericModels = new PushButtonData("Allgemeines Modell", "Allgemeines\nModell", path, "RevitFamilyManager.Families.GenericModels");
            buttonGenericModels.ToolTip    = "User Preferences";
            buttonGenericModels.LargeImage = GetImage(Resources.GenericModels.GetHbitmap());

            //15 Legend - Legende
            PushButtonData buttonLegend = new PushButtonData("Legende", "Legende", path, "RevitFamilyManager.Families.Legend");
            buttonLegend.ToolTip    = "Legend families";
            buttonLegend.LargeImage = GetImage(Resources.Legende.GetHbitmap());

            //15 Cable Trays - Kabeltrassen
            PushButtonData buttonCables = new PushButtonData("Kabeltrassen", "Kabeltrassen", path, "RevitFamilyManager.Families.CableTrays");
            buttonCables.ToolTip    = "Cable trays families";
            buttonCables.LargeImage = GetImage(Resources.Kabeltrasse.GetHbitmap());

            //---------------------------------------------------------------------
            //14 Settings
            PushButtonData buttonSettings = new PushButtonData("Settings", "Familien Ordner", path, "RevitFamilyManager.UserSettings");
            buttonSettings.ToolTip    = "User Preferences";
            buttonSettings.LargeImage = GetImage(Resources.Settings.GetHbitmap());

            //15 UpdateDB
            PushButtonData buttonUpdateDb = new PushButtonData("Update DB", "Datenbank\naktualisieren", path, "RevitFamilyManager.Data.UpdateDB");
            buttonUpdateDb.ToolTip    = "UpdateDB";
            buttonUpdateDb.LargeImage = GetImage(Resources.UpdateDB.GetHbitmap());

            //16 Create Type Projects ----/Developer tool for Web Application
            PushButtonData buttonCreateProjects = new PushButtonData("ProjectCreator", "CreateProject", path, "RevitFamilyManager.Data.ProjectCreator");
            buttonCreateProjects.ToolTip = "Create Projects From Family Type";


            //Create ribbon panel
            RibbonPanel toolPanel = a.CreateRibbonPanel(tabName, "Familien Kategorien");

            //Add buttons to panel
            toolPanel.AddItem(buttonElectricalFixture);
            toolPanel.AddItem(buttonElectroinstallation);
            toolPanel.AddItem(buttonCables);
            toolPanel.AddSeparator();

            toolPanel.AddItem(buttonLighting);
            toolPanel.AddItem(buttonLightingFixtures);
            toolPanel.AddSeparator();

            toolPanel.AddItem(buttonCommunication);
            toolPanel.AddItem(buttonData);
            toolPanel.AddItem(buttonPhone);
            toolPanel.AddSeparator();

            toolPanel.AddItem(buttonNurseCall);
            toolPanel.AddItem(buttonSecurity);
            toolPanel.AddItem(buttonFireAlarm);
            toolPanel.AddItem(buttonEarthing);

            toolPanel.AddSeparator();

            // toolPanel.AddItem(buttonCableTrayFittings);
            toolPanel.AddItem(buttonGenericModels);
            //toolPanel.AddItem(buttonAnnotation);
            toolPanel.AddItem(buttonLegend);

            ///////////////////////////////////////////////
            //----Dev Tools---
            //////////////////////////////////////////////

            //RibbonPanel settingsPanel = a.CreateRibbonPanel(tabName, "Einstellungen");
            //settingsPanel.AddItem(buttonSettings);
            //settingsPanel.AddItem(buttonUpdateDb);
            //settingsPanel.AddItem(buttonCreateProjects);

            //////////////////////////////////////////////
            #endregion
            //Registering Docking panel
            SingleInstallEvent    handler = new SingleInstallEvent();
            ExternalEvent         exEvent = ExternalEvent.Create(handler);
            FamilyManagerDockable dock    = new FamilyManagerDockable(exEvent, handler);
            //new FamilyManagerDockable();
            FamilyManagerDockable.WPFpanel = dock;

            DockablePaneProviderData data = new DockablePaneProviderData();
            dock.SetupDockablePane(data);

            DockablePaneId dpId = new DockablePaneId(new Guid("209923d1-7cdc-4a1c-a4ad-1e2f9aae1dc5"));
            a.RegisterDockablePane(dpId, "Familien Manager", dock);

            return(Result.Succeeded);
        }
Ejemplo n.º 60
0
        private void CreateRibbonSamplePanel(UIControlledApplication application)
        {
            application.CreateRibbonTab("砖+宝");

            rp1 = application.CreateRibbonPanel("砖+宝", "个人信息管理");
            rp2 = application.CreateRibbonPanel("砖+宝", "智能铺贴");
            rp3 = application.CreateRibbonPanel("砖+宝", "基本信息管理");
            rp4 = application.CreateRibbonPanel("砖+宝", "快速入门");

            String         userInfoShow = "\nAdministrator,您好!\n testtsetsetsetset!";
            PushButtonData pbd1         = new PushButtonData("userInfoShow", userInfoShow, AddInPath, "userInfoShow");

            rp1.AddItem(pbd1);

            PushButtonData pbd2 = new PushButtonData("UserInfo", "个人信息", AddInPath, "RevitRedevelop.UserInfoDockablePane");
            PushButton     pb2  = rp1.AddItem(pbd2) as PushButton;

            pb2.ToolTip         = "See Selected Element";
            pb2.LongDescription = "查看个人信息";
            pb2.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd3 = new PushButtonData("PackagePurchase", "套餐购买", AddInPath, "PackagePurchase");
            PushButton     pb3  = rp1.AddItem(pbd3) as PushButton;

            pb3.ToolTip         = "See Selected Element";
            pb3.LongDescription = "进行套餐的浏览和购买";
            pb3.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd4 = new PushButtonData("LogOut", "退出登录", AddInPath, "LogOut");
            PushButton     pb4  = rp1.AddItem(pbd4) as PushButton;

            pb4.ToolTip         = "See Selected Element";
            pb4.LongDescription = "退出当前登录";
            pb4.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd5 = new PushButtonData("DrawFloorPlan", "绘制户型图", AddInPath, "DrawFloorPlan");
            PushButton     pb5  = rp2.AddItem(pbd5) as PushButton;

            pb5.ToolTip         = "See Selected Element";
            pb5.LongDescription = "进行户型图的选择";
            pb5.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd6 = new PushButtonData("Pave", "      铺贴      ", AddInPath, "Pave");
            PushButton     pb6  = rp2.AddItem(pbd6) as PushButton;

            pb6.ToolTip         = "See Selected Element";
            pb6.LongDescription = "进行铺贴模板的选择";
            pb6.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd7 = new PushButtonData("ResultExport", "      出图    ", AddInPath, "ResultExport");
            PushButton     pb7  = rp2.AddItem(pbd7) as PushButton;

            pb7.ToolTip         = "See Selected Element";
            pb7.LongDescription = "方案生成";
            pb7.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd8 = new PushButtonData("FloorPlanManage", "户型图管理", AddInPath, "FloorPlanManage");
            PushButton     pb8  = rp3.AddItem(pbd8) as PushButton;

            pb8.ToolTip         = "See Selected Element";
            pb8.LongDescription = "户型图的管理";
            pb8.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd9 = new PushButtonData("PaveModelManage", " 模板管理", AddInPath, "FloorPlanManage");
            PushButton     pb9  = rp3.AddItem(pbd9) as PushButton;

            pb9.ToolTip         = "See Selected Element";
            pb9.LongDescription = "铺砖模板管理";
            pb9.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd10 = new PushButtonData("TileProductManage", " 单品管理", AddInPath, "TileProductManage");
            PushButton     pb10  = rp3.AddItem(pbd10) as PushButton;

            pb10.ToolTip         = "See Selected Element";
            pb10.LongDescription = "铺砖模板管理";
            pb10.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd11 = new PushButtonData("OnlineLearning", "在线视频", AddInPath, "OnlineLearning");
            PushButton     pb11  = rp4.AddItem(pbd11) as PushButton;

            pb11.ToolTip         = "See Selected Element";
            pb11.LongDescription = "";
            pb11.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");

            PushButtonData pbd12 = new PushButtonData("OnlineHelp", "在线帮助", AddInPath, "OnlineHelp");
            PushButton     pb12  = rp4.AddItem(pbd12) as PushButton;

            pb12.ToolTip         = "See Selected Element";
            pb12.LongDescription = "";
            pb12.LargeImage      = GetBitmapImage("F:/StrcturalWall.png");
        }