ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / Multipatch Class / IsMaterialTextured Method
The index of the material. Must be greater than or equal to zero and less than MaterialCount. Get the index for a patch by calling GetPatchMaterialIndex.
Example

In This Topic
    IsMaterialTextured Method
    In This Topic
    Gets a value indicating if the specified material contains a texture image.
    Syntax
    public bool IsMaterialTextured( 
       int materialIndex
    )
    Public Function IsMaterialTextured( _
       ByVal materialIndex As Integer _
    ) As Boolean

    Parameters

    materialIndex
    The index of the material. Must be greater than or equal to zero and less than MaterialCount. Get the index for a patch by calling GetPatchMaterialIndex.
    Exceptions
    ExceptionDescription
    The material index must be >= 0.
    The material index must be less than the number of materials in the multipatch.
    Example
    Get the texture image of a multipatch
    // <summary>
    // This method gets the material texture image of a multipatch.
    // This method must be called on the MCT. Use QueuedTask.Run.
    // </summary>
    // <param name="multipatch">The input multipatch.</param>
    // <param name="patchIndex">The index of the patch (part) for which to get the material texture.</param>
    public void GetMultipatchTextureImage(Multipatch multipatch, int patchIndex)
    {
      int materialIndex = multipatch.GetPatchMaterialIndex(patchIndex);
      if (!multipatch.IsMaterialTextured(materialIndex))
        return;
    
      TextureCompressionType compressionType = 
        multipatch.GetMaterialTextureCompressionType(materialIndex);
    
      string ext = compressionType == TextureCompressionType.CompressionJPEG ? ".jpg" : ".dat";
      byte[] textureBuffer = multipatch.GetMaterialTexture(materialIndex);
    
      Stream imageStream = new MemoryStream(textureBuffer);
      System.Drawing.Image image = System.Drawing.Image.FromStream(imageStream);
      image.Save(@"C:\temp\myImage" + ext);
    }
    
    Get the material properties of a multipatch
    /// <summary>
    /// This method gets several properties of a material in a multipatch.
    /// This method must be called on the MCT. Use QueuedTask.Run.
    /// </summary>
    /// <param name="multipatch">The input multipatch.</param>
    /// <param name="patchIndex">The index of the patch (part) from which to get the material properties.</param>
    public void GetMaterialProperties(Multipatch multipatch, int patchIndex)
    {
      if (multipatch.HasMaterials)
      {
        // Get the material index for the specified patch.
        int materialIndex = multipatch.GetPatchMaterialIndex(patchIndex);
    
        System.Windows.Media.Color color = multipatch.GetMaterialColor(materialIndex);
        int tranparencyPercent = multipatch.GetMaterialTransparencyPercent(materialIndex);
        bool isBackCulled = multipatch.IsMaterialCullBackFace(materialIndex);
    
        if (multipatch.IsMaterialTextured(materialIndex))
        {
          int bpp = multipatch.GetMaterialTextureBytesPerPixel(materialIndex);
          int columnCount = multipatch.GetMaterialTextureColumnCount(materialIndex);
          int rowCount = multipatch.GetMaterialTextureRowCount(materialIndex);
        }
      }
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also