整理
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace RevitAddin.Revit.Commands;
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class Command : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
|
||||
{
|
||||
var doc = commandData.Application.ActiveUIDocument.Document;
|
||||
if (doc.IsFamilyDocument)
|
||||
{
|
||||
using (Transaction ts = new Transaction(doc, "删除空类型"))
|
||||
{
|
||||
ts.Start();
|
||||
var manager = doc.FamilyManager;
|
||||
foreach (FamilyType type in manager.Types)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(type.Name))
|
||||
{
|
||||
manager.CurrentType= type;
|
||||
doc.Regenerate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
manager.DeleteCurrentType();
|
||||
ts.Commit();
|
||||
}
|
||||
}
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user