Revit 命令添加下拉框

在学习revit制作下拉框时,需要分为三个步骤:

1.创建一个面板(panel)。

RibbonPanel panel10 = application.CreateRibbonPanel(Globals.DiagnosticsTabName, "图纸生成");
2.给面板添加组,实现下拉框的效果  。

AddPulldownButtonGroup1(panel10);

3.在组中添加单独的按钮。

 private void AddPulldownButtonGroup1(RibbonPanel panel)
{
if ( == )
{
PulldownButtonData group1Data = new PulldownButtonData("PulldownGroup1", "门窗");
PulldownButton group1 = panel.AddItem(group1Data) as PulldownButton;
BitmapImage largeimage41 = new BitmapImage();
largeimage41.BeginInit();
largeimage41.UriSource = new Uri(@"C:\Kingcarrier\icon\mengchuang.png");
largeimage41.DecodePixelWidth = ;
largeimage41.DecodePixelHeight = ;
largeimage41.EndInit();
group1.LargeImage = largeimage41;
PushButtonData itemData13 = new PushButtonData("itemName13", "插入单门", FileUtility.GetAssemblyFullName(), typeof(door).FullName);
PushButton item13 = group1.AddPushButton(itemData13) as PushButton;
item13.ToolTip = itemData13.Text; // Can be changed to a more descriptive text.
item13.Image = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
item13.LargeImage = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png")); PushButtonData itemData131 = new PushButtonData("itemName131", "改门方向", FileUtility.GetAssemblyFullName(), typeof(changedoor).FullName);
PushButton item131 = group1.AddPushButton(itemData131) as PushButton;
item131.ToolTip = itemData131.Text; // Can be changed to a more descriptive text.
item131.Image = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
item131.LargeImage = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
group1.AddSeparator();
PushButtonData itemData132 = new PushButtonData("itemName132", "添加H件", FileUtility.GetAssemblyFullName(), typeof(addHtoWindow).FullName);
PushButton item132 = group1.AddPushButton(itemData132) as PushButton;
item132.ToolTip = itemData132.Text; // Can be changed to a more descriptive text.
item132.Image = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
item132.LargeImage = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
group1.AddSeparator();
PushButtonData itx1 = new PushButtonData("itemName1", "插入单窗", FileUtility.GetAssemblyFullName(), typeof(window).FullName);
PushButton it1 = group1.AddPushButton(itx1) as PushButton;
it1.ToolTip = itx1.Text; // Can be changed to a more descriptive text.
it1.Image = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
it1.LargeImage = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
group1.AddSeparator();
PushButtonData itx2 = new PushButtonData("itemName2", "插入连窗", FileUtility.GetAssemblyFullName(), typeof(twowindow).FullName);
PushButton it2 = group1.AddPushButton(itx2) as PushButton;
it2.ToolTip = itx2.Text; // Can be changed to a more descriptive text.
it2.Image = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
it2.LargeImage = new BitmapImage(new Uri(@"C:\Kingcarrier\icon\报价清单.png"));
}
panel.AddSeparator();

同样的在组中可以设计组的名称然后再去设置组中的每一个按钮,并且实现相应的功能。

上一篇:Jmeter4.0----录制脚本


下一篇:LODOP.FORMAT格式转换【回调和直接返回值】