Autodesk.Revit.UI.IExternalCommand 接口提供了一种创建Revit外部命令的方式。该接口包含一个Execute()方法,外部命令需要实现这个方法以定义其行为。
Execute(Document document, ref string message, ElementSet elements) : Result
public class MyExternalCommand : IExternalCommand
{
public Result Execute(Document document, ref string message, ElementSet elements)
{
try
{
// 处理逻辑
return Result.Succeeded;
}
catch (Exception ex)
{
message = ex.Message;
return Result.Failed;
}
}
}
https://www.autodesk.com/developer-network/platform-technologies/revit