Revit二次开发--"Add Hello World Ribbon Panel"
来源:互联网 发布:如何搭建家庭光纤网络 编辑:程序博客网 时间:2024/06/05 15:51
1.Create a New Project
1)创建C#中的类库项目。
2)将项目名称写为“Ribbon”。
3)添加RevitAPI.dll和RevitAPIUI.dll,并修改属性。
4)在解决方案资源管理器中,选择项目名称右键选择 “添加引用”。在对画框中选择 “程序集–框架”中的PresentationCore和WindowBase和System.Xaml,将其三个添加。
2.Change the Class Name
修改类名为”CsAddPanel”。
3.Add Code
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Autodesk.Revit.UI;using Autodesk.Revit.DB;using System.Windows.Media.Imaging;namespace Ribbon{ class CsAddPanel : Autodesk.Revit.UI.IExternalApplication { public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) {//add new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel("NewRibbonPanel");//Create a push button in the ribbon panel"NewRibbonPanel"//the add-in application "HelloWorld" will be triggered when button is pushedPushButton pushButton = ribbonPanel.AddItem(new PushButtonData("HelloWorld","HelloWorld",@"E:\C#\sample\HelloWorld\HelloWorld\bin\Debug\HelloWorld.dll", "HelloWorld.Class1")) as PushButton;//此处的路径为helloworld的路径,及其项目名与类名。//Set the large iamge Shown on button Uri uriImage = new Uri(@"E:\C#\sample\HelloWorld\HelloWorld\bin\Debug\39-Globe_32×32.png");//此处的图片是自己下载的图标,将其放在helloworld的路径中BitmapImage largeImage = new BitmapImage(uriImage);pushButton.LargeImage = largeImage; return Result.Succeeded; } public Result OnShutdown(UIControlledApplication application) { return Result.Succeeded; } }}
4.Build the Application
生成后得到 Ribbon.dll
5.Create the .addin manifest file
<?xml version="1.0" encoding="utf-8"?><RevitAddIns> <AddIn Type="Application"> <Name>SampleApplication</Name> <Assembly>E:\C#\sample\Ribbon\Ribbon\bin\Debug\Ribbon.dll</Assembly> <AddInId>e4db245e-0086-45e0-b671-2a49fb51d608</AddInId> <FullClassName>Ribbon.CsAddPanel</FullClassName> <VendorId>ADSK</VendorId> <VendorDescription>Autodesk, www.autodesk.com</VendorDescription> </AddIn></RevitAddIns>
将其存入C:\ProgramData\Autodesk\Revit\Addins\2014中。
最后生成(F6)
将revit软件打开,在附加模块中就可以看到。
0 0
- Revit二次开发--"Add Hello World Ribbon Panel"
- Revit二次开发--"Hello World"
- Revit二次开发(2):Hello World!
- 【步骤向】Revit二次开发 Hello World
- Revit二次开发(6):Ribbon编辑器(开源项目)
- Revit API 开发 (1): Hello World
- Revit 二次开发
- Bentley MicroStation 二次开发入门--"Hello World"
- Revit 二次开发现状(2009)
- Revit 二次开发前景
- Revit 二次开发 - 开发资源
- <Revit二次开发>HelloWorld
- Revit二次开发首次使用
- revit二次开发,隔离构件
- Revit二次开发之入门
- Revit二次开发--过滤对象
- Revit二次开发曲线操作
- 如何开始Revit二次开发
- 如何删除数组中不需要的数据
- Spring下mybatis多数据源配置
- IOS开发基础Object-C(09)—OC内存管理(3)-@property的参数详解
- mongodb使用备忘
- STM32栈和堆使用不同RAM的实现方法
- Revit二次开发--"Add Hello World Ribbon Panel"
- ios autolayout
- ar list
- 正则表达式
- LoadRunner中负载时间Duration与迭代次数Iteration的联系
- LINK - About Cache Control of Azure Blob Files
- linux grep 命令
- C++ string学习
- body-parser和multer