public Result OnShutdown(UIControlledApplication application) { //save actual user settings //Properties.Settings.Default.Save(); return Result.Succeeded; }
/// <summary> /// Add ribbon panel /// </summary> /// <param name="a"></param> private void AddRibbonPanel(UIControlledApplication a) { Autodesk.Revit.UI.RibbonPanel rvtRibbonPanel = a.CreateRibbonPanel("Archilizer FEI"); PulldownButtonData data = new PulldownButtonData("Options", "Family Editor" + Environment.NewLine + "Interface"); BitmapSource img32 = new BitmapImage (new Uri (@largeIcon)); BitmapSource img16 = new BitmapImage (new Uri (@smallIcon)); //RibbonItem item = rvtRibbonPanel.AddItem(data); //PushButton optionsBtn = item as PushButton; //ContextualHelp ch = new ContextualHelp(ContextualHelpType.Url, "file:///C:/Users/adicted/AppData/Roaming/Autodesk/Revit/Addins/2015/Family Editor Interface _ AutoCAD _ Autodesk App Store.html"); ContextualHelp ch = new ContextualHelp(ContextualHelpType.Url, @helpFile); PushButton familyEI = rvtRibbonPanel.AddItem(new PushButtonData("Family Editor", "Family Editor" + Environment.NewLine + "Interface", path, "FamilyEditorInterface.Command")) as PushButton; familyEI.Image = img16; familyEI.LargeImage = img32; familyEI.ToolTip = Message; familyEI.SetContextualHelp(ch); //optionsBtn.AddPushButton(new PushButtonData("Automatic Dimensions", "AutoDim", path, // "AutomaticDimensions.AutoDim")); //optionsBtn.AddPushButton(new PushButtonData("CAD|BIM", "CAD|BIM", path, // "BimpowAddIn.BimToCad")); }
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 a) { a.Idling += OnIdling; Uri uri = new Uri(serviceUrl); serviceHost = new ServiceHost(typeof(RevitExternalService), uri); try { serviceHost.AddServiceEndpoint(typeof (IRevitExternalService), new NetNamedPipeBinding(), "RevitExternalService"); //ServiceMetadataBehavior smb = // new ServiceMetadataBehavior(); //smb.HttpGetEnabled = true; //serviceHost.Description.Behaviors.Add(smb); serviceHost.Open(); } catch (Exception ex) { a.ControlledApplication .WriteJournalComment(string.Format("{0}.\r\n{1}", Resources.CouldNotStartWCFService, ex.ToString()), true); } return Result.Succeeded; }
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; }
public Result OnShutdown(UIControlledApplication application) { DynamoUpdater updater = new DynamoUpdater(application.ActiveAddInId); UpdaterRegistry.UnregisterUpdater(updater.GetUpdaterId()); return Result.Succeeded; }
public Result OnStartup(UIControlledApplication application) { ThisApp = this; var elementCategoryFilter = new ElementCategoryFilter(BuiltInCategory.OST_GenericAnnotation); _updaterModified = new UpdaterModified(application.ActiveAddInId); if (!UpdaterRegistry.IsUpdaterRegistered(_updaterModified.GetUpdaterId())) { UpdaterRegistry.RegisterUpdater(_updaterModified); UpdaterRegistry.AddTrigger(_updaterModified.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeAny()); } _updaterAdded = new UpdaterAdded(application.ActiveAddInId); if (!UpdaterRegistry.IsUpdaterRegistered(_updaterAdded.GetUpdaterId())) { UpdaterRegistry.RegisterUpdater(_updaterAdded); UpdaterRegistry.AddTrigger(_updaterAdded.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeElementAddition()); } _paneId = new DockablePaneId(Guid.NewGuid()); _handler = new RequestHandler(); _exEvent = ExternalEvent.Create(_handler); _sheetNoteModel = new ViewModel(); _mainPage = new MainPage { Resources = {["ViewModel"] = _sheetNoteModel } }; application.RegisterDockablePane(_paneId, "Sheet Note Manager", (IDockablePaneProvider)_mainPage); application.ControlledApplication.DocumentClosed += new EventHandler<DocumentClosedEventArgs>(OnDocumentClosed); application.ControlledApplication.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(OnDocumentOpened); return Result.Succeeded; }
public Result OnShutdown(UIControlledApplication application) { application.ControlledApplication.DocumentClosed -= OnDocumentClosed; application.ControlledApplication.DocumentOpened -= OnDocumentOpened; return Result.Succeeded; }
/// <summary> /// OnShutdown() - called when Revit ends. /// </summary> public Result OnShutdown(UIControlledApplication app) { // (1) unregister our document changed event hander app.ControlledApplication.DocumentChanged -= UILabs_DocumentChanged; return Result.Succeeded; }
public Result OnStartup( UIControlledApplication a) { CreateRibbonPanel( a ); return Result.Succeeded; }
/// <summary> /// Create UI on StartUp /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { RibbonPanel grevitPanel = application.CreateRibbonPanel("Grevit"); PushButton commandButton = grevitPanel.AddItem(new PushButtonData("GrevitCommand", "Grevit", path, "Grevit.Revit.GrevitCommand")) as PushButton; commandButton.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( Properties.Resources.paper_airplane.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(32, 32)); commandButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "http://grevit.net/")); PushButton parameterButton = grevitPanel.AddItem(new PushButtonData("ParameterNames", "Parameter names", path, "Grevit.Revit.ParameterNames")) as PushButton; parameterButton.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( Properties.Resources.tag_hash.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(32, 32)); parameterButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "http://grevit.net/")); PushButton skpButton = grevitPanel.AddItem(new PushButtonData("ImportSketchUp", "Import SketchUp", path, "Grevit.Revit.ImportSketchUp")) as PushButton; skpButton.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( Properties.Resources.Skp.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(32, 32)); skpButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "http://grevit.net/")); return Result.Succeeded; }
/// <summary> /// Startup /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { try { // Tab RibbonPanel panel = application.CreateRibbonPanel("BCFier"); // Button Data PushButton pushButton = panel.AddItem(new PushButtonData("BCFier", "BCFier " + Assembly.GetExecutingAssembly().GetName().Version, Path.Combine(_path, "Bcfier.Revit.dll"), "Bcfier.Revit.Entry.CmdMain")) as PushButton; // Images and Tooltip if (pushButton != null) { pushButton.Image = LoadPngImgSource("Bcfier.Assets.BCFierIcon16x16.png", Path.Combine(_path, "Bcfier.dll")); pushButton.LargeImage = LoadPngImgSource("Bcfier.Assets.BCFierIcon32x32.png", Path.Combine(_path, "Bcfier.dll")); pushButton.ToolTip = "BCFier"; } } catch (Exception ex1) { MessageBox.Show("exception: " + ex1); return Result.Failed; } return Result.Succeeded; }
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { try { //TAF load english_us TODO add a way to localize res = Resource_en_us.ResourceManager; // Create new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description")); //MDJ todo - move hard-coded strings out to resource files //Create a push button in the ribbon panel PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo", res.GetString("App_Name"), m_AssemblyName, "Dynamo.Applications.DynamoRevit")) as PushButton; System.Drawing.Bitmap dynamoIcon = Dynamo.Applications.Properties.Resources.Nodes_32_32; BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( dynamoIcon.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); pushButton.LargeImage = bitmapSource; pushButton.Image = bitmapSource; // MDJ = element level events and dyanmic model update // MDJ 6-8-12 trying to get new dynamo to watch for user created ref points and re-run definition when they are moved IdlePromise.RegisterIdle(application); updater = new DynamoUpdater(application.ActiveAddInId, application.ControlledApplication); if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId())) UpdaterRegistry.RegisterUpdater(updater); ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager)); ElementClassFilter familyFilter = new ElementClassFilter(typeof(FamilyInstance)); ElementCategoryFilter refPointFilter = new ElementCategoryFilter(BuiltInCategory.OST_ReferencePoints); ElementClassFilter modelCurveFilter = new ElementClassFilter(typeof(CurveElement)); ElementClassFilter sunFilter = new ElementClassFilter(typeof(SunAndShadowSettings)); IList<ElementFilter> filterList = new List<ElementFilter>(); filterList.Add(SpatialFieldFilter); filterList.Add(familyFilter); filterList.Add(modelCurveFilter); filterList.Add(refPointFilter); filterList.Add(sunFilter); ElementFilter filter = new LogicalOrFilter(filterList); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeAny()); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion()); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition()); return Result.Succeeded; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return Result.Failed; } }
/// <summary> /// Implementation of Shutdown for the external application. /// </summary> /// <param name="application">The Revit application.</param> /// <returns>The result (typically Succeeded).</returns> public Result OnShutdown(UIControlledApplication application) { // Clean up m_ifcCommandBinding.Executed -= OnIFCExport; return Result.Succeeded; }
public Result OnStartup(UIControlledApplication a) { //Create Ribbon Panel add the UI button on start up RibbonPanel alignViewsPanel = ribbonPanel(a); //Register location updater with Revit. LocationUpdater updater = new LocationUpdater(a.ActiveAddInId); UpdaterRegistry.RegisterUpdater(updater, true); ElementCategoryFilter viewPortFilter = new ElementCategoryFilter(BuiltInCategory.OST_Viewports); ElementCategoryFilter viewFilter = new ElementCategoryFilter(BuiltInCategory.OST_Views); LogicalOrFilter filter = new LogicalOrFilter(viewPortFilter, viewFilter); //Parameter to send to the trigger. ElementClassFilter viewPort = new ElementClassFilter(typeof(Viewport)); ElementId viewPortNumberId = new ElementId(BuiltInParameter.VIEWPORT_DETAIL_NUMBER); //Set trigger UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), viewPort, Element.GetChangeTypeParameter(viewPortNumberId)); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition()); //add buttons to ribbon addVRCommandButtons(alignViewsPanel); pushButton_Setting(alignViewsPanel); return Result.Succeeded; }
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> /// Startup /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { RvtWindow = null; // no dialog needed yet; the command will bring it This = this; // static access to this application instance return Result.Succeeded; }
public Result OnStartup( UIControlledApplication a ) { PopulatePanel( a.CreateRibbonPanel( "Va3c Export" ) ); return Result.Succeeded; }
/// <summary> /// Implements the OnStartup method to register events when Revit starts. /// </summary> /// <param name="application">Controlled application of to be loaded to Revit process.</param> /// <returns>Return the status of the external application.</returns> public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { // Register related events m_eventsReactor = new EventsReactor(); application.ControlledApplication.ViewPrinting += new EventHandler<Autodesk.Revit.DB.Events.ViewPrintingEventArgs>(m_eventsReactor.AppViewPrinting); application.ControlledApplication.ViewPrinted += new EventHandler<Autodesk.Revit.DB.Events.ViewPrintedEventArgs>(m_eventsReactor.AppViewPrinted); return Autodesk.Revit.UI.Result.Succeeded; }
/// <summary> /// Unregister subscribed events when Revit exists /// </summary> /// <param name="application">Current loaded application.</param> /// <returns></returns> public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application) { m_eventReactor.Dispose(); application.ControlledApplication.DocumentSaving -= new EventHandler<Autodesk.Revit.DB.Events.DocumentSavingEventArgs>(EventReactor.DocumentSaving); application.ControlledApplication.DocumentSavingAs -= new EventHandler<Autodesk.Revit.DB.Events.DocumentSavingAsEventArgs>(EventReactor.DocumentSavingAs); application.ControlledApplication.DocumentClosed -= new EventHandler<Autodesk.Revit.DB.Events.DocumentClosedEventArgs>(EventReactor.DocumentClosed); return Autodesk.Revit.UI.Result.Succeeded; }
public Result OnShutdown( UIControlledApplication a ) { if( Subscribed ) { _uiapp.Idling -= _handler; } return Result.Succeeded; }
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { try { // Create new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel("Visual Programming"); //MDJ todo - move hard-coded strings out to resource files //Create a push button in the ribbon panel PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo", "Dynamo", m_AssemblyName, "Dynamo.Applications.DynamoRevit")) as PushButton; System.Drawing.Bitmap dynamoIcon = Dynamo.Applications.Properties.Resources.Nodes_32_32; BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( dynamoIcon.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); pushButton.LargeImage = bitmapSource; pushButton.Image = bitmapSource; // MDJ = element level events and dyanmic model update // Register sfm updater with Revit //DynamoUpdater updater = new DynamoUpdater(application.ActiveAddInId); //UpdaterRegistry.RegisterUpdater(updater); //// Change Scope = any spatial field element //ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager)); ////ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager)); //// Change type = element addition //UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), SpatialFieldFilter, //Element.GetChangeTypeAny()); // Element.GetChangeTypeElementAddition() DynamoUpdater updater = new DynamoUpdater(application.ActiveAddInId);//, sphere.Id, view.Id); if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId())) UpdaterRegistry.RegisterUpdater(updater); ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager)); ElementClassFilter familyFilter = new ElementClassFilter(typeof(FamilyInstance)); ElementCategoryFilter massFilter = new ElementCategoryFilter(BuiltInCategory.OST_Mass); IList<ElementFilter> filterList = new List<ElementFilter>(); filterList.Add(SpatialFieldFilter); filterList.Add(familyFilter); filterList.Add(massFilter); LogicalOrFilter filter = new LogicalOrFilter(filterList); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeGeometry()); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion()); return Result.Succeeded; } catch (Exception ex) { MessageBox.Show(ex.ToString()); return Result.Failed; } }
public Result OnShutdown(UIControlledApplication application) { UpdaterRegistry.UnregisterUpdater(Updater.GetUpdaterId()); //if(Application.Current != null) // Application.Current.Shutdown(); return Result.Succeeded; }
private static bool WriteEmptyComment(UIControlledApplication app, string controlName, string comment) { if (string.IsNullOrEmpty(controlName)) { app.ControlledApplication.WriteJournalComment(comment, false); return true; } return false; }
/// <summary> /// Add a button to the Ribbon and attach it to the IExternalCommand defined in Command.cs /// </summary> public Result OnStartup(UIControlledApplication application) { RibbonPanel rp = application.CreateRibbonPanel("Extensible Storage Manager"); string currentAssembly = System.Reflection.Assembly.GetAssembly(this.GetType()).Location; PushButton pb = rp.AddItem(new PushButtonData("Extensible Storage Manager", "Extensible Storage Manager", currentAssembly, "ExtensibleStorageManager.Command")) as PushButton; return Result.Succeeded; }
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 + "\\"; return Result.Succeeded; }
/// <summary> /// Implementation of Startup for the external application. /// </summary> /// <param name="application">The Revit application.</param> /// <returns>The result (typically Succeeded).</returns> public Result OnStartup(UIControlledApplication application) { // Register execution override RevitCommandId commandId = RevitCommandId.LookupCommandId("ID_EXPORT_IFC"); m_ifcCommandBinding = application.CreateAddInCommandBinding(commandId); m_ifcCommandBinding.Executed += OnIFCExport; return Result.Succeeded; }
/// <summary> /// Shut Down /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnShutdown(UIControlledApplication application) { if (RvtWindow != null && RvtWindow.IsVisible) { RvtWindow.Close(); } return Result.Succeeded; }
public Result OnShutdown(UIControlledApplication uicapp) { uicapp.ControlledApplication.DocumentOpening -= new EventHandler<Autodesk.Revit.DB.Events.DocumentOpeningEventArgs>(appDocOpening); uicapp.ControlledApplication.DocumentOpened -= new EventHandler<Autodesk.Revit.DB.Events.DocumentOpenedEventArgs>(appDocOpened); uicapp.ControlledApplication.DocumentSynchronizingWithCentral -= new EventHandler<Autodesk.Revit.DB.Events.DocumentSynchronizingWithCentralEventArgs>(appDocSynching); uicapp.ControlledApplication.DocumentSynchronizedWithCentral -= new EventHandler<Autodesk.Revit.DB.Events.DocumentSynchronizedWithCentralEventArgs>(appDocSynched); uicapp.ControlledApplication.DocumentClosing -= new EventHandler<Autodesk.Revit.DB.Events.DocumentClosingEventArgs>(appDocClosing); return Result.Succeeded; }
public Result OnShutdown(UIControlledApplication application) { if (null != _serviceHost) { _serviceHost.Close(); _serviceHost = null; } return Result.Succeeded; }
public Result OnShutdown(UIControlledApplication application) { // nothing to clean up return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { // Create a custom ribbon tab string tabName = "CRM Tools"; application.CreateRibbonTab(tabName); string revitVersion = string.Empty; revitVersion = "v2017"; string commandsPath = ""; commandsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + revitVersion + @"\Commands\"; string iconsPath = ""; iconsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + revitVersion + @"\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 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 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(btnSheetRenamer)); productionButtons.Add(pnlProductionPanel.AddItem(btnProjectParameters)); #endregion return(Result.Succeeded); }
public Result OnShutdown(UIControlledApplication app) { Revit.EventHandlers.DeregisterEvents(app); return(Result.Succeeded); }
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"; }
public Result OnStartup(UIControlledApplication application) { //new AppServise.ButtonCreator(application); //try //{ MainContext VM = new MainContext(application); if (VM.IsDirectoryExist) { if (VM.IsFileConfigExist) { VM.CreateButtons(); } else { MainWindow mainWindow = new MainWindow { DataContext = VM }; mainWindow.Show(); } } else { TaskDialog.Show("Ошибка", "Отсутствует файл с дирректорией"); return(Result.Failed); } return(Result.Succeeded); //} //catch //{ // MessageBox.Show("Не удалось сформировать окно"); // return Result.Failed; //} // string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location; // //Создаем вкладку // string tabName = "GreenBIM"; // try { application.CreateRibbonTab(tabName); } catch { } // //Создаем панель видов // string panelName = "Виды"; // RibbonPanel panel1 = null; // List<RibbonPanel> tryPanels = application.GetRibbonPanels(tabName).Where(i => i.Name == panelName).ToList(); // if (tryPanels.Count == 0) // { // panel1 = application.CreateRibbonPanel(tabName, panelName); // } // else // { // panel1 = tryPanels.First(); // } // //Создаем панель проверок // string panelName1 = "Проверки"; // RibbonPanel panel2 = null; // tryPanels = application.GetRibbonPanels(tabName).Where(i => i.Name == panelName1).ToList(); // if (tryPanels.Count == 0) // { // panel2 = application.CreateRibbonPanel(tabName, panelName1); // } // else // { // panel2 = tryPanels.First(); // } // //Создаем панель для бимов // string panelName2 = "BIM"; // RibbonPanel BIMpanel = null; // tryPanels = application.GetRibbonPanels(tabName).Where(i => i.Name == panelName2).ToList(); // if (tryPanels.Count == 0) // { // BIMpanel = application.CreateRibbonPanel(tabName, panelName2); // } // else // { // BIMpanel = tryPanels.First(); // } // //Создаем кнопку "Корректировки названия" // string buttonName1 = "RenameViews"; // string buttonText1 = "Корректировка \n названия"; // PushButton btn1 = panel1.AddItem(new PushButtonData( // buttonName1, // buttonText1, // assemblyPath, // "GreenBIM.RenameViews") // ) as PushButton; // btn1.LargeImage = PngImageSource("GreenBIM.Resources.gbscripts32.png"); // //Создаем кнопку "Проверка вложенных" // string buttonName2 = "GetInputElement"; // string buttonText2 = "Проверка \n вложенных"; // PushButton btn2 = panel2.AddItem(new PushButtonData( // buttonName2, // buttonText2, // assemblyPath, // "GreenBIM.GetInputElement") // ) as PushButton; //btn2.LargeImage = PngImageSource("GreenBIM.Resources.gbscripts32.png"); // //Создаем кнопку "Соединения коннекторов" // string buttonName3 = "ConnectingConnectors"; // string buttonText3 = "Соединение \n коннекторов"; // PushButton btn3 = BIMpanel.AddItem(new PushButtonData( // buttonName3, // buttonText3, // assemblyPath, // "GreenBIM.ConnectingConnectors") // ) as PushButton; // btn3.LargeImage = PngImageSource("GreenBIM.Resources.gbscripts32.png"); // //Создаем кнопку "Тест типоразмеров семейств" // string buttonName4 = "FamilySymbolTest"; // string buttonText4 = "Тест типоразмеров \n семейств"; // PushButton btn4 = BIMpanel.AddItem(new PushButtonData( // buttonName4, // buttonText4, // assemblyPath, // "GreenBIM.FamilySymbolTestPr.FamilySymbolTest") // ) as PushButton; // btn4.LargeImage = PngImageSource("GreenBIM.Resources.gbscripts32.png"); }
Result IExternalApplication.OnShutdown(UIControlledApplication application) { return(Result.Succeeded); }
/// <summary> /// Implements the OnStartup event /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { CreateCopyPastePanel(application); return(Result.Succeeded); }
public Result OnShutdown(UIControlledApplication a) { return(Result.Succeeded); }
public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application) { TaskDialog.Show("Revit", "Quit External Application!"); return(Autodesk.Revit.UI.Result.Succeeded); }
public Result OnStartup(UIControlledApplication a) { return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication a) { a.ControlledApplication.FileImporting += ControlledApplication_FileImporting; return(Result.Succeeded); }
public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application) { return(Result.Succeeded); }
/// Implement OnShutdown method of IExternalApplication interface to unregister subscribed event public Result OnShutdown(UIControlledApplication application) { // remove the event. application.ControlledApplication.DocumentOpened -= application_DocumentOpened; return(Result.Succeeded); }
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { return(Autodesk.Revit.UI.Result.Succeeded); }
// internal UIControlledApplication uiCtrlApp; // public static PulldownButton pb; // public static SplitButton sb; public Result OnStartup(UIControlledApplication app) { try { // uiCtrlApp = app; app.ControlledApplication.ApplicationInitialized += OnAppInitalized; // create the ribbon tab first - this is the top level // ui item. below this will be the panel that is "on" the tab // and below this will be a pull down or split button that is "on" the panel; // give the tab a name; string tabName = TAB_NAME; // give the panel a name string panelName = PANEL_NAME; // first try to create the tab try { app.CreateRibbonTab(tabName); } catch (Exception) { // might already exist - do nothing } // tab created or exists // create the ribbon panel if needed RibbonPanel ribbonPanel = null; // check to see if the panel already exists // get the Panel within the tab name List <RibbonPanel> rp = new List <RibbonPanel>(); rp = app.GetRibbonPanels(tabName); foreach (RibbonPanel rpx in rp) { if (rpx.Name.ToUpper().Equals(panelName.ToUpper())) { ribbonPanel = rpx; break; } } // if panel not found // add the panel if it does not exist if (ribbonPanel == null) { // create the ribbon panel on the tab given the tab's name // FYI - leave off the ribbon panel's name to put onto the "add-in" tab ribbonPanel = app.CreateRibbonPanel(tabName, panelName); } ribbonPanel.AddItem( createButton("PramView", "Param\nVue", "ParamView", "View the Parameters of a Family", SMALLICON, LARGEICON)); // // example 1 // //add a pull down button to the panel // if (!AddPullDownButton(ribbonPanel)) // { // // create the split button failed // MessageBox.Show("Failed to Add the Pull Down Button!", "Information", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); // return Result.Failed; // } // // // example 2 // //add a stacked pair of push buttons to the panel // if (!AddStackedPushButtons(ribbonPanel)) // { // // create the split button failed // MessageBox.Show("Failed to Add the Stacked Push Buttons!", "Information", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); // return Result.Failed; // } // // // example 3 // //add a stacked pair of push buttons and a text box to the panel // if (!AddStackedPushButtonsAndTextBox(ribbonPanel)) // { // // create the split button failed // MessageBox.Show("Failed to Add the Stacked Push Buttons and TextBox!", "Information", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); // return Result.Failed; // } } catch (Exception e) { Debug.WriteLine("exception " + e.Message); return(Result.Failed); } return(Result.Succeeded); }
/// <summary> /// Implement this method to execute some tasks when Autodesk Revit shuts down. /// </summary> public abstract Result OnShutdown(IContainerResolver container, UIControlledApplication application);
public Result OnStartup(UIControlledApplication application) { application.ControlledApplication.DocumentOpened += new EventHandler <DocumentOpenedEventArgs>(docOpen); return(Result.Succeeded); }
/// <summary> /// Implements the OnShutdown event /// </summary> /// <param name="application"></param> /// <returns>Result that indicates whether the external application has completed its work successfully.</returns> public Result OnShutdown(UIControlledApplication application) { // remove the event. application.ControlledApplication.DocumentClosing -= OnDocumentClosing; return(Result.Succeeded); }
public Result OnShutdown(UIControlledApplication application) { // do nothing return(Result.Succeeded); }
/// <summary> /// Implements the OnStartup event /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { CreateScheduleFormatterPanel(application); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { // call our method that will load up our toolbar AddRibbonPanel(application); return(Result.Succeeded); }
public Result OnShutdown(UIControlledApplication a) { kilargo.properities.pass = false; return(Result.Succeeded); }
// define a method that will create our tab and button private static void AddRibbonPanel(UIControlledApplication application) { // Get dll assembly path string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; // Create a custom ribbon tab string tabName = "Take It Easy"; application.CreateRibbonTab(tabName); // Add level tools ribbon panel RibbonPanel levelToolRibbonPanel = application.CreateRibbonPanel(tabName, "Level Tools"); // Create push button for LevelCreation PushButton pbLevelCreation = levelToolRibbonPanel.AddItem( CreatePushButtonData( "cmdLevelCreation", "Create" + System.Environment.NewLine + "Levels", thisAssemblyPath, "DCEStudyTools.LevelCreation.LevelCreation", "levels_32.png", String.Empty, "Enter Number Of Floors to Create Levels, ViewPlans and Sheets for Each Level") ) as PushButton; // Create push button for LevelConfigration PushButton pbLevelConfig = levelToolRibbonPanel.AddItem( CreatePushButtonData( "cmdLevelConfig", "Configurate" + System.Environment.NewLine + "Structural Levels", thisAssemblyPath, "DCEStudyTools.Configuration.LevelConfiguration", "level_setting_32.png", String.Empty, "Set the levels for structural elements") ) as PushButton; // Create push button for LevelRenaming PushButton pbLevelRenaming = levelToolRibbonPanel.AddItem( CreatePushButtonData( "cmdLevelRenaming", "Rename" + System.Environment.NewLine + "Structural Levels", thisAssemblyPath, "DCEStudyTools.LevelRenaming.LevelRenaming", "rename_32.png", String.Empty, "Rename the levels for structural elements") ) as PushButton; // Create push button for LevelTransfer PushButton pbLevelTransfer = levelToolRibbonPanel.AddItem( CreatePushButtonData( "cmdLevelTranfer", "Transfer" + System.Environment.NewLine + "Structural Levels", thisAssemblyPath, "DCEStudyTools.LevelTransfer.LevelTransfer", "transfer_32.png", String.Empty, "Tranfer all structural elements from actural levels to the structural levels") ) as PushButton; ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add view tools ribbon panel RibbonPanel viewToolRibbonPanel = application.CreateRibbonPanel(tabName, "View Tools"); // Create push button for ViewDuplicate PushButton pbViewDuplicate = viewToolRibbonPanel.AddItem( CreatePushButtonData( "cmdViewDuplicate", "Duplicate" + System.Environment.NewLine + "Views", thisAssemblyPath, "DCEStudyTools.ViewDuplicate.ViewDuplicate", "duplicate_32.png", String.Empty, "Duplicate the selected view according to the number of zone de définition") ) as PushButton; // Create push button for 3DViewCreation PushButton pb3DView = viewToolRibbonPanel.AddItem( CreatePushButtonData( "cmd3DViewCreation", "Create/Update" + System.Environment.NewLine + "3D Views", thisAssemblyPath, "DCEStudyTools.ThreeDViewsCreation.ThreeDViewsCreation", "3dview_32.png", String.Empty, "Create a 3D View for each Level") ) as PushButton; // Create push button for ViewDuplicate PushButton pbViewToSheet = viewToolRibbonPanel.AddItem( CreatePushButtonData( "cmdViewToSheet", "Add View" + System.Environment.NewLine + "To Sheet", thisAssemblyPath, "DCEStudyTools.ViewToSheet.ViewToSheet", "view_to_sheet_32.png", String.Empty, "Add corresponding views to the sheet") ) as PushButton; ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add sheet tools ribbon panel RibbonPanel sheetToolRibbonPanel = application.CreateRibbonPanel(tabName, "Sheet Tools"); // Create push button for SheetCreation PushButton pbSheetCreation = sheetToolRibbonPanel.AddItem( CreatePushButtonData( "cmdSheetCreation", "Create" + System.Environment.NewLine + "Sheets", thisAssemblyPath, "DCEStudyTools.SheetCreation.SheetCreation", "sheet_create_32.png", String.Empty, "Create Sheets for Each Level") ) as PushButton; PushButton pbLegendUpdate = sheetToolRibbonPanel.AddItem( CreatePushButtonData( "cmdLegendUpdate", "Add/Update" + System.Environment.NewLine + "Legend", thisAssemblyPath, "DCEStudyTools.LegendUpdate.LegendUpdate", "legend_32.png", String.Empty, "Update the legend on each sheet") ) as PushButton; ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add beam tools ribbon panel RibbonPanel beamToolRibbonPanel = application.CreateRibbonPanel(tabName, "Beam Tools"); // Create push button for beam type detect PushButton pbBeamTypeDetect = beamToolRibbonPanel.AddItem( CreatePushButtonData( "cmdBeamTypeCorrect", "Correct" + System.Environment.NewLine + "Beam Type", thisAssemblyPath, "DCEStudyTools.BeamTypeCorrect.BeamTypeCorrect", "beam_correct_32.png", "beam_correct_16.png", "Correct the type of beams whose type are not appropriate") ) as PushButton; // Create push button for beam type detect PushButton pbBeamUnjoint = beamToolRibbonPanel.AddItem( CreatePushButtonData( "cmdBeamUnjoint", "Unjoint" + System.Environment.NewLine + "BN & Talon PV", thisAssemblyPath, "DCEStudyTools.BeamUnjoint.BeamUnjoint", "unjoint_32.png", "unjoint_16.png", "Unjoint all the \"BN\" and \"Talon PV\"") ) as PushButton; // Create push button for beam type change PushButton pbBeamTypeChangeData = beamToolRibbonPanel.AddItem( CreatePushButtonData( "cmdBeamTypeChange", "Change" + System.Environment.NewLine + "Beam Type", thisAssemblyPath, "DCEStudyTools.BeamTypeChange.BeamTypeChange", "beam_update_32.png", "beam_update_16.png", "Select beams to be changed and choose the target type") ) as PushButton; // Create push button data for beam type name adjustment PushButtonData pbBeamTypeNameAdjustData = CreatePushButtonData( "cmdBeamTypeNameAdjust", "Adjust Beam" + System.Environment.NewLine + "Type Name", thisAssemblyPath, "DCEStudyTools.BeamTypeNameAdjust.BeamTypeNameAdjust", "beam_name_32.png", "beam_name_16.png", "Update the type name of ALL beam types according to their properties"); // Create push button data for beam type properties adjustment PushButtonData pbBeamTypePropertiesAdjustData = CreatePushButtonData( "cmdBeamTypePropertiesAdjust", "Adjust Beam" + System.Environment.NewLine + "Type Properties", thisAssemblyPath, "DCEStudyTools.BeamTypePropertiesAdjust.BeamTypePropertiesAdjust", "beam_name_32.png", "beam_name_16.png", "Update the properties \"Poutre type\", \"Matérial\", \"Largeur\" and \"Hauteur\" of ALL beam types according to their type name, " + "if their type name is in format of \"XXX-BAdd-ddxdd\""); // Create "Beam Adjust" split button SplitButtonData sbBeamAdjustData = new SplitButtonData("cmdBeamAdjust", "Beam Type Adjust"); SplitButton sbBeamAdjust = beamToolRibbonPanel.AddItem(sbBeamAdjustData) as SplitButton; sbBeamAdjust.AddPushButton(pbBeamTypeNameAdjustData); sbBeamAdjust.AddPushButton(pbBeamTypePropertiesAdjustData); ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add column tools ribbon panel RibbonPanel columnToolRibbonPanel = application.CreateRibbonPanel(tabName, "Column Tools"); // Create push button data for column type name adjustment PushButtonData pbColumnTypeNameAdjustData = CreatePushButtonData( "cmdColumnTypeNameAdjust", "Adjust Column" + System.Environment.NewLine + "Type Name", thisAssemblyPath, "DCEStudyTools.ColumnTypeNameAdjust.ColumnTypeNameAdjust", "column_32.png", "column_16.png", "Update the type name of ALL column types according to their properties"); // Create push button data for column type properties adjustment PushButtonData pbColumnTypePropertiesAdjustData = CreatePushButtonData( "cmdColumnTypePropertiesAdjust", "Adjust Column" + System.Environment.NewLine + "Type Properties", thisAssemblyPath, "DCEStudyTools.ColumnTypePropertiesAdjust.ColumnTypePropertiesAdjust", "column_32.png", "column_16.png", "Update the properties \"Matérial\", \"Largeur\" and \"Hauteur\" / \"Diamètre\" of ALL column types according to their type name, " + "if their type name is in format of \"POT-BAdd-ddxdd\" / \"POT-BAdd-Ddd\""); // Create "Column Adjust" split button SplitButtonData sbColAdjustData = new SplitButtonData("cmdColumnAdjust", "Column Type Adjust"); SplitButton sbColAdjust = columnToolRibbonPanel.AddItem(sbColAdjustData) as SplitButton; sbColAdjust.AddPushButton(pbColumnTypeNameAdjustData); sbColAdjust.AddPushButton(pbColumnTypePropertiesAdjustData); ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add wall tools ribbon panel RibbonPanel wallToolRibbonPanel = application.CreateRibbonPanel(tabName, "Wall Tools"); // Create push button data for wall type name adjustment PushButtonData pbWallTypeNameAdjustData = CreatePushButtonData( "cmdWallTypeNameAdjust", "Adjust Wall" + System.Environment.NewLine + "Type Name", thisAssemblyPath, "DCEStudyTools.WallTypeNameAdjust.WallTypeNameAdjust", "wall_name_32.png", "wall_name_16.png", "Update the type name of ALL wall types according to their properties"); // Create push button data for wall type properties adjustment PushButtonData pbWallTypePropertiesAdjustData = CreatePushButtonData( "cmdWallTypePropertiesAdjust", "Adjust Wall" + System.Environment.NewLine + "Type Properties", thisAssemblyPath, "DCEStudyTools.WallTypePropertiesAdjust.WallTypePropertiesAdjust", "wall_name_32.png", "wall_name_16.png", "Update the properties \"Matérial\", \"Epaisseur\" of ALL wall types according to their type name, " + "if their type name is in format of \"MUR-BAdd-EPdd\""); // Create "Wall Adjust" split button SplitButtonData sbWallAdjustData = new SplitButtonData("cmdWallAdjust", "Wall Type Adjust"); SplitButton sbWallAdjust = wallToolRibbonPanel.AddItem(sbWallAdjustData) as SplitButton; sbWallAdjust.AddPushButton(pbWallTypeNameAdjustData); sbWallAdjust.AddPushButton(pbWallTypePropertiesAdjustData); ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add CAD link tools ribbon panel RibbonPanel cadLinkToolRibbonPanel = application.CreateRibbonPanel(tabName, "CAD Link Tools"); // Create push button for CADLink PushButton pbAddLink = cadLinkToolRibbonPanel.AddItem( CreatePushButtonData( "cmdAddLink", "Add" + System.Environment.NewLine + "CAD Link", thisAssemblyPath, "DCEStudyTools.CADLink.CADLink", "link_32.png", String.Empty, "Add CAD links") ) as PushButton; // Create push button for setting underlayer PushButtonData pbSetUnderlayer = CreatePushButtonData( "cmdSetUnderlayer", "Set Underlayer", thisAssemblyPath, "DCEStudyTools.UnderlaySetting.UnderlaySetting", "underlayer_32.png", "underlayer_16.png", "Set underlayer and halftone for all the view plans"); // Create push button for underlayer undo PushButtonData pbUndoUnderlayer = CreatePushButtonData( "cmdUndoUnderlayer", "Undo Underlayer", thisAssemblyPath, "DCEStudyTools.UnderlayUndo.UnderlayUndo", "undo_32.png", "undo_16.png", "Undo underlayer for all the view plans"); cadLinkToolRibbonPanel.AddStackedItems(pbSetUnderlayer, pbUndoUnderlayer); // Create push button for setting halftone PushButtonData pbSettingHalftone = CreatePushButtonData( "cmdSetHalftone", "Set Halftone", thisAssemblyPath, "DCEStudyTools.HalftoneSetting.HalftoneSetting", "Halftone_32.png", "Halftone_16.png", "Set halftone for all the view plans"); // Create push button for undoing halftone PushButtonData pbUndoHalftone = CreatePushButtonData( "cmdUndoHalftone", "Undo Halftone", thisAssemblyPath, "DCEStudyTools.HalftoneUndo.HalftoneUndo", "undo_32.png", "undo_16.png", "Undo halftone for all the view plans"); cadLinkToolRibbonPanel.AddStackedItems(pbSettingHalftone, pbUndoHalftone); ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add tool ribbon panel RibbonPanel genericToolsRibbonPanel = application.CreateRibbonPanel(tabName, "Generic Tools"); // Create push button for Test PushButton pbTest = genericToolsRibbonPanel.AddItem( CreatePushButtonData( "cmdTest", "Test/Debug", thisAssemblyPath, "DCEStudyTools.Test.Test", "test_32.png", String.Empty, "") ) as PushButton; // Create push button for LevelsCreation PushButton pbScaleSetting = genericToolsRibbonPanel.AddItem( CreatePushButtonData( "cmdScaleSetting", "Set" + System.Environment.NewLine + "Scale", thisAssemblyPath, "DCEStudyTools.ScaleSetting.ScaleSetting", "scale_32.png", String.Empty, "Set the scale to fit the size of sheet") ) as PushButton; // Create push button for hiding categories PushButton pbCatHide = genericToolsRibbonPanel.AddItem( CreatePushButtonData( "cmdCategoryHiding", "Hide" + System.Environment.NewLine + "Categories", thisAssemblyPath, "DCEStudyTools.CategoriesHiding.CategoriesHiding", "hide_32.png", String.Empty, "Pick up elements, the categories of the elements will be hidden on the active view or on the view template of the active view") ) as PushButton; // Create push button for TagsAdjustment PushButton pbTags = genericToolsRibbonPanel.AddItem( CreatePushButtonData( "cmdTagsAdjustment", "Adjust" + System.Environment.NewLine + "Tags", thisAssemblyPath, "DCEStudyTools.TagsAdjustment.TagsAdjustment", "tag_32.png", String.Empty, "Adjust Beam and Column Tags") ) as PushButton; // Create push button for FloorSpanDirectionChange PushButton pbFloorSpanDirection = genericToolsRibbonPanel.AddItem( CreatePushButtonData( "cmdFloorSpanDirectionChange", "Change Floor" + System.Environment.NewLine + "Span Direction", thisAssemblyPath, "DCEStudyTools.FloorSpanDirection.FloorSpanDirectionChange", "direction_32.png", String.Empty, "Change Floor Span Direction") ) as PushButton; // Create push button for FoundationLoad PushButton pbFoundationLoad = genericToolsRibbonPanel.AddItem( CreatePushButtonData( "cmdFoundationLoadCreation", "Create" + System.Environment.NewLine + "Foundation Load", thisAssemblyPath, "DCEStudyTools.FoundationLoadCreation.FoundationLoadCreation", "load_32.png", String.Empty, "Create load for each foundation") ) as PushButton; ////////////////////////////////////////////////////// Seperate line //////////////////////////////////////////////////// // Add a new ribbon panel RibbonPanel conceptionRibbonPanel = application.CreateRibbonPanel(tabName, "Conception Tools"); // Create "Wall Marking" button for "Wall Design" split button PushButtonData pbAddWallData = CreatePushButtonData( "cmdWallMarking", "Mark Concrete" + System.Environment.NewLine + "Bearing Walls", thisAssemblyPath, "DCEStudyTools.Design.Wall.WallMarking", "wall_32.png", String.Empty, "Select the Walls who will be marked as a Concrete Bearing Wall"); // Create "Wall Removing" button for "Wall Design" split button PushButtonData pbRmvWallData = CreatePushButtonData( "cmdWallUnmarking", "Unmark Concrete" + System.Environment.NewLine + "Bearing Walls", thisAssemblyPath, "DCEStudyTools.Design.Wall.WallUnmarking", "wall_remove_32.png", String.Empty, "Select the Walls who will be unmarked as a Concrete Bearing Walls"); // Create "Wall Design" split button SplitButtonData sbWallData = new SplitButtonData("cmdWallDesign", "Wall Design"); SplitButton sbWall = conceptionRibbonPanel.AddItem(sbWallData) as SplitButton; sbWall.AddPushButton(pbAddWallData); sbWall.AddPushButton(pbRmvWallData); // Create "Beam Axe Creation" button for "Beam Design" split button PushButtonData pbAddBeamData = CreatePushButtonData( "cmdBeamMarking", "Mark" + System.Environment.NewLine + "Beam Axe", thisAssemblyPath, "DCEStudyTools.Design.Beam.BeamAxeMarking.BeamMarkingWithoutDimension", "beam_32.png", String.Empty, "Add Structural Beams for Principal Design"); // Create "Beam Marking With Dimension" button for "Beam Design" split button PushButtonData pbAddWDBeamData = CreatePushButtonData( "cmdBeamMarkingWithDimension", "Mark Beam Axe" + System.Environment.NewLine + "With Dimension", thisAssemblyPath, "DCEStudyTools.Design.Beam..BeamAxeMarking.BeamMarkingWithDimension", "beam_dimension_32.png", String.Empty, "Add Structural Beams with Entering Section Dimensions"); // Create "Beam Dimension Editing" button for "Beam Design" split button PushButtonData pbEditSectionData = CreatePushButtonData( "cmdBeamSectionEditing", "Edit Beam" + System.Environment.NewLine + "Section Dimension", thisAssemblyPath, "DCEStudyTools.Design.Beam.DimensionEditing.DimensionEditing", "dimension_edit_32.png", String.Empty, "Edit Beam Section Dimension"); // Create "Structural Beam Creation" button for "Beam Design" split button PushButtonData pbCreateBeamData = CreatePushButtonData( "cmdBeamCreation", "Create Beam" + System.Environment.NewLine + "By Axes", thisAssemblyPath, "DCEStudyTools.Design.Beam.BeamCreation.BeamCreation", "beam_confirm_32.png", String.Empty, "Create Structural Beams according to the beam axes"); // Create "Beam Design" split button SplitButtonData sbBeamData = new SplitButtonData("cmdBeamDesign", "Beam Design"); SplitButton sbBeam = conceptionRibbonPanel.AddItem(sbBeamData) as SplitButton; sbBeam.AddPushButton(pbAddBeamData); sbBeam.AddPushButton(pbAddWDBeamData); sbBeam.AddPushButton(pbEditSectionData); sbBeam.AddPushButton(pbCreateBeamData); }
public Result OnStartup(UIControlledApplication a) { #if SAM string tabName = "SAM"; #else string tabName = "SuperTab"; #endif try { AddRibbonPanel(a, tabName); RibbonPanel docsPanel = GetSetRibbonPanel(a, tabName, "Documentation"); RibbonPanel toolsPanel = GetSetRibbonPanel(a, tabName, "Tools"); RibbonPanel beams = GetSetRibbonPanel(a, tabName, "Structural Framings"); RibbonPanel walls = GetSetRibbonPanel(a, tabName, "Walls"); #if DEBUG RibbonPanel geometry = GetSetRibbonPanel(a, tabName, "Geometry"); #endif RibbonPanel commandPanel = GetSetRibbonPanel(a, tabName, "Command Line"); RibbonPanel zeroState = GetSetRibbonPanel(a, tabName, "Zero State"); #region Documentation IList <PushButtonData> splitButtonsViews = new List <PushButtonData>(); splitButtonsViews.Add(CreatePushButton("btnSheetAddCurrentView", "Add View\nto Sheet", "", "pack://application:,,,/ReviTab;component/Resources/addView.png", "ReviTab.AddActiveViewToSheet", "Add the active view to a sheet")); splitButtonsViews.Add(CreatePushButton("btnAddSheetByNumber", "Add Sheet\nby Number", "", "pack://application:,,,/ReviTab;component/Resources/addView.png", "ReviTab.CreateSheetByNumber", "Create a Sheet by providing its number and package.")); splitButtonsViews.Add(CreatePushButton("btnAddMultipleViews", "Add Multiple\nViews", "", "pack://application:,,,/ReviTab;component/Resources/addMultipleViews.png", "ReviTab.AddMultipleViewsToSheet", "Add multiple views to a sheet. Select the views in the project browser.")); splitButtonsViews.Add(CreatePushButton("btnAddLegends", "Add Legend\nto Sheets", "", "pack://application:,,,/ReviTab;component/Resources/legend.png", "ReviTab.AddLegendToSheets", "Place a legend onto multiple sheets in the same place.")); splitButtonsViews.Add(CreatePushButton("btnCreateViewset", "Create\nViewset", "", "pack://application:,,,/ReviTab;component/Resources/createViewSet.png", "ReviTab.CreateViewSet", "Create a Viewset from a list of Sheet Numbers")); splitButtonsViews.Add(CreatePushButton("btnAlignViews", "Align Viewports", "", "pack://application:,,,/ReviTab;component/Resources/revCloud.png", "ReviTab.AlignViews", "Select views on sheets in the project browser first then click on this button.")); splitButtonsViews.Add(CreatePushButton("btnTagInView", "Tag Elements", "", "pack://application:,,,/ReviTab;component/Resources/tag.png", "ReviTab.TagElementsInViewport", "Tag all the columns within the selected Viewports.")); splitButtonsViews.Add(CreatePushButton("btnDuplicateViews", "Duplicate Views", "", "pack://application:,,,/ReviTab;component/Resources/duplicateSheets.png", "ReviTab.DuplicateSheets", "Duplicate selected sheets with viewports, schedules and legends.")); #if !SAM splitButtonsViews.Add(CreatePushButton("btnImportRhino", "Rhino Import", "", "pack://application:,,,/ReviTab;component/Resources/tag.png", "ReviTab.RhinoImport", "Import details from Rhino to Revit drafting view.")); #endif AddSplitButton(docsPanel, splitButtonsViews, "DocumentationButton", "Documentation"); //Titleblock revisions IList <PushButtonData> stackedButtonsSheets = new List <PushButtonData> { CreatePushButton("btnSetTitleblock", "Set Titleblock\nScale", "pack://application:,,,/ReviTab;component/Resources/rulerSmall.png", "", "ReviTab.SetTitleblockScale", "Set the current sheet titleblock scale to the most used."), CreatePushButton("btnUpRevSheet", "Uprev Sheet", "pack://application:,,,/ReviTab;component/Resources/addRev.png", "", "ReviTab.UpRevSheet", "Up rev the current sheet. It copies the content from the previous revision excluding the date"), CreatePushButton("btnRemoveRev", "Remove first\nRevision", "pack://application:,,,/ReviTab;component/Resources/deleteRev.png", "", "ReviTab.RemoveFirstRevision", "Remove the first revision of a titleblock (i.e. shift revisions down).") }; AddStackedButton(docsPanel, stackedButtonsSheets, "SheetsButton", "Sheets"); #if DEBUG //TextFonts and LineStyles IList <PushButtonData> stackedButtonsTextAndLines = new List <PushButtonData> { CreatePushButton("btnTextFonts", "List TextNotes", "pack://application:,,,/ReviTab;component/Resources/addRev.png", "", "ReviTab.TextFonts", "List all the TextNotes in the project to the active view. Set View Scale to 1:1 to display the list correctly."), CreatePushButton("btnDeleteTextNotes", "Delete TextNotes Types", "pack://application:,,,/ReviTab;component/Resources/deleteRev.png", "", "ReviTab.DeleteTextFont", "Delete the selcted TextNotes types."), CreatePushButton("btnLineStyles", "List Line Styles", "pack://application:,,,/ReviTab;component/Resources/addRev.png", "", "ReviTab.LineStyles", "List all the Line Styles in the project to the active view. Set View Scale to 1:1 to display the list correctly.") }; AddStackedButton(docsPanel, stackedButtonsTextAndLines, "TextAndLines", "TextLines"); #endif // Excel interop IList <PushButtonData> splitButtonsDataToExcel = new List <PushButtonData>(); splitButtonsDataToExcel.Add(CreatePushButton("btnDataToExcel", "Data to\nExcel", "", "pack://application:,,,/ReviTab;component/Resources/excel.png", "ReviTab.SelectedDataToExcel", "Export parameters content to Excel for easy manipulation.")); splitButtonsDataToExcel.Add(CreatePushButton("btnDataFromExcel", "Data from\nExcel", "", "pack://application:,,,/ReviTab;component/Resources/excel.png", "ReviTab.UpdateDataFromExcel", "Update parameter values with data from Excel.")); splitButtonsDataToExcel.Add(CreatePushButton("btnVportToExcel", "Viewport to\nExcel", "", "pack://application:,,,/ReviTab;component/Resources/excel.png", "ReviTab.ViewportsToExcel", "Export viewports info to Excel.")); splitButtonsDataToExcel.Add(CreatePushButton("btnVportFromExcel", "Viewport from\nExcel", "", "pack://application:,,,/ReviTab;component/Resources/excel.png", "ReviTab.UpdateViewportsFromExcel", "Update viewports info from Excel.")); splitButtonsDataToExcel.Add(CreatePushButton("btnSelectFromExcel", "Select from\nExcel", "", "pack://application:,,,/ReviTab;component/Resources/excel.png", "ReviTab.SelectFromExcel", "Select elements in the project from a list of IDs saved in the clipboard from Excel (Ctrl+C the Ids in Excel, then run the command).")); //Revision Clouds splitButtonsDataToExcel.Add(CreatePushButton("btnSetRevCloud", "Rev Cloud\nSummary", "", "pack://application:,,,/ReviTab;component/Resources/excel.png", "ReviTab.RevisionCloudsSummary", "Export revision cloud summary.")); AddSplitButton(docsPanel, splitButtonsDataToExcel, "ExcelButton", "ExcelLink"); #if DEBUG //DB interop IList <PushButtonData> splitButtonsInterop = new List <PushButtonData>(); splitButtonsInterop.Add(CreatePushButton("btnManage", "Update Status", "", "pack://application:,,,/ReviTab;component/Resources/manage.png", "ReviTab.UpdateModelStatus", "Update model status dashboard.")); splitButtonsInterop.Add(CreatePushButton("btnAirtable", "Push to Airtable", "", "pack://application:,,,/ReviTab;component/Resources/airtable.png", "ReviTab.PushToAirtable", "Push the Model Status content to Airtable table")); splitButtonsInterop.Add(CreatePushButton("btnPush", "Push to DB", "", "pack://application:,,,/ReviTab;component/Resources/arrowUp.png", "ReviTab.PushToDB", "Push date, user, rvtFileSize, elementsCount, typesCount, sheetsCount, viewsCount, viewportsCount, warningsCount to 127.0.0.1")); AddSplitButton(docsPanel, splitButtonsInterop, "InteropDBButton", "InteropDB"); #endif #endregion #region Tools IList <PushButtonData> splitButtonsSections = new List <PushButtonData> { CreatePushButton("btnCreateSectionsColumns", "Column Sections", "", "pack://application:,,,/ReviTab;component/Resources/multipleSections.png", "ReviTab.CreateSectionColumns", "Create multiple sections for selected columns."), CreatePushButton("btnCreateSections", "Line based" + Environment.NewLine + "Sections", "", "pack://application:,,,/ReviTab;component/Resources/multipleSections.png", "ReviTab.CreateSections", "Create multiple sections for line based elements (walls, beams, lines)."), CreatePushButton("btnFlipSections", "Flip Sections", "", "pack://application:,,,/ReviTab;component/Resources/multipleSections.png", "ReviTab.FlipSections", "Flip multiple sections.") }; AddSplitButton(toolsPanel, splitButtonsSections, "SectionsButton", "MultipleSections"); if (AddPushButton(toolsPanel, "btnSelectText", "Select All" + Environment.NewLine + "Text", "", "pack://application:,,,/ReviTab;component/Resources/selectText.png", "ReviTab.SelectAllText", "Select all text notes in the project. Useful if you want to run the check the spelling.") == false) { MessageBox.Show("Failed to add button Select all text", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } //GRIDS IList <PushButtonData> gridTools = new List <PushButtonData> { CreatePushButton("btnSwapGrid", "Swap Grid" + Environment.NewLine + "Head", "", "pack://application:,,,/ReviTab;component/Resources/swapGrids.png", "ReviTab.SwapGridBubbles", "Swap the head of the selected grids"), CreatePushButton("btnCopyGrid", "Copy Grid Extents", "", "pack://application:,,,/ReviTab;component/Resources/swapGrids.png", "ReviTab.PropagateGridExtents", "Copy the grid extents from a view to the active one.") }; AddSplitButton(toolsPanel, gridTools, "gridTools", "Grid Tools"); //OVERRIDES IList <PushButtonData> overrideTools = new List <PushButtonData> { CreatePushButton("btnOverrideDimensions", "Override \nDimension", "", "pack://application:,,,/ReviTab;component/Resources/dimensionOverride.png", "ReviTab.OverrideDimensions", "Override the text of a dimension"), CreatePushButton("btnOverrideColoor", "Override Colours", "", "pack://application:,,,/ReviTab;component/Resources/airtable.png", "ReviTab.OverrideColors", "Override the colours of the structural elements in the active view.") }; AddSplitButton(toolsPanel, overrideTools, "overrideTools", "Override Tools"); //LINK FILES IList <PushButtonData> linkFiles = new List <PushButtonData> { CreatePushButton("btnAlignColumns", "Align Columns", "", "pack://application:,,,/ReviTab;component/Resources/alignColumns.png", "ReviTab.AlignColumns", "Align the columns in the model to those selected in a linked model. There is an hardcoded tolerance of 3feet as maximum distance between the linked column and the one to be moved."), CreatePushButton("btnCopyLinkedElements", "Copy Linked \nElements", "", "pack://application:,,,/ReviTab;component/Resources/copyLinked.png", "ReviTab.CopyLinkedElements", "Copy elements from linked models") }; AddSplitButton(toolsPanel, linkFiles, "linkFiles", "Link Files"); IList <PushButtonData> filterSelection = new List <PushButtonData> { CreatePushButton("selBeams", "Select Beams", "", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionBeams", "Select Beams Only"), CreatePushButton("selColumns", "Select Columns", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionColumns", "Select Columns Only"), CreatePushButton("selDim", "Select Dimensions", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionDimensions", "Select Dimensions Only"), CreatePushButton("selGrids", "Select Grids", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionGrids", "Select Grids Only"), CreatePushButton("selLines", "Select Lines", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionLines", "Select Lines Only"), CreatePushButton("selTags", "Select Tags", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionTags", "Select Tags Only"), CreatePushButton("selText", "Select Text", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionText", "Select Text Only"), CreatePushButton("selWalls", "Select Walls", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "pack://application:,,,/ReviTab;component/Resources/selectFilter.png", "ReviTab.FilterSelectionWalls", "Select Walls Only") }; AddSplitButton(toolsPanel, filterSelection, "filterSelection", "Filter Selection"); if (AddPushButton(toolsPanel, "btnPrintSelected", "Print Selected", "", "pack://application:,,,/ReviTab;component/Resources/backgroundPrint.png", "ReviTab.PrintSelected", "Print the selected Sheets in the Project Browsser") == false) { MessageBox.Show("Failed to add button Print Selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion #region Structural Framing #if DEBUG IList <PushButtonData> stackedButtonsCQT = new List <PushButtonData>(); stackedButtonsCQT.Add(CreatePushButton("btnPlaceVoidByFace", "Place Void" + Environment.NewLine + "By Face", "", "pack://application:,,,/ReviTab;component/Resources/addBeamOpening.png", "ReviTab.VoidByFace", "Place a void on a beam face")); stackedButtonsCQT.Add(CreatePushButton("btnPlaceVoidByLine", "Void By Line", "", "pack://application:,,,/ReviTab;component/Resources/line.png", "ReviTab.VoidByLine", "Place a void at line beam intersection. Contact: Ethan Gear.")); stackedButtonsCQT.Add(CreatePushButton("btnPlaceVoidByRefPlane", "Void By Reference Plane", "", "pack://application:,,,/ReviTab;component/Resources/line.png", "ReviTab.VoidByRefPlane", "Place a void at line beam intersection. Contact: Ethan Gear.")); stackedButtonsCQT.Add(CreatePushButton("btnPlaceTags", "Place Tags", "", "pack://application:,,,/ReviTab;component/Resources/tag.png", "ReviTab.AddTagsApplyUndo", "Place a tag on multiple beams")); stackedButtonsCQT.Add(CreatePushButton("btnPlaceDimensions", "Lock Openings", "", "pack://application:,,,/ReviTab;component/Resources/lock.png", "ReviTab.LockOpenings", "Place a dimension between an opening and a reference plane and lock it.")); AddSplitButton(beams, stackedButtonsCQT, "CQTButton", "CQT"); #endif IList <PushButtonData> beamsEdit = new List <PushButtonData>(); beamsEdit.Add(CreatePushButton("btnBeamByTypeMark", "Beam by\nIdType Mark", "", "pack://application:,,,/ReviTab;component/Resources/elementType.png", "ReviTab.BeamByTypeMark", "Provide an Identity Type Mark to change the selected beam type.")); beamsEdit.Add(CreatePushButton("btnMoveBeamEnd", "Move Beam End", "", "pack://application:,,,/ReviTab;component/Resources/movement-arrows.png", "ReviTab.MoveBeamEnd", "Move a beam endpoint to match a selected beam closest point")); beamsEdit.Add(CreatePushButton("btnChangeBeamLocation", "Change Beam" + Environment.NewLine + "Location", "", "pack://application:,,,/ReviTab;component/Resources/changebeamlocation.png", "ReviTab.ChangeBeamLocation", "Move a beam to new location.")); beamsEdit.Add(CreatePushButton("btnEditJoin", "Edit Beam" + Environment.NewLine + "End Join", "", "pack://application:,,,/ReviTab;component/Resources/joinEnd.png", "ReviTab.EditBeamJoin", "Allow/Disallow beam end join")); AddSplitButton(beams, beamsEdit, "BeamsEdit", "Beams Edit"); //if (AddPushButton(beams, "btnMoveBeamEnd", "Move Beam End", "", "pack://application:,,,/ReviTab;component/Resources/movement-arrows.png", "ReviTab.MoveBeamEnd", "Move a beam endpoint to match a selected beam closest point") == false) //{ // MessageBox.Show("Failed to add button Move Beam End", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} //if (AddPushButton(beams, "btnChangeBeamLocation", "Change Beam" + Environment.NewLine + "Location", "", "pack://application:,,,/ReviTab;component/Resources/changebeamlocation.png", "ReviTab.ChangeBeamLocation", "Move a beam to new location.") == false) //{ // MessageBox.Show("Failed to add button change beam location", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} //if (AddPushButton(beams, "btnEditJoin", "Edit Beam" + Environment.NewLine + "End Join", "", "pack://application:,,,/ReviTab;component/Resources/joinEnd.png", "ReviTab.EditBeamJoin", "Allow/Disallow beam end join") == false) //{ // MessageBox.Show("Failed to add button Edit Beam", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} #endregion #region Splitter if (AddPushButton(walls, "btnWallSplitter", "Split Wall" + Environment.NewLine + "By Levels", "", "pack://application:,,,/ReviTab;component/Resources/splitWalls.png", "ReviTab.WallSplitter", "Split a wall by levels. NOTE: The original wall will be deleted.") == false) { MessageBox.Show("Failed to add button Split Wall", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (AddPushButton(walls, "btnColumnSplitter", "Split Column" + Environment.NewLine + "By Levels", "", "pack://application:,,,/ReviTab;component/Resources/columnSplit.png", "ReviTab.ColumnSplitter", "Split a wall by levels. NOTE: The original wall will be deleted.") == false) { MessageBox.Show("Failed to add button Split Column", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion #region Geometry #if DEBUG IList <PushButtonData> stackedButtonsGroupGeometry = new List <PushButtonData> { CreatePushButton("intMesh", "Intersect Mesh", "pack://application:,,,/ReviTab;component/Resources/projectLine.png", "pack://application:,,,/ReviTab;component/Resources/projectLine.png", "ReviTab.AAAAAAARhinoMesh", "Intersect line with mesh"), CreatePushButton("btnSATtoDS", "Element to DirectShape", "pack://application:,,,/ReviTab;component/Resources/flatten.png", "", "ReviTab.SATtoDirectShape", "Convert an element into a DirectShape. Deletes the original element."), CreatePushButton("btnProjectLines", "Project Lines to Surface", "pack://application:,,,/ReviTab;component/Resources/projectLine.png", "", "ReviTab.ProjectLines", "Project some lines onto a surface."), CreatePushButton("btnDrawAxis", "Draw Axis", "pack://application:,,,/ReviTab;component/Resources/axis.png", "", "ReviTab.DrawObjectAxis", "Draw local and global axis on a point on a surface.") }; AddSplitButton(geometry, stackedButtonsGroupGeometry, "GeometryButton", "Geometry"); #endif #endregion #region Zero State #if DEBUG IList <PushButtonData> stackedButtonsZeroState = new List <PushButtonData>(); stackedButtonsZeroState.Add(CreatePushButton("btnClaritySetup", "Clarity Setup", "", "pack://application:,,,/ReviTab;component/Resources/claSetup.png", "ReviTab.ClaritySetup", "Open a model in background and create a 3d view for Clarity IFC export.", "ReviTab.Availability")); stackedButtonsZeroState.Add(CreatePushButton("btnPush", "Push to DB", "", "pack://application:,,,/ReviTab;component/Resources/arrowUp.png", "ReviTab.PushToDB", "Push date, user, rvtFileSize, elementsCount, typesCount, sheetsCount, viewsCount, viewportsCount, warningsCount to 127.0.0.1")); stackedButtonsZeroState.Add(CreatePushButton("btnPurgeFamilies", "Families", "", "pack://application:,,,/ReviTab;component/Resources/wiping.png", "ReviTab.PurgeFamily", "Purge families and leave only a type called Default", "ReviTab.Availability")); stackedButtonsZeroState.Add(CreatePushButton("btnPrintBackground", "Back Print", "", "pack://application:,,,/ReviTab;component/Resources/backgroundPrint.png", "ReviTab.PrintInBackground", "Open a model in background and print the selcted drawings", "ReviTab.Availability")); AddSplitButton(zeroState, stackedButtonsZeroState, "PurgeCommands", "Purge"); /* * if (AddZeroStatePushButton(zeroState, "btnDiasbleWarning", "Open No Warnings", "", "pack://application:,,,/ReviTab;component/Resources/addMultiViews.png", "ReviTab.SuppressWarnings", "Suppress warnings when opening files", "ReviTab.Availability") == false) * { * MessageBox.Show("Failed to add button Purge Families", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); * } */ IList <PushButtonData> stackedButtonsGroupMetadata = new List <PushButtonData>(); stackedButtonsGroupMetadata.Add(CreatePushButton("btnInfo", "Info", "", "pack://application:,,,/ReviTab;component/Resources/info.png", "ReviTab.VersionInfo", "Display Version Info Task Dialog.", "ReviTab.Availability")); stackedButtonsGroupMetadata.Add(CreatePushButton("btnColor", "ColorTab", "", "pack://application:,,,/ReviTab;component/Resources/tagSmall.png", "ReviTab.ColorTab", "Color Revit Tabs based on view type.", "ReviTab.Availability")); stackedButtonsGroupMetadata.Add(CreatePushButton("btnHowl", "Howl", "", "pack://application:,,,/ReviTab;component/Resources/ghowlicon.png", "ReviTab.Howl", "Howl")); stackedButtonsGroupMetadata.Add(CreatePushButton("btnAddMetadata", "Metadata", "", "pack://application:,,,/ReviTab;component/Resources/AddMetadataIcon.png", "ReviTab.AddPDFcustomProperties", "Add custom properties to a list of pdfs")); AddSplitButton(zeroState, stackedButtonsGroupMetadata, "MetadataCommands", "Metadata"); #else if (AddZeroStatePushButton(zeroState, "btnInfo", "Info", "", "pack://application:,,,/ReviTab;component/Resources/info.png", "ReviTab.VersionInfo", "Display Version Info Task Dialog.", "ReviTab.Availability") == false) { MessageBox.Show("Failed to add button Info", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endif #endregion if (AddTextBox(commandPanel, "btnCommandLine", "*Structural Framing+Length>10000 \n *Walls+Mark!aa \n sheets: all \n sheets: A101 A103 A201\n tblocks: all") == false) { MessageBox.Show("Failed to add Text Box", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Return Success return(Result.Succeeded); } catch { // In Case of Failure return(Result.Failed); } }
/// <summary> /// Implement this method to execute some tasks when Autodesk Revit starts. /// </summary> public abstract Result OnStartup(IContainer container, UIControlledApplication application);
Result IExternalApplication.OnShutdown(UIControlledApplication application) { throw new NotImplementedException(); }
public static CustomRibbon GetApplicationRibbon(UIControlledApplication uiControlApp) { return(new CustomRibbon(uiControlApp)); }
//public bool IsVisible; #region Input for creating ribbon public CustomRibbon(UIControlledApplication uiControlApp) : this() { ControlledApplication = uiControlApp; }
/// <inheritdoc/> public Result OnShutdown(UIControlledApplication application) => Result.Succeeded;
public Result OnStartup(UIControlledApplication a) { kilargo.properities.pass = true; a.Idling += OnIdling; _app = this; // Create a custom ribbon tab String tabName = "Kilargo"; a.CreateRibbonTab(tabName); //ribbonPanel = a.CreateRibbonPanel(tabName, "Login"); //ribbonPanel2 = a.CreateRibbonPanel(tabName, "Logout"); ribbonPanel1 = a.CreateRibbonPanel(tabName, "Kilargo Products"); // Create a push button to trigger a command add it to the ribbon panel. // string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; //PushButtonData buttonData = new PushButtonData("Login", "Login", assyPath, "Kilargo.Command"); //pushButton = ribbonPanel.AddItem(buttonData) as PushButton; //_button = pushButton; //PushButtonData buttonData2 = new PushButtonData("Logout", "Logout", assyPath, "Kilargo.logout"); //pushButton2 = ribbonPanel2.AddItem(buttonData2) as PushButton; PushButtonData buttonData1 = new PushButtonData("Kilargo", "Products", assyPath, "Kilargo.Products1"); PushButton pushButton1 = ribbonPanel1.AddItem(buttonData1) as PushButton; // Optionally, other properties may be assigned to the button // a) tool-tip //pushButton.ToolTip = "Kilargo Login"; pushButton1.ToolTip = "Kilargo Revit File Downloader"; //Uri uriImagel = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/login.png"); //BitmapImage largeImagelarge = new BitmapImage(uriImagel); //// b) large bitmap //Uri uriImage = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/icon1.ico"); //BitmapImage largeImage = new BitmapImage(uriImage); //pushButton.LargeImage = largeImage; //pushButton.ToolTipImage = largeImagelarge; //ribbonPanel2.Visible = false; //Uri uriImagel22 = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/logout.png"); //BitmapImage largeImagelarge2 = new BitmapImage(uriImagel22); //Uri uriImage2 = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/icon2.ico"); //BitmapImage largeImage2 = new BitmapImage(uriImage2); //pushButton2.LargeImage = largeImage2; //pushButton2.ToolTipImage = largeImagelarge2; Uri uriImagel3 = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/kilargo.png"); BitmapImage largeImagelarge3 = new BitmapImage(uriImagel3); Uri uriImage1 = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/favicon (18).ico"); BitmapImage largeImage1 = new BitmapImage(uriImage1); pushButton1.LargeImage = largeImage1; pushButton1.ToolTipImage = largeImagelarge3; ribbonPanel1.Enabled = true; return(Result.Succeeded); }