修改命名空间
This commit is contained in:
@@ -561,6 +561,7 @@
|
||||
|
||||
<ContentPresenter
|
||||
x:Name="Icon"
|
||||
Margin="0,0,5,0"
|
||||
Content="{Binding Path=(assists:ControlAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
DockPanel.Dock="{Binding Path=(assists:ControlAssist.IconPlacement), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Focusable="False"
|
||||
|
||||
@@ -347,7 +347,11 @@
|
||||
Content="主要"
|
||||
IsEnabled="{Binding ElementName=CBIsEnabledButton, Path=IsChecked, Converter={x:Static ms:InvertBooleanConverter.Instance}}"
|
||||
ToolTip="Primary"
|
||||
ToolTipService.Placement="Top" />
|
||||
ToolTipService.Placement="Top">
|
||||
<!--<ms:ControlAssist.Icon>
|
||||
<ms:IconElement FontFamily="{StaticResource BoxIcons}" Glyph="" />
|
||||
</ms:ControlAssist.Icon>-->
|
||||
</Button>
|
||||
<Button
|
||||
ms:ControlAssist.AppearanceType="Info"
|
||||
Content="信息"
|
||||
|
||||
@@ -18,7 +18,7 @@ using Microsoft.Win32;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
|
||||
using OfficeOpenXml;
|
||||
using ShrlAlgoToolkit.Revit.Assists;
|
||||
using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
|
||||
namespace ShrlAlgo.Addin.Test;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.Revit.Assists;
|
||||
using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
using ShrlAlgoToolkit.Revit.Extensions;
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Autodesk.Revit.UI.Selection;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.Revit.Assists;
|
||||
using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
using ShrlAlgoToolkit.Revit.Extensions;
|
||||
|
||||
namespace ShrlAlgo.Addin.Test;
|
||||
|
||||
@@ -12,7 +12,7 @@ using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using Nice3point.Revit.Toolkit.Utils;
|
||||
|
||||
using ShrlAlgoToolkit.Revit.Assists;
|
||||
using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
using ShrlAlgoToolkit.Revit.Extensions;
|
||||
|
||||
namespace ShrlAlgo.Addin.Test;
|
||||
|
||||
@@ -7,7 +7,7 @@ using Autodesk.Revit.UI.Selection;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.Revit.Assists;
|
||||
using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
using ShrlAlgoToolkit.Revit.Extensions;
|
||||
|
||||
namespace ShrlAlgo.Addin.Test;
|
||||
|
||||
@@ -9,7 +9,7 @@ using Autodesk.Revit.UI.Selection;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.Core.Assists;
|
||||
using ShrlAlgoToolkit.Revit.Assists;
|
||||
using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
using ShrlAlgoToolkit.Revit.Extensions;
|
||||
|
||||
|
||||
|
||||
@@ -50,5 +50,5 @@
|
||||
<PackageReference Include="EPPlus.Core.Extensions" Version="2.4.0" />
|
||||
<PackageReference Include="Nice3point.Revit.Toolkit" Version="2019.*" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\ShrlAlgoToolkit.Revit\ShrlAlgoToolkit.Revit.projitems" Label="Shared" />
|
||||
<Import Project="..\ShrlAlgoToolkit.RevitCore\ShrlAlgoToolkit.RevitCore.projitems" Label="Shared" />
|
||||
</Project>
|
||||
@@ -9,7 +9,7 @@ using Autodesk.Revit.UI.Selection;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.Revit.Assists;
|
||||
using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
using ShrlAlgoToolkit.Revit.Extensions;
|
||||
|
||||
|
||||
@@ -72,13 +72,6 @@ public class TempCmd : ExternalCommand
|
||||
}
|
||||
}
|
||||
return;
|
||||
var refer = UiDocument.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element);
|
||||
var element = Document.GetElement(refer);
|
||||
Document.Invoke(
|
||||
_ =>
|
||||
{
|
||||
ElementTransformUtils.MoveElement(Document, element.Id, XYZ.BasisY * 200 / 304.8);
|
||||
});
|
||||
#if false
|
||||
var geo = element.get_Geometry(new Options() { ComputeReferences = true, DetailLevel = ViewDetailLevel.Fine });
|
||||
if (Document.IsFamilyDocument)
|
||||
|
||||
@@ -1,361 +0,0 @@
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
using EPPlus.Core.Extensions;
|
||||
|
||||
using OfficeOpenXml;
|
||||
using OfficeOpenXml.Style;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
|
||||
public class EPPlusHelper //公式计算最后需要调用Calculate()
|
||||
{
|
||||
/// <summary>
|
||||
/// DataTable导出为Excel
|
||||
/// </summary>
|
||||
/// <param name="destFileName"></param>
|
||||
/// <param name="dt"></param>
|
||||
public static void DataTableToExcel(DataTable dt, string destFileName)
|
||||
{
|
||||
FileInfo fi = new(destFileName);
|
||||
using ExcelPackage package = new(fi);
|
||||
try
|
||||
{
|
||||
var workSheet = package.Workbook.Worksheets.Add(dt.TableName);
|
||||
workSheet.Cells["A1"].LoadFromDataTable(dt, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
finally
|
||||
{
|
||||
package.Save();
|
||||
}
|
||||
}
|
||||
public List<T> ReadExcel<T>(string path, int worksheetIndex) where T : class, new()
|
||||
{
|
||||
FileInfo fi = new(path);
|
||||
using ExcelPackage package = new(fi);
|
||||
var worksheet = package.Workbook.Worksheets[worksheetIndex];
|
||||
////获取worksheet的行数
|
||||
//int rows = worksheet .Dimension.End.Row;
|
||||
////获取worksheet的列数
|
||||
//int cols = worksheet .Dimension.End.Column;
|
||||
//worksheet.TrimLastEmptyRows();
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
|
||||
try
|
||||
{
|
||||
return package.ToList<T>(worksheetIndex, configuration => configuration.SkipCastingErrors());
|
||||
}
|
||||
catch (EPPlus.Core.Extensions.Exceptions.ExcelValidationException)
|
||||
{
|
||||
System.Windows.MessageBox.Show("列名不存在或不匹配或检查表头是否存在换行。");
|
||||
}
|
||||
finally
|
||||
{
|
||||
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainOnAssemblyResolve;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)
|
||||
{
|
||||
if (!args.Name.Contains("ComponentModel.Annotations"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var assemblyFile = Path.Combine(
|
||||
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
|
||||
"System.ComponentModel.Annotations.dll"
|
||||
);
|
||||
return File.Exists(assemblyFile) ? Assembly.LoadFrom(assemblyFile) : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 给第一个表中的单元格赋值
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="rowNum"></param>
|
||||
/// <param name="columnNum"></param>
|
||||
/// <param name="value"></param>
|
||||
public static void EditCellValue(string fileName, int rowNum, int columnNum, string value)
|
||||
{
|
||||
FileInfo fi = new(fileName);
|
||||
using ExcelPackage package = new(fi);
|
||||
//ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
var sheet = package.Workbook.Worksheets[0];
|
||||
//string filename = System.IO.Path.GetFileNameWithoutExtension(fileName);
|
||||
sheet.Cells[rowNum, columnNum].Value = value;
|
||||
package.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工作表转换为DataTable,首行为表头
|
||||
/// </summary>
|
||||
/// <param name="worksheet">行列索引从1开始</param>
|
||||
/// <returns></returns>
|
||||
public static DataTable ExcelSheetToDataTable(ExcelWorksheet worksheet)
|
||||
{
|
||||
if (worksheet == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//获取worksheet的行数
|
||||
var rows = worksheet.Dimension.End.Row;
|
||||
//获取worksheet的列数
|
||||
var cols = worksheet.Dimension.End.Column;
|
||||
|
||||
DataTable dt = new(worksheet.Name);
|
||||
DataRow dr = null;
|
||||
for (var i = 1; i <= rows; i++)
|
||||
{
|
||||
if (i > 1)
|
||||
{
|
||||
dr = dt.Rows.Add();
|
||||
}
|
||||
|
||||
for (var j = 1; j <= cols; j++)
|
||||
{
|
||||
//默认将第一行设置为datatable的标题
|
||||
var value = worksheet.Cells[i, j].Value;
|
||||
if (i == 1)
|
||||
{
|
||||
dt.Columns.Add(value == null ? $"标题{i}" : value.ToString());
|
||||
}
|
||||
//剩下的写入datatable
|
||||
else
|
||||
{
|
||||
dr[j - 1] = value == null ? string.Empty : value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工作表转换为DataTable
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="sheetName"></param>
|
||||
/// <returns></returns>
|
||||
public static DataTable ExcelSheetToDataTable(string fileName, string sheetName)
|
||||
{
|
||||
FileInfo fi = new(fileName);
|
||||
ExcelPackage p = new(fi);
|
||||
var workbook = p.Workbook;
|
||||
var worksheet = workbook.Worksheets[sheetName];
|
||||
return ExcelSheetToDataTable(worksheet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取工作表
|
||||
/// </summary>
|
||||
/// <param name="excelFilePath"></param>
|
||||
/// <param name="sheetName"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static ExcelWorksheet GetExcelWorksheet(string excelFilePath, string sheetName)
|
||||
{
|
||||
var excelworkbook = new FileInfo(excelFilePath);
|
||||
using var p = new ExcelPackage(excelworkbook);
|
||||
var ws = p.Workbook.Worksheets[sheetName];
|
||||
return ws ?? throw new Exception("工作表不存在。");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取Excel所有表
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
public void ReadExcel(string filePath)
|
||||
{
|
||||
using ExcelPackage package = new(new FileStream(filePath, FileMode.Open));
|
||||
for (var i = 1; i <= package.Workbook.Worksheets.Count; ++i)
|
||||
{
|
||||
var sheet = package.Workbook.Worksheets[i];
|
||||
for (int j = sheet.Dimension.Start.Column, k = sheet.Dimension.End.Column; j <= k; j++)
|
||||
{
|
||||
for (int m = sheet.Dimension.Start.Row, n = sheet.Dimension.End.Row; m <= n; m++)
|
||||
{
|
||||
//string str = GetValue(sheet, m, j);
|
||||
//if (str != null)
|
||||
//{
|
||||
// // do something
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置单元格的值
|
||||
/// </summary>
|
||||
/// <param name="sheet"></param>
|
||||
/// <param name="rowNum">1开始</param>
|
||||
/// <param name="columnNum">1开始</param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetCellValue(ExcelWorksheet sheet, int rowNum, int columnNum, string value)
|
||||
{
|
||||
//sheet.Cells[rowNum, ColumnNum].Value = value;
|
||||
sheet.SetValue(rowNum, columnNum, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过单元格名设置值
|
||||
/// </summary>
|
||||
/// <param name="sheet"></param>
|
||||
/// <param name="cellName"></param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetCellValue(ExcelWorksheet sheet, string cellName, string value)
|
||||
{
|
||||
sheet.Cells[cellName].Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给工作表中的单元格赋值
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="sheetname"></param>
|
||||
/// <param name="rowNum"></param>
|
||||
/// <param name="columnNum"></param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetCellValue(string fileName, string sheetname, int rowNum, int columnNum, string value)
|
||||
{
|
||||
FileInfo fi = new(fileName);
|
||||
using ExcelPackage package = new(fi);
|
||||
//ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
var sheet = package.Workbook.Worksheets[sheetname];
|
||||
//string filename = System.IO.Path.GetFileNameWithoutExtension(fileName);
|
||||
sheet.SetValue(rowNum, columnNum, value);
|
||||
package.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给工作表中的单元格赋值
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="sheetname"></param>
|
||||
/// <param name="cellName">单元格名称,比如A1</param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetCellValue(string fileName, string sheetname, string cellName, string value)
|
||||
{
|
||||
FileInfo fi = new(fileName);
|
||||
using ExcelPackage package = new(fi);
|
||||
//ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
var sheet = package.Workbook.Worksheets[sheetname];
|
||||
//string filename = System.IO.Path.GetFileNameWithoutExtension(fileName);
|
||||
sheet.Cells[cellName].Value = value;
|
||||
package.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给工作表中的单元格赋值
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="index">表索引,0开始</param>
|
||||
/// <param name="cellName">单元格名称,如A1</param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetCellValue(string fileName, int index, string cellName, string value)
|
||||
{
|
||||
FileInfo fi = new(fileName);
|
||||
using ExcelPackage package = new(fi);
|
||||
//ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
var sheet = package.Workbook.Worksheets[index];
|
||||
//string filename = System.IO.Path.GetFileNameWithoutExtension(fileName);
|
||||
sheet.Cells[cellName].Value = value;
|
||||
package.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置样式
|
||||
/// </summary>
|
||||
/// <param name="sheet"></param>
|
||||
/// <param name="fromRow"></param>
|
||||
/// <param name="fromCol"></param>
|
||||
/// <param name="toRow"></param>
|
||||
/// <param name="toCol"></param>
|
||||
public static void SetStyle(ExcelWorksheet sheet, int fromRow, int fromCol, int toRow, int toCol)
|
||||
{
|
||||
using var range = sheet.Cells[fromRow, fromCol, toRow, toCol];
|
||||
//range.Style.Font.Name = "微软雅黑";
|
||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
range.Style.Font.Size = 12;
|
||||
range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
|
||||
//range.Style.SetBackgroundColor(System.Drawing.SelectedColor.FromArgb(142, 169, 219));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置表头样式
|
||||
/// </summary>
|
||||
/// <param name="sheet"></param>
|
||||
/// <param name="fromRow"></param>
|
||||
/// <param name="fromCol"></param>
|
||||
/// <param name="toRow"></param>
|
||||
/// <param name="toCol"></param>
|
||||
public static void SetTitle(ExcelWorksheet sheet, int fromRow, int fromCol, int toRow, int toCol)
|
||||
{
|
||||
using var range = sheet.Cells[fromRow, fromCol, toRow, toCol];
|
||||
range.Style.Font.Name = "微软雅黑";
|
||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
range.Style.Font.Size = 14;
|
||||
range.Style.Font.Bold = true;
|
||||
range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
|
||||
//range.SetBackgroundColor(System.Drawing.SelectedColor.FromArgb(142, 169, 219));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建Excel文件添加Excel表格
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="sheetName"></param>
|
||||
/// <param name="action"></param>
|
||||
public static void WriteExcel(string filePath, string sheetName, Action<ExcelPackage> action)
|
||||
{
|
||||
using ExcelPackage package = new();
|
||||
var sheet = package.Workbook.Worksheets.Add(sheetName);
|
||||
|
||||
using Stream stream = new FileStream(filePath, FileMode.Create);
|
||||
action(package);
|
||||
package.SaveAs(stream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入Excel
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="action"></param>
|
||||
public static void WriteExcel(string filePath, Action<ExcelPackage> action)
|
||||
{
|
||||
var fileInfo = new FileInfo(filePath);
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
fileInfo.Delete();
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
throw new IOException("文件正在使用");
|
||||
}
|
||||
using ExcelPackage package = new(fileInfo);
|
||||
action(package);
|
||||
package.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
using ExcelPackage package = new(fileInfo);
|
||||
action(package);
|
||||
package.Save();
|
||||
//throw new ArgumentNullException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,11 @@ using ACadSharp.Entities;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public static class DWGAssist
|
||||
{
|
||||
@@ -8,7 +8,7 @@ using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public static class ImageAssist
|
||||
{
|
||||
@@ -2,7 +2,11 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public static class LogAssist
|
||||
{
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public sealed record SingletonViewAssist<T>
|
||||
where T : Window, new()
|
||||
@@ -1,16 +1,20 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists
|
||||
{
|
||||
public class TextSearchAssist
|
||||
{
|
||||
// Using a DependencyProperty as the backing store for IsTextMatch. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty IsTextMatchProperty =
|
||||
DependencyProperty.RegisterAttached("IsTextMatch", typeof(bool), typeof(TextSearchAssist), new UIPropertyMetadata(false));
|
||||
DependencyProperty.RegisterAttached("IsTextMatch", typeof(bool), typeof(Assists.TextSearchAssist), new UIPropertyMetadata(false));
|
||||
|
||||
// Using a DependencyProperty as the backing store for SearchValue. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty SearchValueProperty =
|
||||
DependencyProperty.RegisterAttached("SearchValue", typeof(string), typeof(TextSearchAssist),
|
||||
DependencyProperty.RegisterAttached("SearchValue", typeof(string), typeof(Assists.TextSearchAssist),
|
||||
new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static bool GetIsTextMatch(DependencyObject obj)
|
||||
@@ -1,4 +1,8 @@
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public enum ThumbnailOptions
|
||||
{
|
||||
@@ -2,7 +2,11 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
/// <summary>
|
||||
/// 各种验证帮助类
|
||||
@@ -11,7 +11,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public static class WinDialogAssist
|
||||
{
|
||||
@@ -78,18 +78,17 @@ public static class WinDialogAssist
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileFullName))
|
||||
throw new ArgumentNullException(nameof(fileFullName));
|
||||
fileFullName = Path.GetFullPath(fileFullName);
|
||||
var pidlList = ILCreateFromPathW(fileFullName);
|
||||
if (pidlList == IntPtr.Zero) return;
|
||||
try
|
||||
if (!File.Exists(fileFullName))
|
||||
{
|
||||
Marshal.ThrowExceptionForHR(SHOpenFolderAndSelectItems(pidlList, 0, IntPtr.Zero, 0));
|
||||
}
|
||||
finally
|
||||
{
|
||||
ILFree(pidlList);
|
||||
throw new FileNotFoundException("指定的文件不存在", fileFullName);
|
||||
}
|
||||
var proc = new System.Diagnostics.Process();
|
||||
proc.StartInfo.FileName = "explorer";
|
||||
//打开资源管理器
|
||||
proc.StartInfo.Arguments = "/select," + fileFullName;
|
||||
proc.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新建一个资源管理器窗口并选中文件或文件夹
|
||||
/// </summary>
|
||||
@@ -200,41 +199,8 @@ public static class WinDialogAssist
|
||||
}
|
||||
view.Activate();
|
||||
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
|
||||
|
||||
//AssemblyLoaderHelpers loaderUtil = new(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
|
||||
//loaderUtil.HookAssemblyResolve();
|
||||
//try
|
||||
//{
|
||||
// var view = SingletonViewAssist<Command>.GetInstance(out var isNewCreate);
|
||||
// if (isNewCreate)
|
||||
// {
|
||||
// view.DataContext = viewModel;
|
||||
// view.ShowAhead();
|
||||
// }
|
||||
// view.Activate();
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// LogAssist.ToLog($"{ex.Source}:{ex.StackTrace}");
|
||||
//}
|
||||
//finally
|
||||
//{
|
||||
// loaderUtil.UnhookAssemblyResolve();
|
||||
//}
|
||||
}
|
||||
//private static Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)
|
||||
//{
|
||||
// if (!args.Name.Contains("Xaml.Behaviors"))
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// var assemblyFile = Path.Combine(
|
||||
// Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
|
||||
// "Microsoft.Xaml.Behaviors.dll"
|
||||
// );
|
||||
// return File.Exists(assemblyFile) ? Assembly.LoadFrom(assemblyFile) : null;
|
||||
//}
|
||||
private static Dictionary<Type, Window> _windows = [];
|
||||
public static void ShowOrActivate<TWindow, TViewModel>(params object[] viewModelParams)
|
||||
where TWindow : Window, new()
|
||||
@@ -3,7 +3,11 @@ using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
/// <summary>
|
||||
/// 获取Windows缩略图
|
||||
@@ -54,7 +58,7 @@ public class WindowsThumbnailProvider
|
||||
return Image.GetPixelFormatSize(bmp.PixelFormat) < 32 ? bmp : CreateAlphaBitmap(bmp, PixelFormat.Format32bppArgb);
|
||||
}
|
||||
|
||||
public static Bitmap GetThumbnail(string fileName, int width, int height, ThumbnailOptions options)
|
||||
public static Bitmap GetThumbnail(string fileName, int width, int height, Assists.ThumbnailOptions options)
|
||||
{
|
||||
var hBitmap = GetHBitmap(Path.GetFullPath(fileName), width, height, options);
|
||||
|
||||
@@ -83,7 +87,7 @@ public class WindowsThumbnailProvider
|
||||
[MarshalAs(UnmanagedType.Interface)] out Assists.WindowsThumbnailProvider.IShellItem shellItem
|
||||
);
|
||||
|
||||
private static IntPtr GetHBitmap(string fileName, int width, int height, ThumbnailOptions options)
|
||||
private static IntPtr GetHBitmap(string fileName, int width, int height, Assists.ThumbnailOptions options)
|
||||
{
|
||||
var shellItem2Guid = new Guid(ShellItem2Guid);
|
||||
var retCode = SHCreateItemFromParsingName(fileName, IntPtr.Zero, ref shellItem2Guid, out var nativeShellItem);
|
||||
@@ -141,7 +145,7 @@ public class WindowsThumbnailProvider
|
||||
internal interface IShellItemImageFactory
|
||||
{
|
||||
[PreserveSig]
|
||||
Assists.WindowsThumbnailProvider.HResult GetImage([In] [MarshalAs(UnmanagedType.Struct)] Assists.WindowsThumbnailProvider.NativeSize size, [In] ThumbnailOptions flags, [Out] out IntPtr phbm);
|
||||
Assists.WindowsThumbnailProvider.HResult GetImage([In] [MarshalAs(UnmanagedType.Struct)] Assists.WindowsThumbnailProvider.NativeSize size, [In] Assists.ThumbnailOptions flags, [Out] out IntPtr phbm);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Attributes;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
public sealed class GreaterThanAttribute : ValidationAttribute
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Attributes;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
public sealed class IsNumericAttribute : ValidationAttribute
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Attributes;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
public sealed class MaximumAttribute : ValidationAttribute
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Attributes;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
public sealed class MinimumAttribute : ValidationAttribute
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Attributes;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
public sealed class NotNullOrEmptyAttribute : ValidationAttribute
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Attributes
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
public class UndefinedCharAttribute : ValidationAttribute
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ShrlAlgoToolkit.Mvvm.Behaviors;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Behavious;
|
||||
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
|
||||
public class BooleanConverter<T> : IValueConverter
|
||||
{
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Windows;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
|
||||
public class BooleanToVisConverter : BooleanConverter<Visibility>
|
||||
{
|
||||
public BooleanToVisConverter() : base(Visibility.Visible, Visibility.Collapsed)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,12 @@
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class ColorToBrushConverter : IValueConverter
|
||||
{
|
||||
@@ -1,7 +1,12 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class ComparisonConverter : IValueConverter
|
||||
{
|
||||
@@ -1,7 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
public class EnumDescriptionExtension : MarkupExtension
|
||||
{
|
||||
@@ -2,7 +2,12 @@
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// 枚举类上加特性[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
@@ -4,7 +4,12 @@ using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Description(描述特性)的枚举转换同时也是枚举源的集合
|
||||
@@ -1,7 +1,12 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class InvertBooleanConverter : IValueConverter
|
||||
{
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Windows;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class InverterBooleanToVisConverter : BooleanConverter<Visibility>
|
||||
{
|
||||
public InverterBooleanToVisConverter() : base(Visibility.Collapsed, Visibility.Visible)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,12 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace ShrlAlgo.Toolkit.Wpf.Converters
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
[ValueConversion(typeof(bool), typeof(Visibility))]
|
||||
public class BoolVisibilityConverter : MarkupExtension, IValueConverter
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts null or not null to a <see cref="Visibility" />.
|
||||
@@ -3,14 +3,19 @@ using System.Windows.Data;
|
||||
|
||||
using Color = System.Windows.Media.Color;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Autodesk颜色转Windows系统颜色
|
||||
/// </summary>
|
||||
public class Rv2WinColorConverter : IValueConverter
|
||||
{
|
||||
public static Rv2WinColorConverter Instance { get; } = new Rv2WinColorConverter();
|
||||
public static Converters.Rv2WinColorConverter Instance { get; } = new Converters.Rv2WinColorConverter();
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var color = (Autodesk.Revit.DB.Color)value;
|
||||
@@ -1,11 +1,16 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
public class SearchFamilyValueConverter : IMultiValueConverter
|
||||
{
|
||||
public static SearchFamilyValueConverter Instance { get; } = new SearchFamilyValueConverter();
|
||||
public static Converters.SearchFamilyValueConverter Instance { get; } = new Converters.SearchFamilyValueConverter();
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
@@ -1,11 +1,16 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
public class SearchTypeValueConverter : IMultiValueConverter
|
||||
{
|
||||
public static SearchTypeValueConverter Instance { get; } = new SearchTypeValueConverter();
|
||||
public static Converters.SearchTypeValueConverter Instance { get; } = new Converters.SearchTypeValueConverter();
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
@@ -1,6 +1,11 @@
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class SearchValueConverter : IMultiValueConverter
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Extensions
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Extensions
|
||||
{
|
||||
public static class CommonExtensions
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Extensions;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义Distinct扩展方法
|
||||
@@ -8,9 +8,9 @@ public static class DistinctExtensions
|
||||
public static IEnumerable<T> Distinct<T>(
|
||||
this IEnumerable<T> source, Func<T, T, bool> comparer)
|
||||
where T : class
|
||||
=> source.Distinct(new DistinctExtensions.DynamicEqualityComparer<T>(comparer));
|
||||
=> source.Distinct(new Extensions.DistinctExtensions.DynamicEqualityComparer<T>(comparer));
|
||||
public static IEnumerable<T> Distinct<T, V>(this IEnumerable<T> source, Func<T, V> keySelector)
|
||||
=> source.Distinct(new DistinctExtensions.CommonEqualityComparer<T, V>(keySelector));
|
||||
=> source.Distinct(new Extensions.DistinctExtensions.CommonEqualityComparer<T, V>(keySelector));
|
||||
private sealed class DynamicEqualityComparer<T> : IEqualityComparer<T>
|
||||
where T : class
|
||||
{
|
||||
@@ -6,7 +6,7 @@ using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Extensions;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Extensions;
|
||||
|
||||
public static class ImageExtensions
|
||||
{
|
||||
@@ -0,0 +1,114 @@
|
||||
using MiniExcelLibs;
|
||||
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Extensions
|
||||
{
|
||||
public static class MiniExcelExtensions
|
||||
{
|
||||
// --- 写入部分 (Write) ---
|
||||
|
||||
/// <summary>
|
||||
/// 开始流式配置 Excel 写入
|
||||
/// </summary>
|
||||
public static Extensions.ExcelWriter<T> AsExcel<T>(this IEnumerable<T> data)
|
||||
{
|
||||
return new Extensions.ExcelWriter<T>(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 快速保存多 Sheet 字典到文件
|
||||
/// </summary>
|
||||
public static void SaveAsExcel(this Dictionary<string, object> sheetsData, string filePath, bool overwrite = true)
|
||||
{
|
||||
// 自动清理 Sheet 名称中的非法字符
|
||||
var sanitizedData = new Dictionary<string, object>();
|
||||
foreach (var kvp in sheetsData)
|
||||
{
|
||||
sanitizedData.Add(SanitizeSheetName(kvp.Key), kvp.Value);
|
||||
}
|
||||
MiniExcel.SaveAs(filePath, sanitizedData, overwriteFile: overwrite);
|
||||
}
|
||||
|
||||
// --- 读取部分 (Read) ---
|
||||
|
||||
/// <summary>
|
||||
/// 从文件路径直接读取数据为强类型列表
|
||||
/// </summary>
|
||||
public static IEnumerable<T> ReadExcel<T>(this string filePath, string sheetName = null) where T : class, new()
|
||||
{
|
||||
if (!File.Exists(filePath)) throw new FileNotFoundException("Excel文件不存在", filePath);
|
||||
return MiniExcel.Query<T>(filePath, sheetName: sheetName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从文件路径读取为动态类型 (Dictionary/dynamic)
|
||||
/// </summary>
|
||||
public static IEnumerable<dynamic> ReadExcelDynamic(this string filePath, string sheetName = null)
|
||||
{
|
||||
if (!File.Exists(filePath)) throw new FileNotFoundException("Excel文件不存在", filePath);
|
||||
return MiniExcel.Query(filePath, sheetName: sheetName);
|
||||
}
|
||||
|
||||
// --- 工具方法 ---
|
||||
|
||||
/// <summary>
|
||||
/// 清理 Excel Sheet 名称中的非法字符
|
||||
/// </summary>
|
||||
public static string SanitizeSheetName(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) return "Sheet1";
|
||||
char[] invalidChars = { '\\', '/', '?', '*', '[', ']', ':' };
|
||||
foreach (var c in invalidChars) name = name.Replace(c, '_');
|
||||
return name.Length > 31 ? name.Substring(0, 31) : name;
|
||||
}
|
||||
}
|
||||
|
||||
public class ExcelWriter<T>
|
||||
{
|
||||
private readonly IEnumerable<T> data;
|
||||
private string sheetName = "Sheet1";
|
||||
private bool overwrite = true;
|
||||
|
||||
public ExcelWriter(IEnumerable<T> data) => this.data = data;
|
||||
|
||||
/// <summary>
|
||||
/// 设置 Sheet 名称
|
||||
/// </summary>
|
||||
public Extensions.ExcelWriter<T> WithSheetName(string name)
|
||||
{
|
||||
sheetName = Extensions.MiniExcelExtensions.SanitizeSheetName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置是否覆盖
|
||||
/// </summary>
|
||||
public Extensions.ExcelWriter<T> Overwrite(bool canOverwrite = true)
|
||||
{
|
||||
overwrite = canOverwrite;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行保存到文件
|
||||
/// </summary>
|
||||
public void SaveTo(string filePath)
|
||||
{
|
||||
MiniExcel.SaveAs(filePath, data, sheetName: sheetName, overwriteFile: overwrite);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转换为字节数组 (用于 Web 下载或内存操作)
|
||||
/// </summary>
|
||||
public byte[] ToBytes()
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
ms.SaveAs(data, sheetName: sheetName);
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Extensions;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Extensions;
|
||||
#region 格式化
|
||||
|
||||
//StringFormat={}{0:C} $123.46
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ShrlAlgoToolkit.Mvvm.ValidationRules;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.ValidationRules;
|
||||
|
||||
public class DoubleValidationRule : ValidationRule
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ShrlAlgoToolkit.Mvvm.ValidationRules;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.ValidationRules;
|
||||
|
||||
public class RangeValidationRule : ValidationRule
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ShrlAlgoToolkit.Mvvm.ValidationRules;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.ValidationRules;
|
||||
|
||||
public class RequiredValidationRule : ValidationRule
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ShrlAlgoToolkit.Mvvm.ValidationRules
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.ValidationRules
|
||||
{
|
||||
public class UndefinedCharRules : ValidationRule
|
||||
{
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
|
||||
public class BooleanToVisConverter : Converters.BooleanConverter<Visibility>
|
||||
{
|
||||
public BooleanToVisConverter() : base(Visibility.Visible, Visibility.Collapsed)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
|
||||
public class InverterBooleanToVisConverter : Converters.BooleanConverter<Visibility>
|
||||
{
|
||||
public InverterBooleanToVisConverter() : base(Visibility.Collapsed, Visibility.Visible)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Fonts;
|
||||
// Generated by IconFont2Code: https://andreinitescu.github.io/IconFont2Code
|
||||
// If you change the class to 'public' in order to use it outside its assembly
|
||||
// you should also change the fields from 'const' to 'public static readonly'
|
||||
static class AwesomeFreeRegular
|
||||
{
|
||||
public const string Space = "\u0020";
|
||||
public const string Exclamation = "\u0021";
|
||||
public const string Hashtag = "\u0023";
|
||||
public const string DollarSign = "\u0024";
|
||||
public const string Percent = "\u0025";
|
||||
public const string Asterisk = "\u002a";
|
||||
public const string Plus = "\u002b";
|
||||
public const string Hyphen = "\u002d";
|
||||
public const string _0 = "\u0030";
|
||||
public const string _1 = "\u0031";
|
||||
public const string _2 = "\u0032";
|
||||
public const string _3 = "\u0033";
|
||||
public const string _4 = "\u0034";
|
||||
public const string _5 = "\u0035";
|
||||
public const string _6 = "\u0036";
|
||||
public const string _7 = "\u0037";
|
||||
public const string _8 = "\u0038";
|
||||
public const string _9 = "\u0039";
|
||||
public const string LessThan = "\u003c";
|
||||
public const string _Equals = "\u003d";
|
||||
public const string GreaterThan = "\u003e";
|
||||
public const string Question = "\u003f";
|
||||
public const string At = "\u0040";
|
||||
public const string a = "\u0041";
|
||||
public const string b = "\u0042";
|
||||
public const string c = "\u0043";
|
||||
public const string d = "\u0044";
|
||||
public const string e = "\u0045";
|
||||
public const string f = "\u0046";
|
||||
public const string g = "\u0047";
|
||||
public const string h = "\u0048";
|
||||
public const string i = "\u0049";
|
||||
public const string j = "\u004a";
|
||||
public const string k = "\u004b";
|
||||
public const string l = "\u004c";
|
||||
public const string m = "\u004d";
|
||||
public const string n = "\u004e";
|
||||
public const string o = "\u004f";
|
||||
public const string p = "\u0050";
|
||||
public const string q = "\u0051";
|
||||
public const string r = "\u0052";
|
||||
public const string s = "\u0053";
|
||||
public const string t = "\u0054";
|
||||
public const string u = "\u0055";
|
||||
public const string v = "\u0056";
|
||||
public const string w = "\u0057";
|
||||
public const string x = "\u0058";
|
||||
public const string y = "\u0059";
|
||||
public const string z = "\u005a";
|
||||
public const string ZeroWidthSpace = "\u0022";
|
||||
public const string FolderClosed = "\ue185";
|
||||
public const string Notdef = "\ue1fe";
|
||||
public const string Heart = "\u2665";
|
||||
public const string Star = "\u2b50";
|
||||
public const string User = "\uf007";
|
||||
public const string Clock = "\uf017";
|
||||
public const string RectangleList = "\uf022";
|
||||
public const string Flag = "\uf024";
|
||||
public const string Bookmark = "\uf02e";
|
||||
public const string Image = "\uf03e";
|
||||
public const string PenToSquare = "\uf044";
|
||||
public const string CircleXmark = "\uf057";
|
||||
public const string CircleCheck = "\uf058";
|
||||
public const string CircleQuestion = "\uf059";
|
||||
public const string Eye = "\uf06e";
|
||||
public const string EyeSlash = "\uf070";
|
||||
public const string CalendarDays = "\uf073";
|
||||
public const string Comment = "\uf075";
|
||||
public const string Folder = "\uf07b";
|
||||
public const string FolderOpen = "\uf07c";
|
||||
public const string ChartBar = "\uf080";
|
||||
public const string Comments = "\uf086";
|
||||
public const string StarHalf = "\uf089";
|
||||
public const string Lemon = "\uf094";
|
||||
public const string CreditCard = "\uf09d";
|
||||
public const string HardDrive = "\uf0a0";
|
||||
public const string HandPointRight = "\uf0a4";
|
||||
public const string HandPointLeft = "\uf0a5";
|
||||
public const string HandPointUp = "\u261d";
|
||||
public const string HandPointDown = "\uf0a7";
|
||||
public const string Copy = "\uf0c5";
|
||||
public const string FloppyDisk = "\uf0c7";
|
||||
public const string Square = "\u25a0";
|
||||
public const string Envelope = "\u2709";
|
||||
public const string Paste = "\uf0ea";
|
||||
public const string Lightbulb = "\uf0eb";
|
||||
public const string Bell = "\uf0a2";
|
||||
public const string Hospital = "\uf0f8";
|
||||
public const string SquarePlus = "\uf0fe";
|
||||
public const string Circle = "\u25cf";
|
||||
public const string FaceSmile = "\uf118";
|
||||
public const string FaceFrown = "\u2639";
|
||||
public const string FaceMeh = "\uf11a";
|
||||
public const string Keyboard = "\u2328";
|
||||
public const string Calendar = "\uf133";
|
||||
public const string CirclePlay = "\uf01d";
|
||||
public const string SquareMinus = "\uf146";
|
||||
public const string SquareCheck = "\u2611";
|
||||
public const string ShareFromSquare = "\uf045";
|
||||
public const string Compass = "\uf14e";
|
||||
public const string SquareCaretDown = "\uf150";
|
||||
public const string SquareCaretUp = "\uf151";
|
||||
public const string SquareCaretRight = "\uf152";
|
||||
public const string File = "\uf016";
|
||||
public const string FileLines = "\uf0f6";
|
||||
public const string ThumbsUp = "\uf087";
|
||||
public const string ThumbsDown = "\uf088";
|
||||
public const string Sun = "\u2600";
|
||||
public const string Moon = "\u23fe";
|
||||
public const string SquareCaretLeft = "\uf191";
|
||||
public const string CircleDot = "\uf192";
|
||||
public const string Building = "\uf0f7";
|
||||
public const string FilePdf = "\uf1c1";
|
||||
public const string FileWord = "\uf1c2";
|
||||
public const string FileExcel = "\uf1c3";
|
||||
public const string FilePowerpoint = "\uf1c4";
|
||||
public const string FileImage = "\uf1c5";
|
||||
public const string FileZipper = "\uf1c6";
|
||||
public const string FileAudio = "\uf1c7";
|
||||
public const string FileVideo = "\uf1c8";
|
||||
public const string FileCode = "\uf1c9";
|
||||
public const string LifeRing = "\uf1cd";
|
||||
public const string PaperPlane = "\uf1d8";
|
||||
public const string Futbol = "\u26bd";
|
||||
public const string Newspaper = "\uf1ea";
|
||||
public const string BellSlash = "\uf1f6";
|
||||
public const string Copyright = "\u00a9";
|
||||
public const string ClosedCaptioning = "\uf20a";
|
||||
public const string ObjectGroup = "\uf247";
|
||||
public const string ObjectUngroup = "\uf248";
|
||||
public const string NoteSticky = "\uf249";
|
||||
public const string Clone = "\uf24d";
|
||||
public const string HourglassHalf = "\uf252";
|
||||
public const string Hourglass = "\u23f3";
|
||||
public const string HandBackFist = "\uf255";
|
||||
public const string Hand = "\u270b";
|
||||
public const string HandScissors = "\uf257";
|
||||
public const string HandLizard = "\uf258";
|
||||
public const string HandSpock = "\uf259";
|
||||
public const string HandPointer = "\uf25a";
|
||||
public const string HandPeace = "\u270c";
|
||||
public const string Registered = "\u00ae";
|
||||
public const string CalendarPlus = "\uf271";
|
||||
public const string CalendarMinus = "\uf272";
|
||||
public const string CalendarXmark = "\uf273";
|
||||
public const string CalendarCheck = "\uf274";
|
||||
public const string Map = "\uf278";
|
||||
public const string Message = "\uf27a";
|
||||
public const string CirclePause = "\uf28b";
|
||||
public const string CircleStop = "\uf28d";
|
||||
public const string FontAwesome = "\uf2b4";
|
||||
public const string Handshake = "\uf2b5";
|
||||
public const string EnvelopeOpen = "\uf2b6";
|
||||
public const string AddressBook = "\uf2b9";
|
||||
public const string AddressCard = "\uf2bb";
|
||||
public const string CircleUser = "\uf2bd";
|
||||
public const string IdBadge = "\uf2c1";
|
||||
public const string IdCard = "\uf2c2";
|
||||
public const string WindowMaximize = "\uf2d0";
|
||||
public const string WindowMinimize = "\uf2d1";
|
||||
public const string WindowRestore = "\uf2d2";
|
||||
public const string Snowflake = "\u2744";
|
||||
public const string TrashCan = "\uf014";
|
||||
public const string Images = "\uf302";
|
||||
public const string Clipboard = "\uf328";
|
||||
public const string CircleDown = "\uf01a";
|
||||
public const string CircleLeft = "\uf190";
|
||||
public const string CircleRight = "\uf18e";
|
||||
public const string CircleUp = "\uf01b";
|
||||
public const string Gem = "\uf3a5";
|
||||
public const string MoneyBill1 = "\uf3d1";
|
||||
public const string RectangleXmark = "\uf2d4";
|
||||
public const string ChessBishop = "\u265d";
|
||||
public const string ChessKing = "\u265a";
|
||||
public const string ChessKnight = "\u265e";
|
||||
public const string ChessPawn = "\u265f";
|
||||
public const string ChessQueen = "\u265b";
|
||||
public const string ChessRook = "\u265c";
|
||||
public const string SquareFull = "\u2b1b";
|
||||
public const string CommentDots = "\uf27b";
|
||||
public const string FaceSmileWink = "\uf4da";
|
||||
public const string FaceAngry = "\uf556";
|
||||
public const string FaceDizzy = "\uf567";
|
||||
public const string FaceFlushed = "\uf579";
|
||||
public const string FaceFrownOpen = "\uf57a";
|
||||
public const string FaceGrimace = "\uf57f";
|
||||
public const string FaceGrin = "\uf580";
|
||||
public const string FaceGrinWide = "\uf581";
|
||||
public const string FaceGrinBeam = "\uf582";
|
||||
public const string FaceGrinBeamSweat = "\uf583";
|
||||
public const string FaceGrinHearts = "\uf584";
|
||||
public const string FaceGrinSquint = "\uf585";
|
||||
public const string FaceGrinSquintTears = "\uf586";
|
||||
public const string FaceGrinStars = "\uf587";
|
||||
public const string FaceGrinTears = "\uf588";
|
||||
public const string FaceGrinTongue = "\uf589";
|
||||
public const string FaceGrinTongueSquint = "\uf58a";
|
||||
public const string FaceGrinTongueWink = "\uf58b";
|
||||
public const string FaceGrinWink = "\uf58c";
|
||||
public const string FaceKiss = "\uf596";
|
||||
public const string FaceKissBeam = "\uf597";
|
||||
public const string FaceKissWinkHeart = "\uf598";
|
||||
public const string FaceLaugh = "\uf599";
|
||||
public const string FaceLaughBeam = "\uf59a";
|
||||
public const string FaceLaughSquint = "\uf59b";
|
||||
public const string FaceLaughWink = "\uf59c";
|
||||
public const string FaceMehBlank = "\uf5a4";
|
||||
public const string FaceRollingEyes = "\uf5a5";
|
||||
public const string FaceSadCry = "\uf5b3";
|
||||
public const string FaceSadTear = "\uf5b4";
|
||||
public const string FaceSmileBeam = "\uf5b8";
|
||||
public const string StarHalfStroke = "\uf5c0";
|
||||
public const string FaceSurprise = "\uf5c2";
|
||||
public const string FaceTired = "\uf5c8";
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
global using Autodesk.Revit.UI;
|
||||
global using JetBrains.Annotations;
|
||||
global using ShrlAlgoToolkit.Revit.Assists;
|
||||
global using ShrlAlgoToolkit.Revit.Extensions;
|
||||
global using ShrlAlgoToolkit.RevitCore.Assists;
|
||||
global using ShrlAlgoToolkit.RevitCore.Extensions;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.ModelManager;
|
||||
|
||||
@@ -9,5 +9,5 @@ namespace ShrlAlgoToolkit.RevitAddins.ModelManager;
|
||||
[UsedImplicitly]
|
||||
public class ModelCheckCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute() => WinDialogAssist.ShowOrActivate<ModelCheckView, ModelCheckViewModel>(UiApplication);//ModelCheckView view = SingletonViewAssist<ModelCheckView>.GetInstance(out var isNewCreate);//if (isNewCreate)//{// view.DataContext = new ModelCheckViewModel(uiApplication);// view.ShowAhead();//}//view.Activate();
|
||||
public override void Execute() => Common.Assists.WinDialogAssist.ShowOrActivate<ModelCheckView, ModelCheckViewModel>(UiApplication);//ModelCheckView view = SingletonViewAssist<ModelCheckView>.GetInstance(out var isNewCreate);//if (isNewCreate)//{// view.DataContext = new ModelCheckViewModel(uiApplication);// view.ShowAhead();//}//view.Activate();
|
||||
}
|
||||
@@ -1,15 +1,24 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Architecture;
|
||||
using Autodesk.Revit.DB.Electrical;
|
||||
using Autodesk.Revit.DB.Mechanical;
|
||||
using Autodesk.Revit.DB.Plumbing;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using MiniExcelLibs;
|
||||
using MiniExcelLibs.OpenXml;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Windows;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.ModelManager;
|
||||
@@ -356,75 +365,150 @@ public partial class ModelCheckViewModel : ObservableObject
|
||||
|
||||
try
|
||||
{
|
||||
EPPlusHelper.WriteExcel(
|
||||
dialog.FileName,
|
||||
m =>
|
||||
var config = new OpenXmlConfiguration()
|
||||
{
|
||||
var groups = Items.GroupBy(e => e.ErrorMessage);
|
||||
foreach (var group in groups)
|
||||
{
|
||||
var sheet = m.Workbook.Worksheets.Add(group.Key);
|
||||
//int columns = tdd.NumberOfColumns;
|
||||
//int rows = group.Count() + 1;
|
||||
for (var i = -1; i < group.Count(); i++)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
sheet.Cells[1, 1].Value = "元素ID";
|
||||
sheet.Cells[1, 2].Value = "族类别";
|
||||
sheet.Cells[1, 3].Value = "类型或实例名称";
|
||||
sheet.Cells[1, 4].Value = "参照标高";
|
||||
sheet.Cells[1, 5].Value = "系统";
|
||||
sheet.Cells[1, 6].Value = "主体";
|
||||
sheet.Cells[1, 7].Value = "房间";
|
||||
}
|
||||
else
|
||||
{
|
||||
var elem = group.ElementAt(i).Element;
|
||||
TableStyles = TableStyles.Default,
|
||||
AutoFilter = true,
|
||||
};
|
||||
Dictionary<string, MessageModel[]> sheets = Items.GroupBy(e => e.ErrorMessage).ToDictionary(g => g.Key, g => g.ToArray());
|
||||
MiniExcel.SaveAs(dialog.FileName, sheets);
|
||||
|
||||
var type = elem.GetType();
|
||||
var host = type.GetProperty("Host");
|
||||
var level = type.GetProperty("ReferenceLevel");
|
||||
var mepSystem = type.GetProperty("MEPSystem");
|
||||
var room = type.GetProperty("Room");
|
||||
sheet.Cells[i + 2, 1].Value = elem.Id.ToString();
|
||||
sheet.Cells[i + 2, 2].Value = elem.Category.Name;
|
||||
sheet.Cells[i + 2, 3].Value = elem.Name;
|
||||
//EPPlusHelper.WriteExcel(
|
||||
// dialog.FileName,
|
||||
// m =>
|
||||
// {
|
||||
// IEnumerable<IGrouping<string, MessageModel>> groups = Items.GroupBy(e => e.ErrorMessage);
|
||||
// foreach (var group in groups)
|
||||
// {
|
||||
// var sheet = m.Workbook.Worksheets.Add(group.Key);
|
||||
// for (var i = -1; i < group.Count(); i++)
|
||||
// {
|
||||
// if (i == -1)
|
||||
// {
|
||||
// sheet.Cells[1, 1].Value = "元素ID";
|
||||
// sheet.Cells[1, 2].Value = "族类别";
|
||||
// sheet.Cells[1, 3].Value = "类型或实例名称";
|
||||
// sheet.Cells[1, 4].Value = "参照标高";
|
||||
// sheet.Cells[1, 5].Value = "系统";
|
||||
// sheet.Cells[1, 6].Value = "主体";
|
||||
// sheet.Cells[1, 7].Value = "房间";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var elem = group.ElementAt(i).Element;
|
||||
|
||||
if (level != null)
|
||||
{
|
||||
sheet.Cells[i + 2, 4].Value = (level.GetValue(elem, null) as Level)?.Name;
|
||||
}
|
||||
if (mepSystem != null)
|
||||
{
|
||||
sheet.Cells[i + 2, 5].Value = (mepSystem.GetValue(elem, null) as MEPSystem)?.Name;
|
||||
}
|
||||
if (host != null)
|
||||
{
|
||||
sheet.Cells[i + 2, 6].Value = (host.GetValue(elem, null) as Element)?.Name;
|
||||
}
|
||||
if (room != null)
|
||||
{
|
||||
sheet.Cells[i + 2, 7].Value = (room.GetValue(room, null) as Room)?.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
EPPlusHelper.SetTitle(sheet, 1, 1, 1, 7);
|
||||
EPPlusHelper.SetStyle(sheet, 2, 1, group.Count() + 1, 7);
|
||||
// var type = elem.GetType();
|
||||
// var host = type.GetProperty("Host");
|
||||
// var level = type.GetProperty("ReferenceLevel");
|
||||
// var mepSystem = type.GetProperty("MEPSystem");
|
||||
// var room = type.GetProperty("Room");
|
||||
// sheet.Cells[i + 2, 1].Value = elem.Id.ToString();
|
||||
// sheet.Cells[i + 2, 2].Value = elem.Category.Name;
|
||||
// sheet.Cells[i + 2, 3].Value = elem.Name;
|
||||
|
||||
var range = sheet.Cells[1, 1, group.Count() + 1, 7];
|
||||
range.AutoFitColumns();
|
||||
}
|
||||
}
|
||||
);
|
||||
WinDialogAssist.OpenFolderAndSelectFile(dialog.FileName);
|
||||
// if (level != null)
|
||||
// {
|
||||
// sheet.Cells[i + 2, 4].Value = (level.GetValue(elem, null) as Level)?.Name;
|
||||
// }
|
||||
// if (mepSystem != null)
|
||||
// {
|
||||
// sheet.Cells[i + 2, 5].Value = (mepSystem.GetValue(elem, null) as MEPSystem)?.Name;
|
||||
// }
|
||||
// if (host != null)
|
||||
// {
|
||||
// sheet.Cells[i + 2, 6].Value = (host.GetValue(elem, null) as Element)?.Name;
|
||||
// }
|
||||
// if (room != null)
|
||||
// {
|
||||
// sheet.Cells[i + 2, 7].Value = (room.GetValue(room, null) as Room)?.Name;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// EPPlusHelper.SetTitle(sheet, 1, 1, 1, 7);
|
||||
// EPPlusHelper.SetStyle(sheet, 2, 1, group.Count() + 1, 7);
|
||||
|
||||
// var range = sheet.Cells[1, 1, group.Count() + 1, 7];
|
||||
// range.AutoFitColumns();
|
||||
// }
|
||||
// }
|
||||
//);
|
||||
ExportErrorMessageToExcel(dialog.FileName);
|
||||
Common.Assists.WinDialogAssist.OpenFolderAndSelectFile(dialog.FileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Assists.LogAssist.ToLog(ex.Message);
|
||||
Common.Assists.LogAssist.ToLog(ex.Message);
|
||||
}
|
||||
}
|
||||
private void ExportErrorMessageToExcel(string filePath)
|
||||
{
|
||||
// 1. 准备大字典,用于存放所有 Sheet 数据
|
||||
var allSheetsData = new Dictionary<string, object>();
|
||||
|
||||
// 2. 分组逻辑保持不变
|
||||
IEnumerable<IGrouping<string, MessageModel>> groups = Items.GroupBy(e => e.ErrorMessage);
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
// 3. 构造当前 Sheet 的行数据列表
|
||||
var sheetRows = new List<Dictionary<string, object>>();
|
||||
|
||||
foreach (var item in group)
|
||||
{
|
||||
var elem = item.Element;
|
||||
if (elem == null) continue;
|
||||
|
||||
var type = elem.GetType();
|
||||
|
||||
// 创建一行数据
|
||||
var row = new Dictionary<string, object>();
|
||||
|
||||
// 直接赋值固定属性
|
||||
row["元素ID"] = elem.Id.ToString();
|
||||
row["族类别"] = elem.Category?.Name ?? "";
|
||||
row["类型或实例名称"] = elem.Name;
|
||||
|
||||
// 使用反射获取动态属性(保留你原有的逻辑)
|
||||
var levelProp = type.GetProperty("ReferenceLevel");
|
||||
var mepProp = type.GetProperty("MEPSystem");
|
||||
var hostProp = type.GetProperty("Host");
|
||||
var roomProp = type.GetProperty("Room");
|
||||
|
||||
row["参照标高"] = levelProp != null ? (levelProp.GetValue(elem, null) as Level)?.Name : "";
|
||||
row["系统"] = mepProp != null ? (mepProp.GetValue(elem, null) as MEPSystem)?.Name : "";
|
||||
row["主体"] = hostProp != null ? (hostProp.GetValue(elem, null) as Element)?.Name : "";
|
||||
|
||||
// 注意:原代码中 room.GetValue(room, null) 应该是 roomProp.GetValue(elem, null) 的笔误
|
||||
row["房间"] = roomProp != null ? (roomProp.GetValue(elem, null) as Room)?.Name : "";
|
||||
|
||||
sheetRows.Add(row);
|
||||
}
|
||||
|
||||
// 4. 处理 Sheet 名称(Excel 限制 31 个字符且不能有特殊字符)
|
||||
string sheetName = group.Key ?? "未命名";
|
||||
char[] invalidChars = { '\\', '/', '?', '*', '[', ']', ':' };
|
||||
foreach (var c in invalidChars) sheetName = sheetName.Replace(c, '_');
|
||||
if (sheetName.Length > 31) sheetName = sheetName.Substring(0, 31);
|
||||
|
||||
// 防止同名 Sheet 冲突
|
||||
if (allSheetsData.ContainsKey(sheetName))
|
||||
sheetName = sheetName.Substring(0, Math.Min(sheetName.Length, 25)) + "_" + Guid.NewGuid().ToString().Substring(0, 4);
|
||||
|
||||
allSheetsData.Add(sheetName, sheetRows);
|
||||
}
|
||||
|
||||
// 5. 保存文件
|
||||
try
|
||||
{
|
||||
// MiniExcel 默认会将 Dictionary 的 Key 作为表头并加粗
|
||||
MiniExcel.SaveAs(filePath, allSheetsData, overwriteFile: true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// 提示文件被占用
|
||||
MessageBox.Show("请先关闭已打开的 Excel 文件后再尝试保存。");
|
||||
}
|
||||
}
|
||||
private void FindBasePoint()
|
||||
{
|
||||
var basePoints = uiapp.ActiveUIDocument.Document.OfClass<BasePoint>().OfType<BasePoint>();
|
||||
@@ -544,7 +628,7 @@ public partial class ModelCheckViewModel : ObservableObject
|
||||
{
|
||||
return;
|
||||
}
|
||||
WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(uiapp.ActiveUIDocument, errorItems, "未解决错误");
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(uiapp.ActiveUIDocument, errorItems, "未解决错误");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.ModelManager;
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
@@ -10,6 +10,6 @@ public class SeparateModelCmd : ExternalCommand
|
||||
{
|
||||
//var win = new SeparateModelWin();
|
||||
//win.Show();
|
||||
WinDialogAssist.ShowOrActivate<SeparateModelWin, SeparateModelViewModel>();
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<SeparateModelWin, SeparateModelViewModel>();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCivil;
|
||||
|
||||
@@ -9,6 +9,6 @@ public class BricksFinishesCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowOrActivate<BricksFinishesView, BricksFinishesViewModel>();
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<BricksFinishesView, BricksFinishesViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public partial class BricksFinishesViewModel : ObservableValidator
|
||||
public partial bool IsEdgeExistGap { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Attributes.Minimum(10.0)]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[Common.Attributes.Minimum(10.0)]
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial double PavementWidth { get; set; }
|
||||
@@ -55,7 +55,7 @@ public partial class BricksFinishesViewModel : ObservableValidator
|
||||
//}
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial double WallBaseOffset { get; set; }
|
||||
@@ -67,8 +67,8 @@ public partial class BricksFinishesViewModel : ObservableValidator
|
||||
//}
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Attributes.Minimum(1.0)]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[Common.Attributes.Minimum(1.0)]
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial double PavementThickness { get; set; }
|
||||
@@ -80,8 +80,8 @@ public partial class BricksFinishesViewModel : ObservableValidator
|
||||
//}
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Attributes.Minimum(10.0)]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[Common.Attributes.Minimum(10.0)]
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial double PavementLength { get; set; }
|
||||
@@ -93,8 +93,8 @@ public partial class BricksFinishesViewModel : ObservableValidator
|
||||
//}
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Attributes.Minimum(1.0)]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[Common.Attributes.Minimum(1.0)]
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial double PavementGap { get; set; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Windows;
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCivil;
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CivilConnectionCmd : ExternalCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
WinDialogAssist.ShowModeless<ResolveCivilConnectView>(new ResolveCivilConnectViewModel(UiDocument));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<ResolveCivilConnectView, ResolveCivilConnectViewModel>(UiDocument);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCivil;
|
||||
|
||||
@@ -9,7 +9,7 @@ public class CreateOpeningsCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowOrActivate<CreateOpeningsView, CreateOpeningsViewModel>();
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<CreateOpeningsView, CreateOpeningsViewModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Autodesk.Revit.UI.Selection;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCivil
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCivil;
|
||||
|
||||
@@ -12,6 +12,6 @@ public class FloorFinishesCmd : ExternalCommand
|
||||
public override void Execute()
|
||||
{
|
||||
var floorTypes = Document.OfClass<FloorType>().Cast<FloorType>().ToList();
|
||||
WinDialogAssist.ShowModeless<FloorFinishesView>(new FloorFinishesViewModel(floorTypes));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<FloorFinishesView, FloorFinishesViewModel>(floorTypes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Windows;
|
||||
|
||||
@@ -474,7 +474,7 @@ public partial class ResolveCivilConnectViewModel : ObservableObject
|
||||
|
||||
if (elementsToSkip.Any())
|
||||
{
|
||||
WinDialogAssist.ShowModeless<MessageWin>(new MessageViewModel(uidoc, elementsToSkip, "未解决构件"));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(uidoc, elementsToSkip, "未解决构件");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using Autodesk.Revit.DB.IFC;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Windows;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCivil;
|
||||
@@ -134,7 +134,7 @@ public class SplitComsByLevelCmd : ExternalCommand
|
||||
|
||||
if (errors.Any())
|
||||
{
|
||||
WinDialogAssist.ShowModeless<MessageWin>(new MessageViewModel(UiDocument, errors, "未解决错误"));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(UiDocument, errors, "未解决错误");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCivil
|
||||
{
|
||||
@@ -12,7 +12,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCivil
|
||||
public override void Execute()
|
||||
{
|
||||
var wallTypes = Document.OfCollector().OfClass(typeof(WallType)).Cast<WallType>().ToList();
|
||||
WinDialogAssist.ShowModeless<WallFinishesView>(new WallFinishesViewModel(wallTypes));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<WallFinishesView, WallFinishesViewModel>(wallTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public partial class WallFinishesViewModel(List<WallType> wallTypes) : Observabl
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Assists.LogAssist.ToLog(ex.Message);
|
||||
Common.Assists.LogAssist.ToLog(ex.Message);
|
||||
}
|
||||
},
|
||||
"创建墙面饰面"
|
||||
@@ -236,7 +236,7 @@ public partial class WallFinishesViewModel(List<WallType> wallTypes) : Observabl
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Assists.LogAssist.ToLog(ex.Message);
|
||||
Common.Assists.LogAssist.ToLog(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public partial class WallFinishesViewModel(List<WallType> wallTypes) : Observabl
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Assists.LogAssist.ToLog(ex.Message);
|
||||
Common.Assists.LogAssist.ToLog(ex.Message);
|
||||
}
|
||||
|
||||
//WallUtils.AllowWallJoinAtEnd(w, 0);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
public partial bool IsCutting { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial ObservableCollection<SelectionElement> Items { get; set; }
|
||||
public partial ObservableCollection<ElementInfo> Items { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string SearchProp { get; set; }
|
||||
@@ -46,7 +46,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
var element = doc.GetElement(elementId);
|
||||
if (element.IsValidObject)
|
||||
{
|
||||
Items.Add(new SelectionElement(element));
|
||||
Items.Add(new ElementInfo(element));
|
||||
}
|
||||
}
|
||||
FilteredList = CollectionViewSource.GetDefaultView(Items);
|
||||
@@ -61,7 +61,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
{
|
||||
return true;
|
||||
}
|
||||
var item = o as SelectionElement;
|
||||
var item = o as ElementInfo;
|
||||
return (item?.Name != null && item.Name.Contains(SearchProp))
|
||||
|| (item?.Number != null && item.Number.Contains(SearchProp))
|
||||
|| (item?.Comment != null && item.Comment.Contains(SearchProp));
|
||||
@@ -71,7 +71,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
[RelayCommand]
|
||||
private void ShowElement(object obj)
|
||||
{
|
||||
if (obj is not SelectionElement selection) return;
|
||||
if (obj is not ElementInfo selection) return;
|
||||
var model = selection.Element;
|
||||
var uidoc = uiapp.ActiveUIDocument;
|
||||
if (model.IsValidObject)
|
||||
@@ -127,7 +127,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
}
|
||||
}
|
||||
|
||||
public class SelectionElement(Element element)
|
||||
public class ElementInfo(Element element)
|
||||
{
|
||||
public string CategoryName => element.Category?.Name;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
|
||||
@@ -12,6 +12,6 @@ public class InstanceCreatorCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<InstanceCreatorView>(new InstanceCreatorViewModel(UiDocument));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<InstanceCreatorView, InstanceCreatorViewModel>(UiDocument);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ using Autodesk.Revit.UI.Selection;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Extensions;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Extensions;
|
||||
|
||||
|
||||
// ReSharper disable ConditionIsAlwaysTrueOrFalse
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
{
|
||||
@@ -9,7 +9,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<ModelByCurveCreatorView>(new ModelByCurveCreatorViewModel(Document));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<ModelByCurveCreatorView, ModelByCurveCreatorViewModel>(Document);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ using Autodesk.Revit.UI.Selection;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
{
|
||||
@@ -20,13 +21,13 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
private readonly ActionEventHandler handler;
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[ObservableProperty]
|
||||
public partial double InstanceOffsetX { get; set; } = 0;
|
||||
|
||||
[ObservableProperty]
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Common.Attributes.IsNumeric]
|
||||
public partial double InstanceOffsetY { get; set; } = 0;
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -40,18 +41,18 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
public partial List<Material> Materials { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[ObservableProperty]
|
||||
public partial double OffsetX { get; set; } = 0;
|
||||
|
||||
[ObservableProperty]
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Common.Attributes.IsNumeric]
|
||||
public partial double OffsetY { get; set; } = 0;
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Attributes.Minimum(0.5)]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[Common.Attributes.Minimum(0.5)]
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial double Precision { get; set; } = 1.0;
|
||||
@@ -72,8 +73,8 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
public partial FamilySymbol SelectedProfileFamilyType { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[Attributes.IsNumeric]
|
||||
[Attributes.Minimum(100)]
|
||||
[Common.Attributes.IsNumeric]
|
||||
[Common.Attributes.Minimum(100)]
|
||||
[NotifyDataErrorInfo]
|
||||
[ObservableProperty]
|
||||
public partial double Spacing { get; set; } = 100;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
|
||||
@@ -9,6 +9,6 @@ public class PipesCreatorCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<PipesCreatorView>(new PipesCreatorViewModel(Document));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<PipesCreatorView, PipesCreatorViewModel>(Document);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ public partial class PipesCreatorViewModel : ObservableObject
|
||||
//var filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\问题管线.txt";
|
||||
//File.WriteAllText(filePath, sb.ToString());
|
||||
//WinDialogAssist.OpenFolderAndSelectFile(filePath);
|
||||
Assists.LogAssist.WriteTextFile("问题管线", sb.ToString());
|
||||
Common.Assists.LogAssist.WriteTextFile("问题管线", sb.ToString());
|
||||
}
|
||||
|
||||
//UiDocument.Selection.SetElementIds(ids);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
|
||||
@@ -9,6 +9,6 @@ public class FamilyLibraryCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<FamilyLibraryView>(new FamilyLibraryViewModel());
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<FamilyLibraryView, FamilyLibraryViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,10 @@
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
ui:ControlAssist.Icon="{ui:Icon SymbolValue=Folder}"
|
||||
Command="{Binding SelectPathCommand}"
|
||||
Content="打开族目录"
|
||||
FontFamily="{StaticResource BoxIcons}"
|
||||
ToolTip="{Binding FamilyPath, Mode=OneWay, StringFormat=族目录:{}{0}}">
|
||||
<ui:ControlAssist.Icon>
|
||||
<ui:IconElement FontFamily="{StaticResource BoxIcons}" Glyph="" />
|
||||
</ui:ControlAssist.Icon>
|
||||
</Button>
|
||||
ToolTip="{Binding FamilyPath, Mode=OneWay, StringFormat=族目录:{}{0}}" />
|
||||
<TreeView
|
||||
x:Name="FolderTreeView"
|
||||
Grid.Row="1"
|
||||
@@ -193,17 +189,17 @@
|
||||
</StackPanel.Style>
|
||||
<Button
|
||||
ui:ControlAssist.AppearanceType="Primary"
|
||||
ui:ControlAssist.Icon="{ui:Icon SymbolValue=ImportContacts}"
|
||||
Command="{Binding DataContext.ImportFamilyCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="载入"
|
||||
FontFamily="{StaticResource BoxIcons}"
|
||||
Content="载入"
|
||||
ToolTip="将族载入到当前项目" />
|
||||
<Button
|
||||
ui:ControlAssist.AppearanceType="Primary"
|
||||
ui:ControlAssist.Icon="{ui:Icon SymbolValue=LocationChip}"
|
||||
Command="{Binding DataContext.LocationFamilyFileCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="定位"
|
||||
FontFamily="{StaticResource BoxIcons}"
|
||||
ToolTip="在资源管理器中浏览文件" />
|
||||
<!--
|
||||
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}}"
|
||||
@@ -296,7 +292,7 @@
|
||||
ui:StackPanel.Fill="Auto"
|
||||
Command="{Binding ImportFamilySymbolCommand}"
|
||||
Content=""
|
||||
FontFamily="{StaticResource BoxIcons}"
|
||||
ui:ControlAssist.Icon="{ui:Icon SymbolValue=FrontLoader}"
|
||||
ToolTip="载入类型" />
|
||||
</ui:StackPanel>
|
||||
<TextBlock
|
||||
|
||||
@@ -7,8 +7,8 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using FuzzySharp;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using static ShrlAlgoToolkit.Revit.Assists.RevitFileAssist;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using static ShrlAlgoToolkit.RevitCore.Assists.RevitFileAssist;
|
||||
using Settings = ShrlAlgoToolkit.RevitAddins.Properties.Settings;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
@@ -308,14 +308,9 @@ public partial class FamilyLibraryViewModel : ObservableObject
|
||||
[RelayCommand]
|
||||
private static void LocationFamilyFile(object obj)
|
||||
{
|
||||
//System.Windows.Controls.Button btn = obj as System.Windows.Controls.Button;
|
||||
if (obj is FamilyModel familyInfo)
|
||||
{
|
||||
var proc = new System.Diagnostics.Process();
|
||||
proc.StartInfo.FileName = "explorer";
|
||||
//打开资源管理器
|
||||
proc.StartInfo.Arguments = "/select," + familyInfo.Path;
|
||||
proc.Start();
|
||||
Common.Assists.WinDialogAssist.OpenFolderAndSelectFile(familyInfo.Path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Windows.Media.Imaging;
|
||||
using Autodesk.Revit.DB;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
|
||||
@@ -12,7 +12,7 @@ public partial class FamilyModel : ObservableObject
|
||||
/// <summary>
|
||||
/// 族库缩略图
|
||||
/// </summary>
|
||||
public BitmapSource ImageData => Assists.ImageAssist.LoadFileImage(Path, 128, 128);
|
||||
public BitmapSource ImageData => Common.Assists.ImageAssist.LoadFileImage(Path, 128, 128);
|
||||
|
||||
/// <summary>
|
||||
/// 最近使用面板
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
|
||||
@@ -9,6 +9,6 @@ public class FamilyProcessorCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<FamilyProcessorView>(new FamilyProcessorViewModel(UiApplication));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<FamilyProcessorView, FamilyProcessorViewModel>(UiApplication);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using Autodesk.Revit.DB;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public partial class RenameFamilyItem : ObservableValidator
|
||||
public partial bool IsSelected { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[Attributes.UndefinedChar]
|
||||
[Common.Attributes.UndefinedChar]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial string NewFamilyName { get; set; }
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
x:Class="ShrlAlgoToolkit.RevitAddins.RvFamily.RenameFamilyView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvFamily"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mvvm="clr-namespace:ShrlAlgoToolkit.RevitAddins.Assists"
|
||||
xmlns:mvvm="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Assists"
|
||||
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
|
||||
xmlns:validationRules="clr-namespace:ShrlAlgoToolkit.Mvvm.ValidationRules"
|
||||
xmlns:validationRules="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.ValidationRules"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/WPFUI.xaml" />
|
||||
|
||||
@@ -9,7 +9,7 @@ public partial class RenameTypeItem : ObservableValidator
|
||||
public partial bool IsSelected { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[Attributes.UndefinedChar]
|
||||
[Common.Attributes.UndefinedChar]
|
||||
[NotifyDataErrorInfo]
|
||||
public partial string NewTypeName { get; set; }
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
x:Class="ShrlAlgoToolkit.RevitAddins.RvFamily.RenameTypeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:attach="clr-namespace:ShrlAlgoToolkit.RevitAddins.Assists"
|
||||
xmlns:attach="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Assists"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvFamily"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
|
||||
xmlns:validationRules="clr-namespace:ShrlAlgoToolkit.Mvvm.ValidationRules"
|
||||
xmlns:validationRules="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.ValidationRules"
|
||||
Title="重命名族类型"
|
||||
Width="900"
|
||||
Height="600"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
@@ -8,6 +8,6 @@ public class AddInsulationCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<AddInsulationView>(new AddInsulationViewModel(Document));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<AddInsulationView, AddInsulationViewModel>(Document);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
|
||||
@@ -9,14 +9,13 @@ public class AnyConnectCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<AnyConnectView>(new AnyConnectViewModel());
|
||||
#if REVIT2018
|
||||
//WinDialogAssist.ShowModeless<AnyConnectView>(new AnyConnectViewModel());
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<AnyConnectView, AnyConnectViewModel>();
|
||||
#elif REVIT2020
|
||||
//OptionsBarAssist.RegisterOptionsBar((AutoConnectOptionsView view, AnyConnectViewModel viewModel) =>
|
||||
//{
|
||||
// viewModel.ConnectCommand.Execute(null);
|
||||
//});
|
||||
OptionsBarAssist.RegisterOptionsBar((AutoConnectOptionsView view, AnyConnectViewModel viewModel) =>
|
||||
{
|
||||
viewModel.ConnectCommand.Execute(null);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
|
||||
@@ -9,6 +9,6 @@ internal class ArrangeMEPCurveCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<ArrangeMEPCurveView>(new ArrangeMEPCurveViewModel());
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<ArrangeMEPCurveView, ArrangeMEPCurveViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
x:Class="ShrlAlgoToolkit.RevitAddins.RvMEP.AutoConnectOptionsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters"
|
||||
xmlns:converters="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
|
||||
@@ -12,6 +12,6 @@ public class ClashReportCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<ClashReportView>(new ClashReportViewModel(UiApplication));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<ClashReportView, ClashReportViewModel>(UiApplication);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
|
||||
@@ -11,7 +11,7 @@ public class ClashResolveCmd : ExternalCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
WinDialogAssist.ShowModeless<ClashResolveView>(new ClashResolveViewModel());
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<ClashResolveView, ClashResolveViewModel>();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using Autodesk.Revit.UI.Selection;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Autodesk.Revit.DB.Mechanical;
|
||||
using Autodesk.Revit.DB.Plumbing;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Windows;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
@@ -114,12 +114,12 @@ public class HeadroomCheckCmd : ExternalCommand
|
||||
viewmodel.Footer = $"最低净高={Math.Round(minHeadroom * 304.8)}mm,元素:{element.Name},Id:{element.Id}";
|
||||
UiDocument.Selection.SetElementIds(new List<ElementId> { element.Id });
|
||||
}
|
||||
WinDialogAssist.ShowModeless<MessageWin>(viewmodel);
|
||||
Common.Assists.WinDialogAssist.ShowModeless<MessageWin>(viewmodel);
|
||||
}
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<HeadroomCheckView>(new HeadroomCheckViewModel(UiApplication));
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<HeadroomCheckView, HeadroomCheckViewModel>(UiApplication);
|
||||
//try
|
||||
//{
|
||||
// InputMessageBox inputMessage = new("净高限制", "请输出净高要求高度(mm)");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -6,7 +6,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
public partial class InsulationItem : ObservableValidator
|
||||
{
|
||||
[Attributes.GreaterThan(nameof(MinDiameter))]
|
||||
[Common.Attributes.GreaterThan(nameof(MinDiameter))]
|
||||
[Range(15, 1000)]
|
||||
public double MaxDiameter
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
|
||||
@@ -12,6 +12,6 @@ public class MoveMEPCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
WinDialogAssist.ShowModeless<MoveMEPCurveView>(new MoveMEPCurveViewModel());
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<MoveMEPCurveView, MoveMEPCurveViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user