I am wanting to add buttons to certain contextual ribbons... Specifically:
Modify | Multi-Select
, Modify | Pipes
, Modify | Sprinklers
, Modify | Pipe Accessories
, Modify | Pipe Fittings
, Modify | Mechanical Equipment
and
Modify | Generic Models
and place the buttons within a panel of my creation. How can I accomplish this?
I've tried:
if (pTab.Id == "Modify | Pipes")
{
foreach (var pPanel in pTab.Panels)
{
if (pPanel.Source.Id == "Edit") //Also tried edit_shr
{// Add button.
pIcon = Properties.Resources.AS_Revit_UI_hydraulicParameters_icon.GetHbitmap();
var pBtn = new Autodesk.Windows.RibbonButton()
{
Name = "Hydraulic Parameters",
Image = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(pIcon, IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(32, 32)),
Id = "id_hydParam",
AllowInStatusBar = true,
AllowInToolBar = true,
GroupLocation = Autodesk.Private.Windows.RibbonItemGroupLocation.Middle,
MinHeight = 0,
MinWidth = 0,
Height = 32,
Width = 32,
IsEnabled = true,
IsVisible = true,
IsCheckable = true,
ShowImage = true,
ShowText = true,
Orientation = System.Windows.Controls.Orientation.Vertical,
Text = "Hydraulic Parameters",
Size = Autodesk.Windows.RibbonItemSize.Large,
ResizeStyle = Autodesk.Windows.RibbonItemResizeStyles.HideText
};
pPanel.Source.Items.Add(pBtn);
//Add event handler for button push
}
}
}
That, unfortunately, didn't work. I'm sure this is possible - I just don't know how. I feel like it's a matter of not know the Revit-issued tab names - like Modify | Pipes
is really something like modify_pipes
or something like that.
The code above was me trying to put my button in a Revit panel... Is there a way to add my own panel with my own buttons? Something like this:
That's the ideal situation. I'm more than comfortable with any other solutions like adding the buttons to existing panels. Any help is good help! Thanks!!