0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Revit】選択されていない要素IDの取得方法

Last updated at Posted at 2018-10-29

Autodesk Revitにて選択されていない要素情報を取得する方法例です。
備忘録的なモノなので動作は保証しませんがヒントになれば幸いです。

/// <summary>
/// 要素IDコレクションを取得する
/// <param name="revit">ExternalCommandData</param>
/// <return>要素IDコレクション</return>
/// </summary>
private ICollection<ElementId> GetElementIds(ExternalCommandData revit)
{
    UIApplication uiapp = revit.Application;
    UIDocument uidoc = uiapp.ActiveUIDocument;
    Application app = uiapp.Application;
    Document doc = uidoc.Document;

    // フィルターセット(例では解析モデル床でフィルタリング)
    ElementCategoryFilter filter = new ElementCategoryFilter(BuiltInCategory.OST_FloorAnalytical);
    FilteredElementCollector collector = new FilteredElementCollector(doc);
    elementIds = collector.WherePasses(filter).WhereElementIsNotElementType().ToElementIds();

    // 要素IDを取得する
    return elementIds;
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?