| | |
| | | using Autodesk.Revit.UI; |
| | | using HStation.RevitDev.Model.Enum; |
| | | using HStation.RevitDev.RevitDataExport.Common; |
| | | using HStation.RevitDev.RevitDataExport.Forms; |
| | | using System; |
| | | using System.IO; |
| | | using System.Reflection; |
| | | using System.Windows.Media.Imaging; |
| | | |
| | | namespace HStation.RevitDev.RevitDataExport.Utility |
| | | { |
| | | public class Ribbon |
| | | { |
| | | UIControlledApplication m_uiControlledApp; |
| | | |
| | | public Ribbon(UIControlledApplication app) |
| | | { |
| | | m_uiControlledApp = app; |
| | | } |
| | | |
| | | public RibbonPanel CreateRibbon() |
| | | { |
| | | m_uiControlledApp.CreateRibbonTab(GlobalResource.PluginName); |
| | | RibbonPanel panel = m_uiControlledApp.CreateRibbonPanel(GlobalResource.PluginName, GlobalResource.PanelName); |
| | | return panel; |
| | | } |
| | | |
| | | public void CreateButton_SystemAnalysis(RibbonPanel ribbonPanel, RevitFamilyType pump, string className) |
| | | { |
| | | string path = Assembly.GetExecutingAssembly().Location; |
| | | |
| | | string name = pump.GetDescription(); |
| | | PushButtonData pdata = new PushButtonData(name, name, path, className); |
| | | PushButton pBtn = ribbonPanel.AddItem(pdata) as PushButton; |
| | | |
| | | string imagePath = Path.Combine(GlobalResource.ImageDirectory, $"{name}.png"); |
| | | pBtn.LargeImage = new BitmapImage(new Uri(imagePath));//32 * 32 |
| | | pBtn.ToolTip = name; |
| | | |
| | | RegistDockablePanel(pump); |
| | | } |
| | | |
| | | public void CreateButton_PipeSystem(RibbonPanel ribbonPanel, RevitFamilyType pump, string className) |
| | | { |
| | | string path = Assembly.GetExecutingAssembly().Location; |
| | | string name = pump.GetDescription(); |
| | | PushButtonData pdata = new PushButtonData(name, name, path, className); |
| | | PushButton pBtn = ribbonPanel.AddItem(pdata) as PushButton; |
| | | |
| | | string imagePath = Path.Combine(GlobalResource.ImageDirectory, $"{name}.png"); |
| | | pBtn.LargeImage = new BitmapImage(new Uri(imagePath)); |
| | | pBtn.ToolTip = name; |
| | | |
| | | RegistDockablePanel(pump); |
| | | } |
| | | |
| | | public void CreateRibbon_PipeSystemAnalysis() |
| | | { |
| | | //1.创建RibbonTab选项卡页 |
| | | m_uiControlledApp.CreateRibbonTab("义维定制"); |
| | | //2.在RibbonTab选项卡页中创建RibbonPanel面板 |
| | | RibbonPanel panel1 = m_uiControlledApp.CreateRibbonPanel("义维定制", "管道系统链路检测"); |
| | | |
| | | //3.命令按钮 |
| | | //3.1指定程序集的名称、所使用的类名、程序集路径 |
| | | //程序集路径--最好写成相对位置 |
| | | string Path1 = Assembly.GetExecutingAssembly().Location; |
| | | //程序集的名称、所使用的类名——"主程序集命名空间.主程序类名" |
| | | string Class1 = "HStation.RevitDev.RevitDataExport.Export"; |
| | | //3.2定义PushButtonData命令按钮数据资料,绑定程序集 |
| | | PushButtonData pdata = new PushButtonData("命令按钮", "系统详情", Path1, Class1); |
| | | //3.3将PushButton添加到面板中 |
| | | PushButton push = panel1.AddItem(pdata) as PushButton; |
| | | //3.4为PushButton添加图标 |
| | | //可把图片资源加载入项目中,方便把图片的路径写成相对路径,并进行修改属性(图片的生成操作,改位:嵌入的资源) |
| | | string imagePath = Path.Combine(GlobalResource.DataDirectory, "Image/analysis.png"); |
| | | push.LargeImage = new BitmapImage(new Uri(imagePath));//32 * 32 |
| | | //3.5设置命令按钮的默认提示信息 |
| | | push.ToolTip = "Revit插件简介"; |
| | | } |
| | | |
| | | private void RegistDockablePanel(RevitFamilyType type) |
| | | { |
| | | var strId = GlobalResource.DockablePanelDict[type]; |
| | | Guid guid = new Guid(strId); |
| | | DockablePaneId id = new DockablePaneId(guid); |
| | | Wpf_FamilyPanel panel = new Wpf_FamilyPanel(type); |
| | | m_uiControlledApp.RegisterDockablePane(id, type.GetDescription(), panel); |
| | | } |
| | | } |
| | | } |
| | | using Autodesk.Revit.UI;
|
| | | using HStation.RevitDev.Model.ModelEnum;
|
| | | using HStation.RevitDev.RevitDataExport.Common;
|
| | | using HStation.RevitDev.RevitDataExport.Forms;
|
| | | using System;
|
| | | using System.IO;
|
| | | using System.Reflection;
|
| | | using System.Windows.Media.Imaging;
|
| | |
|
| | | namespace HStation.RevitDev.RevitDataExport.Utility
|
| | | {
|
| | | public class Ribbon
|
| | | {
|
| | | UIControlledApplication m_uiControlledApp;
|
| | |
|
| | | public Ribbon(UIControlledApplication app)
|
| | | {
|
| | | m_uiControlledApp = app;
|
| | | m_uiControlledApp.CreateRibbonTab(GlobalResource.PluginName);
|
| | | }
|
| | |
|
| | | public RibbonPanel CreatePanel(string panelName)
|
| | | {
|
| | | RibbonPanel panel = m_uiControlledApp.CreateRibbonPanel(GlobalResource.PluginName, panelName);
|
| | | return panel;
|
| | | }
|
| | |
|
| | | public void CreateButton_SystemAnalysis(RibbonPanel ribbonPanel, RevitType pump, string className)
|
| | | {
|
| | | if (!pump.IsRequired()) { return; }
|
| | |
|
| | | string path = Assembly.GetExecutingAssembly().Location;
|
| | |
|
| | | string name = pump.GetDescription();
|
| | | PushButtonData pdata = new PushButtonData(name, name, path, className);
|
| | | PushButton pBtn = ribbonPanel.AddItem(pdata) as PushButton;
|
| | |
|
| | | string imagePath = Path.Combine(GlobalResource.ImageDirectory, $"{name}.png");
|
| | | pBtn.LargeImage = new BitmapImage(new Uri(imagePath));//32 * 32
|
| | | pBtn.ToolTip = name;
|
| | |
|
| | | DockPaneUtil.RegistDockablePanel(m_uiControlledApp, pump);
|
| | | }
|
| | |
|
| | | public void CreateButton_PipeSystem(RibbonPanel ribbonPanel, RevitType pump, string className)
|
| | | {
|
| | | string path = Assembly.GetExecutingAssembly().Location;
|
| | | string name = pump.GetDescription();
|
| | | PushButtonData pdata = new PushButtonData(name, name, path, className);
|
| | | PushButton pBtn = ribbonPanel.AddItem(pdata) as PushButton;
|
| | |
|
| | | string imagePath = Path.Combine(GlobalResource.ImageDirectory, $"{name}.png");
|
| | | pBtn.LargeImage = new BitmapImage(new Uri(imagePath));
|
| | | pBtn.ToolTip = name;
|
| | |
|
| | | DockPaneUtil.RegistDockablePanel(m_uiControlledApp, pump);
|
| | | }
|
| | |
|
| | | public void CreateRibbon_PipeSystemAnalysis()
|
| | | {
|
| | | //1.创建RibbonTab选项卡页
|
| | | m_uiControlledApp.CreateRibbonTab("义维定制");
|
| | | //2.在RibbonTab选项卡页中创建RibbonPanel面板
|
| | | RibbonPanel panel1 = m_uiControlledApp.CreateRibbonPanel("义维定制", "管道系统链路检测");
|
| | |
|
| | | //3.命令按钮
|
| | | //3.1指定程序集的名称、所使用的类名、程序集路径
|
| | | //程序集路径--最好写成相对位置
|
| | | string Path1 = Assembly.GetExecutingAssembly().Location;
|
| | | //程序集的名称、所使用的类名——"主程序集命名空间.主程序类名" |
| | | string Class1 = "HStation.RevitDev.RevitDataExport.Export";
|
| | | //3.2定义PushButtonData命令按钮数据资料,绑定程序集
|
| | | PushButtonData pdata = new PushButtonData("命令按钮", "系统详情", Path1, Class1);
|
| | | //3.3将PushButton添加到面板中
|
| | | PushButton push = panel1.AddItem(pdata) as PushButton;
|
| | | //3.4为PushButton添加图标
|
| | | //可把图片资源加载入项目中,方便把图片的路径写成相对路径,并进行修改属性(图片的生成操作,改位:嵌入的资源)
|
| | | string imagePath = Path.Combine(GlobalResource.DataDirectory, "Image/analysis.png");
|
| | | push.LargeImage = new BitmapImage(new Uri(imagePath));//32 * 32
|
| | | //3.5设置命令按钮的默认提示信息
|
| | | push.ToolTip = "Revit插件简介";
|
| | | }
|
| | | }
|
| | | }
|