ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipatchBuilderEx Class / QueryPatchIndicesWithMaterial Method
Material instance to check. If null, the method will collect indices of all patches that have null material.
Example

In This Topic
    QueryPatchIndicesWithMaterial Method
    In This Topic
    Returns an array of patch indices that reference the given Material instance.
    Syntax
    Public Function QueryPatchIndicesWithMaterial( _
       ByVal material As Material _
    ) As Integer()
    public int[] QueryPatchIndicesWithMaterial( 
       Material material
    )

    Parameters

    material
    Material instance to check. If null, the method will collect indices of all patches that have null material.

    Return Value

    Returns an array of patch indices. The array is empty if no patches reference the given material instance.
    Example
    Construct Multipatch via MultipatchBuilderEx
    {
      var coords_face1 = new List<Coordinate3D>()
    {
      new Coordinate3D(12.495461061000071,41.902603910000039,62.552700000000186),
      new Coordinate3D(12.495461061000071,41.902603910000039,59.504700000004959),
      new Coordinate3D(12.495461061000071,41.902576344000067,59.504700000004959),
      new Coordinate3D(12.495461061000071,41.902603910000039,62.552700000000186),
      new Coordinate3D(12.495461061000071,41.902576344000067,59.504700000004959),
      new Coordinate3D(12.495461061000071,41.902576344000067,62.552700000000186),
    };
    
      var coords_face2 = new List<Coordinate3D>()
    {
      new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),
      new Coordinate3D(12.495461061000071, 41.902576344000067, 59.504700000004959),
      new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),
      new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),
      new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),
      new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),
    };
    
      var coords_face3 = new List<Coordinate3D>()
    {
      new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),
      new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),
      new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),
      new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),
      new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),
      new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),
    };
    
      var coords_face4 = new List<Coordinate3D>()
    {
      new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),
      new Coordinate3D(12.495461061000071, 41.902576344000067, 59.504700000004959),
      new Coordinate3D(12.495461061000071, 41.902603910000039, 59.504700000004959),
      new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),
      new Coordinate3D(12.495461061000071, 41.902603910000039, 59.504700000004959),
      new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),
    };
    
      var coords_face5 = new List<Coordinate3D>()
    {
      new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),
      new Coordinate3D(12.495461061000071, 41.902603910000039, 59.504700000004959),
      new Coordinate3D(12.495461061000071, 41.902603910000039, 62.552700000000186),
      new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),
      new Coordinate3D(12.495461061000071, 41.902603910000039, 62.552700000000186),
      new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),
    };
    
      var coords_face6 = new List<Coordinate3D>()
    {
      new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),
      new Coordinate3D(12.495461061000071, 41.902603910000039, 62.552700000000186),
      new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),
      new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),
      new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),
      new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),
    };
    
      // materials
      var materialRed = new BasicMaterial();
      materialRed.Color = System.Windows.Media.Colors.Red;
    
      var materialTransparent = new BasicMaterial();
      materialTransparent.Color = System.Windows.Media.Colors.White;
      materialTransparent.TransparencyPercent = 80;
    
      var blueTransparent = new BasicMaterial(materialTransparent);
      blueTransparent.Color = System.Windows.Media.Colors.SkyBlue;
    
      // create a list of patch objects
      var patchesList = new List<Patch>();
    
      // create the multipatchBuilderEx object
      var mpb = new ArcGIS.Core.Geometry.MultipatchBuilderEx();
    
      // make each patch using the appropriate coordinates and add to the patch list
      var patch = mpb.MakePatch(PatchType.Triangles);
      patch.Coords = coords_face1;
      patchesList.Add(patch);
    
      patch = mpb.MakePatch(PatchType.Triangles);
      patch.Coords = coords_face2;
      patchesList.Add(patch);
    
      patch = mpb.MakePatch(PatchType.Triangles);
      patch.Coords = coords_face3;
      patchesList.Add(patch);
    
      patch = mpb.MakePatch(PatchType.Triangles);
      patch.Coords = coords_face4;
      patchesList.Add(patch);
    
      patch = mpb.MakePatch(PatchType.Triangles);
      patch.Coords = coords_face5;
      patchesList.Add(patch);
    
      patch = mpb.MakePatch(PatchType.Triangles);
      patch.Coords = coords_face6;
      patchesList.Add(patch);
    
      patchesList[0].Material = materialRed;
      patchesList[1].Material = materialTransparent;
      patchesList[2].Material = materialRed;
      patchesList[3].Material = materialRed;
      patchesList[4].Material = materialRed;
      patchesList[5].Material = blueTransparent;
    
      // assign the patches to the multipatchBuilder
      mpb.Patches = patchesList;
    
      // check which patches currently contain the material
      var red = mpb.QueryPatchIndicesWithMaterial(materialRed);
      //   red should be [0, 2, 3, 4]
      // call ToGeometry to get the multipatch
      multipatch = mpb.ToGeometry() as Multipatch;
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also