
# IPCB_ClearanceConstraint interface

A clearance rule (`TRuleKind.eRule_Clearance`) that defines the minimum clearance between any two objects on the copper layers.

```csharp
public interface IPCB_ClearanceConstraint : IPCB_Rule
```

**Namespace:** PCB · **Assembly:** Altium.SDK.Interfaces

**Inherits:** [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md) → [IPCB_Rule](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md)

## Remarks

The rule has one clearance for all pairs of object kinds (`Gap`) and can have a clearance of its own for individual pairs of object kinds, such as arcs and tracks (`Clearance`, [`Clearance_1`](#clearance_1)). `Mode` tells whether any pair has a clearance of its own. A new rule has a gap of 10 mil.

[`PrimitivesViolate`](#primitivesviolate) checks whether two objects violate the rule.

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [Clearance](#clearance) | `int` | get; set | The clearance that the rule requires between two objects, in internal units (10,000 per mil). |
| [Clearance_1](#clearance_1) | `int` | get; set | The clearance that the rule requires between two kinds of objects, in internal units (10,000 per mil). |
| [Gap](#gap) | `int` | get; set | The clearance that the rule requires between pairs of object kinds that have no clearance of their own, in internal units (10,000 per mil). |
| [Mode](#mode) | [TClearanceConstraintMode](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TClearanceConstraintMode.md) | get | Whether the rule has one clearance for all pairs of object kinds or clearances of their own for individual pairs. |

### Clearance

The clearance that the rule requires between two objects, in internal units (10,000 per mil).

```csharp
int GetClearance(IPCB_Primitive argP1, IPCB_Primitive argP2);
void SetClearance(IPCB_Primitive argP1, IPCB_Primitive argP2, int argValue);
```

**Type:** `int` · **Access:** read/write · **Index:** `argP1` ([IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md)): The first object., `argP2` ([IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md)): The second object.

The accessors are extension methods of `IPCB_ClearanceConstraintHelper` (`using PCB;`).

The kinds of the two objects select the clearance, as in [`Clearance_1`](#clearance_1): arcs, tracks, pads (through-hole pads on the multi-layer, surface-mount pads on other layers), vias, fills, polygons, regions and text. When reading, a track, arc or region that is part of a polygon uses the clearance of polygons. Reading returns `Gap` for an object of another kind, and 0 when an argument is null. Assigning does nothing when an argument is null or an object of another kind.

### Clearance_1

The clearance that the rule requires between two kinds of objects, in internal units (10,000 per mil).

```csharp
int GetClearance_1(TObjectClearanceId argP1, TObjectClearanceId argP2);
void SetClearance_1(TObjectClearanceId argObj1, TObjectClearanceId argObj2, int argValue);
```

**Type:** `int` · **Access:** read/write · **Index:** `argP1` ([TObjectClearanceId](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TObjectClearanceId.md)): The first object kind., `argP2` ([TObjectClearanceId](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TObjectClearanceId.md)): The second object kind.

The accessors are extension methods of `IPCB_ClearanceConstraintHelper` (`using PCB;`).

The order of the two kinds does not matter. Reading a pair that has no clearance of its own returns `Gap`; assigning the value of `Gap` to a pair removes its own clearance. Each assignment can also change `Gap`: the clearance shared by the largest number of pairs of object kinds becomes the gap.

### Gap

The clearance that the rule requires between pairs of object kinds that have no clearance of their own, in internal units (10,000 per mil).

```csharp
int GetState_Gap();
void SetState_Gap(int argValue);
```

**Type:** `int` · **Access:** read/write

A new rule has 10 mil. Assigning a gap removes the clearances of individual pairs of object kinds (`Clearance`, [`Clearance_1`](#clearance_1)), so that the new gap applies to every pair.

### Mode

Whether the rule has one clearance for all pairs of object kinds or clearances of their own for individual pairs.

```csharp
TClearanceConstraintMode GetState_Mode();
```

**Type:** [TClearanceConstraintMode](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TClearanceConstraintMode.md) · **Access:** read-only

The accessors are extension methods of `IPCB_ClearanceConstraintHelper` (`using PCB;`).

It is `TClearanceConstraintMode.eClearanceConstraintMode_ObjectsClearance` while at least one pair of object kinds has a clearance that differs from `Gap`, and `TClearanceConstraintMode.eClearanceConstraintMode_SingleClearance` otherwise. Assigning `Gap` makes it `TClearanceConstraintMode.eClearanceConstraintMode_SingleClearance`.

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [PrimitivesViolate](#primitivesviolate) | `bool` | Returns whether two objects violate the rule, that is, they are closer together than the clearance that the rule requires for them. |

### PrimitivesViolate

Returns whether two objects violate the rule, that is, they are closer together than the clearance that the rule requires for them.

```csharp
bool PrimitivesViolate(IPCB_Primitive argP1, IPCB_Primitive argP2);
bool PrimitivesViolate(object argP1, object argP2);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argP1` | [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md) | value | The first object. |
| `argP2` | [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md) | value | The second object. |

**Returns:** `bool`

The first overload is an extension method of `IPCB_ClearanceConstraintHelper` (`using PCB;`) with typed parameters; the second is declared by the interface.

Returns false when both arguments are the same object, when an object is not on a signal layer, an internal plane layer, the multi-layer or the keep-out layer, when the objects have no layer in common, or when they do not have the net relationship that [`NetScope`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#netscope) requires; keepout objects are checked whatever their nets. A clearance of 0 is not checked. When an object has a hole, the hole is also checked against the other object, with the clearance between `TObjectClearanceId.eObjectClearanceID_Hole` and the kind of the other object.

## Inherited members

- From [IPCB_Rule](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md): [ActualCheck](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#actualcheck), [ActualCheck_1](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#actualcheck_1), [CheckBinaryScope](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#checkbinaryscope), [CheckUnaryScope](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#checkunaryscope), [CollisionExpansion](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#collisionexpansion), [Comment](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#comment), [DataSummaryString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#datasummarystring), [DefinedByLogicalDocument](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#definedbylogicaldocument), [DRCEnabled](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#drcenabled), [Export_ToParameters_1](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#export_toparameters_1), [GetWhatsThisHelpString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#getwhatsthishelpstring), [IsUnary](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#isunary), [LayerKind](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#layerkind), [Name](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#name), [NetScope](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#netscope), [NetScopeMatches](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#netscopematches), [Priority](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#priority), [RuleKind](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#rulekind), [Scope1Expression](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#scope1expression), [Scope1Includes](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#scope1includes), [Scope2Expression](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#scope2expression), [Scope2Includes](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#scope2includes), [ScopeDescriptorString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#scopedescriptorstring), [ScopeKindIsValid](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#scopekindisvalid), [ShortDescriptorString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#shortdescriptorstring), [ViolationDescriptorString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Rule.md#violationdescriptorstring)
- From [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md): [AllowGlobalEdit](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#allowglobaledit), [BeginModify](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#beginmodify), [Board](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#board), [BoundingRectangle](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectangle), [BoundingRectangleChildren](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectanglechildren), [BoundingRectangleForPainting](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectangleforpainting), [BoundingRectangleForSelection](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectangleforselection), [CancelModify](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#cancelmodify), [Component](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#component), [Coordinate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#coordinate), [DescriptorString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#descriptorstring), [DetailString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#detailstring), [Dimension](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#dimension), [DrawAsPreview](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#drawaspreview), [DRCError](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#drcerror), [Enabled](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled), [Enabled_Direct](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_direct), [Enabled_vComponent](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vcomponent), [Enabled_vCoordinate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vcoordinate), [Enabled_vDimension](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vdimension), [Enabled_vNet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vnet), [Enabled_vPolygon](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vpolygon), [EnableDraw](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabledraw), [EndModify](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#endmodify), [Export_ToParameters](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#export_toparameters), [FlipXY](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#flipxy), [GraphicallyInvalidate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#graphicallyinvalidate), [Handle](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#handle), [Identifier](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#identifier), [InBoard](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#inboard), [InComponent](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#incomponent), [InCoordinate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#incoordinate), [Index](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#index), [InDimension](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#indimension), [InNet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#innet), [InPolygon](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#inpolygon), [InSelectionMemory](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#inselectionmemory), [IsAssyTestPoint_Bottom](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#isassytestpoint_bottom), [IsAssyTestPoint_Top](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#isassytestpoint_top), [IsElectricalPrim](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#iselectricalprim), [IsFreePrimitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#isfreeprimitive), [IsHidden](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#ishidden), [IsKeepout](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#iskeepout), [IsPreRoute](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#ispreroute), [IsSaveable](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#issaveable), [IsTenting](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istenting), [IsTenting_Bottom](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istenting_bottom), [IsTenting_Top](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istenting_top), [IsTestPoint_Bottom](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istestpoint_bottom), [IsTestPoint_Top](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istestpoint_top), [Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#layer), [MiscFlag1](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#miscflag1), [MiscFlag2](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#miscflag2), [MiscFlag3](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#miscflag3), [Moveable](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#moveable), [MoveByXY](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#movebyxy), [MoveToXY](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#movetoxy), [Net](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#net), [ObjectID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#objectid), [ObjectIDString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#objectidstring), [PadCacheRobotFlag](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#padcacherobotflag), [PasteMaskExpansion](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#pastemaskexpansion), [Polygon](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#polygon), [PolygonOutline](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#polygonoutline), [PowerPlaneClearance](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#powerplaneclearance), [PowerPlaneConnectStyle](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#powerplaneconnectstyle), [PowerPlaneReliefExpansion](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#powerplanereliefexpansion), [Preview](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#preview), [ReliefAirGap](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#reliefairgap), [ReliefConductorWidth](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#reliefconductorwidth), [ReliefEntries](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#reliefentries), [Replicate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#replicate), [RequiredParamterSpace](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#requiredparamterspace), [RotateBy](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#rotateby), [Selected](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#selected), [SolderMaskExpansion](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#soldermaskexpansion), [SwapLayerPairs](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#swaplayerpairs), [TearDrop](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#teardrop), [UnionIndex](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#unionindex), [UniqueId](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#uniqueid), [UniqueID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#uniqueid-1), [Used](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#used), [UserRouted](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#userrouted), [V7Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#v7layer), [ViewableObjectID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#viewableobjectid)
