using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace _3_1通过ID获取元素
{
[Transaction(TransactionMode.Manual)]
public class Class1 : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
Document doc = commandData.Application.ActiveUIDocument.Document;
ElementId levelId = new ElementId(30);
Element element = doc.GetElement(levelId);
Level level = element as Level;
if (level!=null)
{
//使用Level
}
return Result.Succeeded;
}
}
}