ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureSceneLayer Class / Select Method
A query filter or spatial filter
A combination method.
Example

In This Topic
    Select Method (FeatureSceneLayer)
    In This Topic
    Selects features based upon the specified attribute and/or spatial criteria and combination method. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    No associated feature service
    Remarks
    The selection occurs regardless of the layer's IsSelectable state. IsSelectable applies only when interactively selecting features off a map view.

    Select can only be used on feature scene layers that have an associated feature service. Check HasAssociatedFeatureService property to determine if the FeatureSceneLayer has an associated feature service. Calling Select() on a FeatureSceneLayer with no associated feature service will throw a System.InvalidOperationException
    Selected features will be highlighted on the map and on the table view
    Select() also honors any existing definition query.
    Callers should explicitly dispose of the returned ArcGIS.Core.Data.Selection.

    Example
    Hide Selected features and Show Hidden features
    {
      if (featSceneLayer.HasAssociatedFeatureService)
      {
        return;//Search and Select not supported
      }
    
      await QueuedTask.Run(() =>
      {
        QueryFilter qf = new QueryFilter()
        {
          ObjectIDs = new List<long>() { 6069, 6070, 6071 },
          SubFields = "*"
        };
        featSceneLayer.Select(qf, SelectionCombinationMethod.New);
    
        featSceneLayer.HideSelectedFeatures();
        var selectionCount = featSceneLayer.SelectionCount;
    
        featSceneLayer.ShowHiddenFeatures();
        selectionCount = featSceneLayer.SelectionCount;
      });
    }
    Use Select or Search with a Spatial Query
    {
      var mapView = MapView.Active;
      if (mapView == null)
        return;
    
      await QueuedTask.Run(() =>
      {
        if (!featSceneLayer.HasAssociatedFeatureService)
        {
          return;//no search or select
        }
    
        //Select all features within the current map view
        var sz = mapView.GetViewSize();
        var map_pt1 = mapView.ClientToMap(new System.Windows.Point(0, sz.Height));
        var map_pt2 = mapView.ClientToMap(new System.Windows.Point(sz.Width, 0));
    
        //Convert to an envelope
        var temp_env = EnvelopeBuilderEx.CreateEnvelope(map_pt1, map_pt2, mapView.Map.SpatialReference);
    
        //Project if needed to the layer spatial ref
        SpatialReference sr = null;
        using (var fc = featSceneLayer.GetFeatureClass())
        using (var fdef = fc.GetDefinition())
        {
          sr = fdef.GetSpatialReference();
        }
    
        var env = GeometryEngine.Instance.Project(temp_env, sr) as Envelope;
    
        //Set up a query filter
        var sf = new SpatialQueryFilter()
        {
          FilterGeometry = env,
          SpatialRelationship = SpatialRelationship.Intersects,
          SubFields = "*"
        };
    
        //Select against the feature service
        var select = featSceneLayer.Select(sf);
        if (select.GetCount() > 0)
        {
          //enumerate over the selected features
          using (var rc = select.Search())
          {
            while (rc.MoveNext())
            {
              using (var feature = rc.Current as Feature)
              {
                oid = feature.GetObjectID();
                //etc.
              }
            }
          }
        }
        mapView.Map.ClearSelection();
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also