2025-04-24 20:56:44 +08:00
|
|
|
|
using Autodesk.Revit.DB;
|
|
|
|
|
|
|
|
|
|
|
|
using ShrlAlgoToolkit.Revit.Extensions;
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
2024-09-22 11:05:41 +08:00
|
|
|
|
using System.Windows.Interop;
|
|
|
|
|
|
|
2025-04-24 20:56:44 +08:00
|
|
|
|
namespace ShrlAlgoToolkit.Revit.Extensions
|
2024-09-22 11:05:41 +08:00
|
|
|
|
{
|
2025-04-24 20:56:44 +08:00
|
|
|
|
public static class ApplicationExtensions
|
2024-09-22 11:05:41 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 显示窗口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="window"></param>
|
|
|
|
|
|
/// <param name="handle"></param>
|
|
|
|
|
|
public static void Show(this Window window, IntPtr handle)
|
|
|
|
|
|
{
|
|
|
|
|
|
// ReSharper disable once ObjectCreationAsStatement
|
|
|
|
|
|
_ = new WindowInteropHelper(window) { Owner = handle };
|
|
|
|
|
|
window.Show();
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 新建族文档
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
|
/// <param name="templateFileName">族样板文件名,不含扩展</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static Document NewFamilyDocument(this Autodesk.Revit.ApplicationServices.Application app, string templateFileName)
|
|
|
|
|
|
{
|
|
|
|
|
|
return app.NewFamilyDocument($"{app.FamilyTemplatePath}\\{templateFileName}.rft");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|