Skip to main content
View as Markdown

IPCB_Violation interface

A design rule violation on a PCB document, the rule that is broken and the object, or pair of objects, that break it.

public interface IPCB_Violation : IPCB_Primitive

Namespace: PCB · Assembly: Altium.SDK.Interfaces

Inherits: IPCB_Primitive

Remarks​

A violation of a binary design rule refers to two objects, Primitive1 and Primitive2; a violation of a unary design rule refers to one object, Primitive1, and Primitive2 is null. Check Primitive2 before using it. Rule returns the rule, and Name and Description describe the violation. Violations are returned by the rule checks of IPCB_Rule, such as IPCB_Rule.ActualCheck.

Properties​

PropertyTypeAccessDescription
DescriptionstringgetThe description of the violation.
NamestringgetThe name of the violation.
Primitive1IPCB_PrimitivegetThe first object of the violation, or the only object for a violation of a unary rule.
Primitive2IPCB_PrimitivegetThe second object of the violation; null for a violation of a unary rule.
RuleIPCB_PrimitivegetThe design rule that the violation breaks.
ShortDescriptorStringstringgetA short description of the violation, which starts with the kind of the rule and names the objects of the violation.

Description​

The description of the violation.

string GetState_Description();

Type: string · Access: read-only

The description is part of the violation's DescriptorString.

See also: IPCB_Violation.Name

Name​

The name of the violation.

string GetState_Name();

Type: string · Access: read-only

The name is a number with at least four digits that increases with each violation created, followed by a colon, a space and the object kind of Primitive1, such as Track, or the object kinds of Primitive1 and Primitive2 separated by a slash with a space on each side. For a violation of a single object that is a net, the net's name follows in parentheses.

See also: IPCB_Violation.Description

Primitive1​

The first object of the violation, or the only object for a violation of a unary rule.

IPCB_Primitive GetState_Primitive1();

Type: IPCB_Primitive · Access: read-only

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

For a back-drill via the property returns the via it was drilled from, and for a region of a solid polygon it returns the polygon.

Primitive2​

The second object of the violation; null for a violation of a unary rule.

IPCB_Primitive GetState_Primitive2();

Type: IPCB_Primitive · Access: read-only

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

For a back-drill via the property returns the via it was drilled from, and for a region of a solid polygon it returns the polygon.

Rule​

The design rule that the violation breaks.

IPCB_Primitive GetState_Rule();

Type: IPCB_Primitive · Access: read-only

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

The rule is returned as an IPCB_Primitive; the object is an IPCB_Rule.

Example: Show the name, description and design rule of every violation on the current board.

using PCB;

IPCB_Board board = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (board == null)
return;

// Create an iterator that looks for violation objects only.
IPCB_BoardIterator iterator = board.BoardIterator_Create();
iterator.AddFilter_ObjectSet(new PCB.TObjectSet { TObjectId.eViolationObject });
iterator.AddFilter_AllLayers();
iterator.AddFilter_Method(TIterationMethod.eProcessAll);

// Search for violations.
var violation = iterator.FirstPCBObject() as IPCB_Violation;
while (violation != null)
{
string s = "Violation Name: " + violation.GetState_Name() + "\r\n" +
"Description: " + violation.GetState_Description();
// Get the design rule associated with the current violation.
var rule = violation.GetState_Rule() as IPCB_Rule;
if (rule != null)
DXP.Utils.ShowInfo(s + "\r\n" + " Rule Name: " + rule.GetState_Name(), "Violation");
s = "";
violation = iterator.NextPCBObject() as IPCB_Violation;
}
board.BoardIterator_Destroy(ref iterator);

See also: IPCB_Rule

ShortDescriptorString​

A short description of the violation, which starts with the kind of the rule and names the objects of the violation.

string GetState_ShortDescriptorString();

Type: string · Access: read-only

Methods​

MethodReturnsDescription
IsRedundantboolReturns whether the violation is between an object and itself.

IsRedundant​

Returns whether the violation is between an object and itself.

bool IsRedundant();

Returns: bool

True when Primitive1 and Primitive2 are both set and are the same object (for a polygon, the same part of it); false otherwise, and always false for a violation of a unary rule.

Inherited members​

Returned by​

IPCB_MatchedNetLengthsConstraint.MatchLengthForFromTo, IPCB_MatchedNetLengthsConstraint.MatchLengthForNet, IPCB_Rule.ActualCheck

Accepted by​

IPCB_Rule.ViolationDescriptorString