mirror of
https://github.com/ShrlAlgo/RevitGen.git
synced 2026-03-08 01:38:53 +00:00
添加项目文件。
This commit is contained in:
56
RevitGen.Common/Attributes/RevitCommandAttribute.cs
Normal file
56
RevitGen.Common/Attributes/RevitCommandAttribute.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
// RevitGen.Common/Attributes/RevitCommandAttribute.cs
|
||||
|
||||
using System;
|
||||
|
||||
using Autodesk.Revit.Attributes;
|
||||
|
||||
namespace RevitGen.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// 将一个类标记为Revit外部命令,并自动为其生成UI按钮和必要的接口实现。
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class RevitCommandAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 按钮上显示的文本。
|
||||
/// </summary>
|
||||
public string Text { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 按钮所在的Ribbon Tab的名称。
|
||||
/// </summary>
|
||||
public string TabName { get; set; } = "RevitGen";
|
||||
|
||||
/// <summary>
|
||||
/// 按钮所在的Ribbon Panel的名称。
|
||||
/// </summary>
|
||||
public string PanelName { get; set; } = "Commands";
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public string Icon { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 鼠标悬停在按钮上时显示的工具提示。
|
||||
/// </summary>
|
||||
public string ToolTip { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 命令的事务模式。生成器将根据此模式自动处理事务。
|
||||
/// </summary>
|
||||
public TransactionMode TransactionMode { get; set; } = TransactionMode.Manual;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="text">按钮上显示的文本。</param>
|
||||
public RevitCommandAttribute(string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(text), "Command button text cannot be empty.");
|
||||
}
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user