本文整理汇总了C#中UIControlledApplication.CreateRibbonPanel方法的典型用法代码示例。如果您正苦于以下问题:C# UIControlledApplication.CreateRibbonPanel方法的具体用法?C# UIControlledApplication.CreateRibbonPanel怎么用?C# UIControlledApplication.CreateRibbonPanel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIControlledApplication
的用法示例。
在下文中一共展示了UIControlledApplication.CreateRibbonPanel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStartup
/// <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;
}
示例2: OnStartup
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;
}
示例3: OnStartup
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;
}
}
示例4: AddRibbonPanel
/// <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"));
}
示例5: CreateRibbonPanel
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 );
}
示例6: OnStartup
/// <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;
}
示例7: OnStartup
public Result OnStartup( UIControlledApplication a )
{
PopulatePanel(
a.CreateRibbonPanel(
"Va3c Export" ) );
return Result.Succeeded;
}
示例8: OnStartup
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;
}
}
示例9: OnStartup
/// <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;
}
示例10: GetPIOTMPanel
/// <summary>
/// Get the default PIOTM panel
/// </summary>
/// <param name="application">Revit application</param>
/// <returns></returns>
private static RibbonPanel GetPIOTMPanel(
UIControlledApplication application)
{
IList<RibbonPanel> panels = application.GetRibbonPanels();
foreach (RibbonPanel pnl in panels)
if (pnl.Name == PIOTM_PANEL_NAME)
return pnl;
return application.CreateRibbonPanel(PIOTM_PANEL_NAME);
}
示例11: OnStartup
public Result OnStartup(UIControlledApplication application)
{
RibbonPanel ribbonPanel = application.CreateRibbonPanel("SimulEICon");
PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Search Elements",
"SimulEICon", @"C:\Documents and Settings\fdot\My Documents\Visual Studio 2010\Projects\RevitLibrary\RevitLibrary\bin\Debug\RevitLibrary.dll", "RevitLibrary.ReadElements")) as PushButton;
Bitmap bit = Properties.Resources.house2;
BitmapSource largeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bit.GetHbitmap(),IntPtr.Zero,System.Windows.Int32Rect.Empty,BitmapSizeOptions.FromWidthAndHeight(bit.Width, bit.Height));
pushButton.LargeImage = largeImage;
return Result.Succeeded;
}
示例12: AddRibbonPanel
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
}
示例13: OnStartup
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
{
RibbonPanel ribbonPanel = application.CreateRibbonPanel("Unity Toos");
PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("ServiceClient",
"ServiceClient", @"C:\Users\user\Desktop\TestProject11\RevitUnity\RevitUnity\RevitUnityInvoker\bin\Debug\RevitUnityInvoker.dll", "RevitUnityInvoker.ServiceClient")) as PushButton;
// Set the large image shown on button
//Uri uriImage = new Uri(@"D:\universitylogo32.png");
//BitmapImage largeImage = new BitmapImage(uriImage);
//pushButton.LargeImage = largeImage;
return Result.Succeeded;
}
示例14: OnStartup
/// <summary>
/// Startup
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
public Result OnStartup(UIControlledApplication application)
{
try
{
// Version
if (!application.ControlledApplication.VersionName.Contains(RevitVersion))
{
using (TaskDialog td = new TaskDialog("Cannot Continue"))
{
td.TitleAutoPrefix = false;
td.MainInstruction = "Incompatible Revit Version";
td.MainContent = "This Add-In was built for Revit "+ RevitVersion + ", please contact CASE for assistance.";
td.Show();
}
return Result.Cancelled;
}
// Master Tab
const string c_tabName = "CASE";
try
{
// Create the Tab
application.CreateRibbonTab(c_tabName);
}
catch { }
string m_issuetracker = "Case.IssueTracker.dll";
// Tab
RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Case Issue Tracker");
// Button Data
PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
"Issue Tracker",
Path.Combine(_path, "Case.IssueTracker.Revit.dll"),
"Case.IssueTracker.Revit.Entry.CmdMain")) as PushButton;
// Images and Tooltip
if (m_pushButton != null)
{
m_pushButton.Image = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon16x16.png", m_issuetracker);
m_pushButton.LargeImage = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon32x32.png", m_issuetracker);
m_pushButton.ToolTip = "Case Issue Manager";
}
}
catch (Exception ex1)
{
MessageBox.Show("exception: " + ex1);
return Result.Failed;
}
return Result.Succeeded;
}
示例15: OnStartup
public Result OnStartup(UIControlledApplication app)
{
RibbonPanel ribbonPanelTools = app.CreateRibbonPanel("Slackit");
PushButton pushBtnSlackSettings = ribbonPanelTools.AddItem(new PushButtonData("SlackitSettings", "Settings", assemblyDir + "SlackitRevit.dll", "SlackitRevit.SlackCommand")) as PushButton;
pushBtnSlackSettings.LargeImage = new BitmapImage(new Uri(imageDir + "SlackitLogo_32.png"));
PushButton pushBtnSlackCapture = ribbonPanelTools.AddItem(new PushButtonData("SlackitCapture", "Screenshot", assemblyDir + "SlackitRevit.dll", "SlackitRevit.CaptureCommand")) as PushButton;
pushBtnSlackCapture.LargeImage = new BitmapImage(new Uri(imageDir + "SlackitLogo_32.png"));
return Result.Succeeded;
}