|
本帖最后由 Aaronyee 于 2015-11-2 19:21 编辑
==========【以下是源程序代码】
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Windows.Media.Imaging;
using System.Reflection;
namespace HelloWorldPanel
{
///
/// This application's main class. The class must be Public.
///
public class Class1 : IExternalApplication
{
// Both OnStartup and OnShutdown must be implemented as public method
public Result OnStartup(UIControlledApplication application)
{
// Add a new ribbon panel
RibbonPanel ribbonPanel = application.CreateRibbonPanel("NewRibbonPanel");
// Create a push button to trigger a command add it to the ribbon panel.
string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
PushButtonData buttonData = new PushButtonData("cmdHelloWorld",
"Hello World", thisAssemblyPath, "Walkthrough.HelloWorld");
PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;
// Optionally, other properties may be assigned to the button
// a) tool-tip
pushButton.ToolTip = "Say hello to the entire world.";
// b) large bitmap
Uri uriImage = new Uri(@"D:\Sample\AddPanel\AddPanel\bin\Debug\AddPanel.png");
BitmapImage largeImage = new BitmapImage(uriImage);
pushButton.LargeImage = largeImage;
return Result.Succeeded;
}
public Result OnShutdown(UIControlledApplication application)
{
// nothing to clean up in this simple case
return Result.Succeeded;
}
}
///
/// The "HelloWorld" external command. The class must be Public.
///
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class HelloWorld : IExternalCommand
{
// The main Execute method (inherited from IExternalCommand) must be public
public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit,
ref string message, ElementSet elements)
{
TaskDialog.Show("Revit", "Hello World");
return Autodesk.Revit.UI.Result.Succeeded;
}
}
}
===================【以下是addin文件】
D:\Sample\HelloWorldPanel\HelloWorldPanel\bin\Debug\HelloWorldPanel.dll
C615E05D-1159-43CA-A689-95DC3DA6017A
HelloWorldPanel.Class1
HelloWorldPanel
ASDK
ChengCai
=================【问题】
求解决方案
威尼斯人:wns185.com首存赠送58元亻足球亻真_人亻各类彩票齐全亻提现即时到账 |
|