CopilotForDesign.Contracts.Revit 1.2.0

dotnet add package CopilotForDesign.Contracts.Revit --version 1.2.0
                    
NuGet\Install-Package CopilotForDesign.Contracts.Revit -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CopilotForDesign.Contracts.Revit" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CopilotForDesign.Contracts.Revit" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="CopilotForDesign.Contracts.Revit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CopilotForDesign.Contracts.Revit --version 1.2.0
                    
#r "nuget: CopilotForDesign.Contracts.Revit, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CopilotForDesign.Contracts.Revit@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CopilotForDesign.Contracts.Revit&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CopilotForDesign.Contracts.Revit&version=1.2.0
                    
Install as a Cake Tool

CopilotForDesign.Contracts.Revit

Copilot for Design 的 Revit 命令开发契约库。编译时元数据标注 + 运行时事件总线。

安装

Install-Package CopilotForDesign.Contracts.Revit

包含

类型 作用
CommandAttribute 标注 IExternalCommand 类,声明命令元数据(标题、描述、触发条件、专业等)
CommandInputAttribute 标注 Parameters 属性,指明入参反序列化目标类型
AppEventHub 运行时全局事件总站,命令执行完成后回传结果

输入约束声明

不要手写或篡改 Executor 生成的 JSON Schema。需要表达机器可读约束时,在 InputParams 属性上使用:

[Required, MinItems(1), UniqueItems]
public List<int> element_ids { get; set; } = null!;

[AllowedValues(5, 10, 50, 100)]
public int rounding_mm { get; set; } = 10;

[RequiredWhen(nameof(scope), "selected")]
public List<int> selected_ids { get; set; } = new();

对应生成 minItems、uniqueItems、数值或字符串 enum、if/then 条件 required。嵌套 DTO 上的 [Required] 也会保留到嵌套 Schema。

using SharedLibrary;

[Command(
    Title = "元素查询",
    Description = "根据类别和属性条件筛选 Revit 模型元素",
    Trigger = "当需要查询、搜索、过滤 Revit 元素时调用",
    Discipline = "general"
)]
public class MyCommand : IExternalCommand
{
    [CommandInput(typeof(MyRequest))]
    public JObject Parameters { get; set; }

    public Result Execute(...)
    {
        // 你的逻辑
        AppEventHub.RaiseCommandCompleted(nameof(MyCommand), true, resultJson);
        return Result.Succeeded;
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 127 7/31/2026
1.1.0 114 6/3/2026
1.0.2 123 6/1/2026
1.0.1 120 6/1/2026
1.0.0 112 6/1/2026