using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace RevitHttpControl.Models { /// /// 薄壳分析请求 /// public class ShellAnalyzeRequest { /// /// 优化模式 /// public ShellOptimizeMode Mode { get; set; } = ShellOptimizeMode.Standard; } /// /// 薄壳分析响应 /// public class ShellAnalyzeResponse { /// /// 分析统计信息 /// public ShellAnalysisSummary Analysis { get; set; } /// /// 分类详细统计 /// public List Categories { get; set; } } /// /// 薄壳执行请求 /// public class ShellExecuteRequest { /// /// 外部执行ID(可选,用于批处理回调) /// [JsonProperty("execution_id")] public string ExecutionId { get; set; } /// /// 优化模式 /// public ShellOptimizeMode Mode { get; set; } = ShellOptimizeMode.Standard; /// /// 是否备份原文件 /// public bool BackupOriginal { get; set; } = true; } /// /// 按类别自定义删除请求 /// public class ShellCustomExecuteRequest { /// /// 外部执行ID(可选,用于批处理回调) /// [JsonProperty("execution_id")] public string ExecutionId { get; set; } /// /// 要删除的类别ID列表(BuiltInCategory 的 int 值) /// public List CategoryIds { get; set; } = new List(); /// /// 是否备份原文件 /// public bool BackupOriginal { get; set; } = true; } /// /// 薄壳执行响应 /// public class ShellExecuteResponse { /// /// 优化结果 /// public ShellOptimizeResult Result { get; set; } } /// /// 薄壳分析统计摘要 /// public class ShellAnalysisSummary { /// /// 总构件数 /// public int TotalElements { get; set; } /// /// 保留构件数 /// public int KeepElements { get; set; } /// /// 删除构件数 /// public int RemoveElements { get; set; } /// /// 预估文件大小减少百分比 /// public string EstimatedReduction { get; set; } /// /// 当前文件大小(格式化显示) /// public string OriginalSize { get; set; } /// /// 预估优化后文件大小(格式化显示) /// public string EstimatedOptimizedSize { get; set; } } /// /// 构件分类统计 /// public class CategoryStatistics { /// /// 分类ID(BuiltInCategory 的 int 值) /// public int CategoryId { get; set; } /// /// 分类名称 /// public string Name { get; set; } /// /// 分类总数 /// public int Total { get; set; } /// /// 保留数量 /// public int Keep { get; set; } /// /// 删除数量 /// public int Remove { get; set; } /// /// 保留百分比 /// public string KeepPercentage => Total > 0 ? $"{(Keep * 100.0 / Total):F0}%" : "0%"; } /// /// 薄壳优化结果 /// public class ShellOptimizeResult { /// /// 实际删除的构件数量 /// public int RemovedCount { get; set; } /// /// 原始文件大小(格式化显示) /// public string OriginalSize { get; set; } /// /// 优化后文件大小(格式化显示) /// public string OptimizedSize { get; set; } /// /// 实际减少百分比 /// public string Reduction { get; set; } /// /// 备份文件路径(如果有备份) /// public string BackupPath { get; set; } /// /// 处理耗时(秒) /// public int ProcessingTimeSeconds { get; set; } } /// /// 薄壳优化模式 /// public enum ShellOptimizeMode { /// /// 保守模式 - 只删除装饰元素(减少约30%) /// Conservative, /// /// 标准模式 - 删除家具和部分内墙(减少约65%) /// Standard, /// /// 激进模式 - 删除所有内部元素(减少约80%) /// Aggressive, /// /// 仅保留围护+场地 - 严格只保留外壳(外墙/屋顶/外门窗等)与场地地形,删除所有室内与链接模型 /// EnvelopeOnly } /// /// 构件处理动作 /// public enum ElementAction { /// /// 保留 /// Keep, /// /// 删除 /// Remove } /// /// 构件分析结果 /// public class ElementAnalysisResult { /// /// 构件ID /// public int ElementId { get; set; } /// /// 构件分类ID(BuiltInCategory 的 int 值) /// public int CategoryId { get; set; } /// /// 构件分类名称 /// public string CategoryName { get; set; } /// /// 处理动作 /// public ElementAction Action { get; set; } /// /// 处理原因 /// public string Reason { get; set; } } }