Model,Sketch,View,Group,Annotation,Information
模型,草图,视图,组,注释,信息
Model包括Wall,Duct,FamilyInstance之类。
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WinForm = System.Windows.Forms;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB.Structure;
using System.Xml;
namespace RevitCodes
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdCategory : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Transaction ts = new Transaction(uiDoc.Document, " delete " );
ts.Start();
Settings docSettings = uiDoc.Document.Settings;
Categories groups = docSettings.Categories;
string prompt = " 当前文档类别数量: " + groups.Size;
Category floorCate = groups.get_Item(BuiltInCategory.OST_Floors);
prompt += floorCate.Name;
WinForm.MessageBox.Show(prompt, " Revit " , WinForm.MessageBoxButtons.OK);
ts.Commit();
return Result.Succeeded;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WinForm = System.Windows.Forms;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB.Structure;
using System.Xml;
namespace RevitCodes
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdCategory : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Transaction ts = new Transaction(uiDoc.Document, " delete " );
ts.Start();
Settings docSettings = uiDoc.Document.Settings;
Categories groups = docSettings.Categories;
string prompt = " 当前文档类别数量: " + groups.Size;
Category floorCate = groups.get_Item(BuiltInCategory.OST_Floors);
prompt += floorCate.Name;
WinForm.MessageBox.Show(prompt, " Revit " , WinForm.MessageBoxButtons.OK);
ts.Commit();
return Result.Succeeded;
}
}
}