﻿ Patch Class—ArcGIS Pro
ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / Patch Class
Members Example

In This Topic
Patch Class
In This Topic
A class to create a patch for a Multipatch. Use MultipatchBuilderEx to construct a Multipatch from patches.
Object Model
Syntax
`public sealed class Patch `
`Public NotInheritable Class Patch `
Remarks

Each part in a multipatch is called a patch. A patch can be a triangle strip, triangle fan, a group of triangles, or a ring. If the patch is a ring, it can be either the first ring of a polygon or another ring in the same polygon. The first ring means that it was the first ring created for the polygon when the multipatch was constructed. It doesn't necessarily mean that it is an outer ring and subsequent rings in the polygon are inner rings. The orientation of the ring determines if it is an outer or inner ring. An outer ring is oriented clockwise.

A triangle strip is a continuous linked strip of 3-dimensional triangles such that every vertex after the first two completes a new triangle. A new triangle is always formed by connecting the new vertex with its two immediate predecessors. For example, a triangle strip with six points has triangles defined by the point indices (0, 1, 2), (2, 1, 3), (2, 3, 4), (4, 3, 5).

A triangle fan is a continuous fan of 3-dimensional triangles such that the first point defines the origin. All triangles in the fan share the origin as a common pivot point. Every vertex after the first two completes a triangle, and a new triangle is formed by connecting the new vertex to its immediate predecessor and the origin. For example, a triangle fan with six points has triangles defined by point indices (0, 1, 2), (0, 2, 3), (0, 3, 4), (0, 4, 5).

A ring is a geometric element from which polygons are constructed, defined by an area bounded by one closed sequence of connected segments. If the type of a patch is PatchType.FirstRing, then it was the first ring created when constructing the polygon. If the type of the patch is PatchType.Ring, then it is part of the same polygon as the previous patch.

Triangles is a collection of 3-dimensional triangles such that each consecutive triplet of vertices defines a new triangle. The number of vertices in patch of type PatchType.Triangles must be multiple of three. For example, a patch of type PatchType.Triangles with nine points has triangles defined by point indices (0, 1, 2), (3, 4, 5), (6, 7, 8).

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 patches = 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;

patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face2;

patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face3;

patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face4;

patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face5;

patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face6;

patches[0].Material = materialRed;
patches[1].Material = materialTransparent;
patches[2].Material = materialRed;
patches[3].Material = materialRed;
patches[4].Material = materialRed;
patches[5].Material = blueTransparent;

// assign the patches to the multipatchBuilder
mpb.Patches = patches;

// 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;
```
Inheritance Hierarchy

System.Object
ArcGIS.Core.Geometry.Patch

Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.