© 2010 Autodesk
Introduction to Revit 2011 API
ユーザ選択
 選択フィルタ
§
§選択時に ISelection インタフェースでオブジェクトをフィルタ
§AllowElement メソッド  (要素のフィルタ)
§AllowReference メソッド (ジオメトリオブジェクトのフィルタ)
§
§
§
§
public void SelectPlanarFaces(Autodesk.Revit.DB.Document document)
{
UIDocument uidoc = new UIDocument(document);
ISelectionFilter selFilter = new PlanarFacesSelectionFilter();
IList<Reference> faces = uidoc.Selection.PickObjects(ObjectType.Face, selFilter, "Select multiple planar faces");
}
public class PlanarFacesSelectionFilter : ISelectionFilter
{
        public bool AllowElement(Element element)
        {
         return true;
        }
        public bool AllowReference(Reference refer, XYZ point)
        {
          if (refer.GeometryObject is PlanarFace)  { return true;   }
return false;
         }
}
ISelectionFilter インタフェースを実装することで選択時のフィルタの振る舞い制御することができます。ISelectionFilterのAllowElementメソッドは要素をフィルタし、AllowReference()はジオメトリオブジェクトをフィルタします。

このサンプルコードではすべての要素を選択可能とし、ジオメトリは平面のみ選択します。