mirror of
https://github.com/ShrlAlgo/RevitGen.git
synced 2026-03-07 17:28:54 +00:00
添加项目文件。
This commit is contained in:
13
RevitGen.Common/Attributes/CommandHandlerAttribute.cs
Normal file
13
RevitGen.Common/Attributes/CommandHandlerAttribute.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace RevitGen.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// 标记一个方法作为 RevitGen 命令的执行逻辑入口点。
|
||||
/// ★★ 这个方法必须是无参数的,并且返回 void。★★
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class CommandHandlerAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
RevitGen.Common/RevitGen.Common.csproj
Normal file
14
RevitGen.Common/RevitGen.Common.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- 定义你的包信息 -->
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<!-- 在这里添加或修改 NoWarn 标签 -->
|
||||
<NoWarn>$(NoWarn);NU1701</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nice3point.Revit.Api.RevitAPI" Version="2020.2.60" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user