Revit二次开发之“遍历标高Level”
遍历当前文档中的所有标高。以便根据标高过滤同一标高下的元素。
from:http://revit.5d6d.com/thread-1203-1-1.html
//遍历标高
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
//[Journaling(JournalingMode.NoCommandData)]
public class cmdGetLevel : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Selection selection = uiDoc.Selection;
Transaction ts = new Transaction(uiDoc.Document, "level");
ts.Start();
FilteredElementCollector collector = new FilteredElementCollector(uiDoc.Document);
ICollection<Element> collection = collector.OfClass(typeof(Level)).ToElements();
foreach (Element e in collection)
{
TaskDialog.Show("标高", e.Name);
}
ts.Commit();
return Result.Succeeded;
}
}
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
//[Journaling(JournalingMode.NoCommandData)]
public class cmdGetLevel : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Selection selection = uiDoc.Selection;
Transaction ts = new Transaction(uiDoc.Document, "level");
ts.Start();
FilteredElementCollector collector = new FilteredElementCollector(uiDoc.Document);
ICollection<Element> collection = collector.OfClass(typeof(Level)).ToElements();
foreach (Element e in collection)
{
TaskDialog.Show("标高", e.Name);
}
ts.Commit();
return Result.Succeeded;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。

浙公网安备 33010602011771号