ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / KnowledgeGraphLayerIDSet Class / FromSelectionSet Method
A SelectionSet.
Example Version

FromSelectionSet Method
Creates a KnowledgeGraphLayerIDSet from a selection set. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public static KnowledgeGraphLayerIDSet FromSelectionSet( 
   SelectionSet selection
)

Parameters

selection
A SelectionSet.

Return Value

A KnowledgeGraphLayerIDSet. If no items in the selection are relevant to a knowledge graph, then null is returned.
Exceptions
ExceptionDescription
The selection set is null
This method or property must be called within the lambda passed to QueuedTask.Run.
Example
Create an ID set from a SelectionSet
QueuedTask.Run(() =>
{
  // get the selection set
  var sSet = map.GetSelection();

  // translate to an KnowledgeGraphLayerIDSet
  //  if the selectionset does not contain any KG entity or relationship records
  //    then idSet will be null  
  var idSet = KnowledgeGraphLayerIDSet.FromSelectionSet(sSet);
  if (idSet == null)
    return;


  // you can use the idSet to create a new linkChart
  //   (using MapFactory.Instance.CreateLinkChart)
});
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.3 or higher.
See Also