次の要素フィルタがあります。
実際の 3D ジオメトリがターゲット オブジェクトの 3D ジオメトリと交差する要素を渡します。
ElementIntersectsElementFilter を使用すると、ターゲット オブジェクトは別の要素になります。交差は Revit が使用するのと同じロジックによって決定され、干渉レポートの生成中に交差が存在するかどうかを判断します(これは、交差で自動的に結合されるコンクリート部材など、一部の要素の組み合わせはこのフィルタを通過しないことを意味します)。また、鉄筋などのソリッド ジオメトリが含まれていない要素もこのフィルタを通過しません。
ElementIntersectsSolidFilter を使用すると、ターゲット オブジェクトは任意のソリッドになります。このソリッドは、GeometryCreationUtilities のルーチンを使用したり、ブール演算などの 2 次処理の結果として、既存の要素から取得したり、最初から作成することができました。ElementIntersectsElementFilter と同様に、このフィルタはソリッド ジオメトリを持たない要素を通しません。
両方のフィルタは、ターゲット オブジェクトの体積の外側にある要素に一致するように反転することができます。
両方のフィルタは低速フィルタであるため、1 つまたは複数のクイック フィルタ(クラスやカテゴリ フィルタなど)との組み合わせに適しています。
コード領域: ドアの無効な出口をブロックしている要素に一致させるための ElementIntersectsSolidFilter を使用 |
/// <summary> /// Finds any Revit physical elements which interfere with the target /// solid region surrounding a door.</summary> /// <remarks>This routine is useful for detecting interferences which are /// violations of the Americans with Disabilities Act or other local disabled /// access codes.</remarks> /// <param name="doorInstance">The door instance.</param> /// <param name="doorAccessibilityRegion">The accessibility region calculated /// to surround the approach of the door. /// Because the geometric parameters of this region are code- and /// door-specific, calculation of the geometry of the region is not /// demonstrated in this example.</param> /// <returns>A collection of interfering element ids.</returns> private ICollection<ElementId> FindElementsInterferingWithDoor(FamilyInstance doorInstance, Solid doorAccessibilityRegion) { // Setup the filtered element collector for all document elements. FilteredElementCollector interferingCollector = new FilteredElementCollector(doorInstance.Document); // Only accept element instances interferingCollector.WhereElementIsNotElementType(); // Exclude intersections with the door itself or the host wall for the door. List<ElementId> excludedElements = new List<ElementId>(); excludedElements.Add(doorInstance.Id); excludedElements.Add(doorInstance.Host.Id); ExclusionFilter exclusionFilter = new ExclusionFilter(excludedElements); interferingCollector.WherePasses(exclusionFilter); // Set up a filter which matches elements whose solid geometry intersects // with the accessibility region ElementIntersectsSolidFilter intersectionFilter = new ElementIntersectsSolidFilter(doorAccessibilityRegion); interferingCollector.WherePasses(intersectionFilter); // Return all elements passing the collector return interferingCollector.ToElementIds(); } |