A "what's in this board?" report for a .PcbDoc: physical size from the board outline,
the copper layer stackup, primitive/net counts, and a design-rule summary.
The complete, compiling source for this guide is Program.cs.
dotnet run --project examples/InspectBoard # bundled board
dotnet run --project examples/InspectBoard -- "C:\My.PcbDoc"The reader returns an IPcbDocument; cast it to the concrete PcbDocument to reach the
board-level collections and outline — none of which are on the interface.
var doc = (PcbDocument)await AltiumLibrary.OpenPcbDocAsync(input);
// Physical size: the board outline is a closed polygon of world points.
var outline = doc.GetBoardOutline();
Coord minX = outline[0].X, maxX = outline[0].X, minY = outline[0].Y, maxY = outline[0].Y;
foreach (var p in outline)
{
if (p.X < minX) minX = p.X; if (p.X > maxX) maxX = p.X;
if (p.Y < minY) minY = p.Y; if (p.Y > maxY) maxY = p.Y;
}
var widthMm = (maxX - minX).ToMm();
// Layer stackup (may be null).
if (doc.LayerStack is { } stack)
foreach (var layer in stack.Layers)
Console.WriteLine($"{layer.Index} {layer.Name} {(layer.CopperEnabled ? "copper" : "dielectric")}");
// Design rules: rule-specific values are in the Parameters dictionary.
foreach (var rule in doc.Rules.Where(r => r.RuleKind == "Clearance"))
rule.Parameters.TryGetValue("GAP", out var gap);| Field | Source |
|---|---|
| Board size | PcbDocument.GetBoardOutline() bounding box |
| Layer stack | PcbDocument.LayerStack → PcbLayerEntry.Name / .CopperEnabled |
| Counts | Components, Pads, Tracks, Vias, Nets, Rules, Polygons, … |
| Rule values | PcbRule.Parameters (e.g. "GAP", "MINWIDTH") |
Board outline
100.00 x 100.00 mm (96 edge points)
Contents
Components ........ 57
Pads .............. 210
Tracks ............ 1374
Vias .............. 1269
Nets .............. 35
Rules ............. 41
- Compute the outline bounding box from the points directly:
CoordRect.Unionof zero-area point rectangles collapses to empty. LayerStackis parsed from versionedV7_LAYER*keys in Board6 and can benullfor boards that don't store them — the example handles that case.
See the guides index for the full set of examples.