SkillAgentSearch skills...

matlab-read-pcb-layout

Import Gerber, ODB++, Allegro .brd, .mcm files for PCB boards and IC packages. Inspect nets, layers, shapes, and stackups. TRIGGER: user asks to import, read, or open a PCB layout file. Gerber files use gerberRead or PCBReader; ODB++, Allegro .brd, .mcm, and native formats use pcbFileRead.

Install / Use

npx skills add matlab/matlab-agentic-toolkit --skill matlab-read-pcb-layout

Installs into whichever agent you are using.

About this skill
📄

SKILL.md

Installable skill definition

Quality Score

93/100

Supported Platforms

Zed

Our assessment of matlab-read-pcb-layout

matlab-read-pcb-layout scores 93/100 on our quality scale, 244th of 1,199 Content & Media skills we index (top 21%).

Its SKILL.md is 18 KB long, well organised into 35 sections with 20 code examples: a thorough specification that gives an agent plenty to work with.

With 1,098 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
30/30
Structure
20/20
Description
15/15
Adoption
13/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated 18 days ago, so matlab-read-pcb-layout is actively maintained.
  • No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
  • Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

matlab-read-pcb-layout compared with similar skills

All 4 of these similar skills score higher than matlab-read-pcb-layout; compare them before choosing.

SkillScoreStarsUpdatedFormat
matlab-read-pcb-layout (this skill)by matlab931.1k18d agoSKILL.md
Agent-Reachby Panniantong10089.8k18d agoCLAUDE.md
headroomby headroomlabs-ai10074.4ktodayCLAUDE.md
Scraplingby D4Vinci10085.4ktodayMCP Server
crawl4aiby unclecode10084.7k8d agoMCP Server

Frequently asked questions

How do I install matlab-read-pcb-layout?
Run npx skills add matlab/matlab-agentic-toolkit --skill matlab-read-pcb-layout. The install tabs above show the steps for each supported agent.
Which AI agents does matlab-read-pcb-layout work with?
It is written for Zed, as a SKILL.md file. Other agents that read the same format can often use it too.
Is matlab-read-pcb-layout safe to use?
It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is matlab-read-pcb-layout still maintained?
The repository was last updated 18 days ago, so matlab-read-pcb-layout is actively maintained.

name: matlab-read-pcb-layout description: "Import Gerber, ODB++, Allegro .brd, .mcm files for PCB boards and IC packages. Inspect nets, layers, shapes, and stackups. TRIGGER: user asks to import, read, or open a PCB layout file. Gerber files use gerberRead or PCBReader; ODB++, Allegro .brd, .mcm, and native formats use pcbFileRead. Also when inspecting nets, layers, components, or stackups from an imported board. Invoke BEFORE writing import code — the query API (cadnet, cadnetList, componentList) is specialized. SKIP: EM analysis or S-parameter extraction (use matlab-analyze-em), PDN/IR-drop analysis (use matlab-analyze-pcb-pdn), building custom geometry (use matlab-assemble-pcb-layout), material/stackup definition only (use matlab-manage-pcb-material)." license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md metadata: author: MathWorks version: "1.0"

Reading PCB and Package Layouts

Scope: pcbFileRead handles both PCB boards and IC/SiP packages. ODB++ and Allegro files may contain package-level designs (BGA substrates, interposers, embedded passives). The workflow is identical — the format determines what's inside, not the function name.

When to Use

  • Importing Gerber files (.gtl, .gbl, .gbr, etc.) into MATLAB for visualization or EM analysis
  • Reading ODB++ archives (zipped or unzipped) to inspect board or package layouts
  • Importing Cadence Allegro .brd files
  • Inspecting cadnets, components, layers, pins, or shapes from imported layouts
  • Extracting metal layer polygons from Gerber files for use in custom designs
  • Building a pcbComponent from externally designed layouts for S-parameter analysis

When NOT to Use

  • Exporting designs to Gerber files — use matlab-write-pcb-layout
  • Building PCB structures from scratch with shape primitives — use matlab-assemble-pcb-layout
  • Running EM analysis after import — use matlab-analyze-em
  • Defining substrates or stackup materials — use matlab-manage-pcb-material

Typical Workflow

  1. This skill: Import the PCB layout from Gerber, ODB++, or Allegro
  2. After: matlab-analyze-pcb-pdn — PDN DC analysis on imported board; or matlab-analyze-em — S-parameter extraction from imported geometry; or matlab-model-via — via analysis on imported stackup

Quick Reference

| Task | Code | |------|------| | Import Gerber file | P = gerberRead('file.gtl') | | Extract shapes | shp = shapes(P) | | Define stackup | S = stackUp | | Multi-layer import | p = PCBReader('StackUp', S) | | Convert to pcbComponent | pcb = pcbComponent(p) | | Import ODB++ | pfile = pcbFileRead('design.zip') | | Import Allegro .brd | pfile = pcbFileRead('design.brd') | | List cadnets | tbl = cadnetList(pfile) | | Open a cadnet | cnet = cadnet(pfile, "NET_NAME") | | Query layer stackup | su = stackUp(pfile) | | List components | tbl = componentList(pfile) | | List padstacks | tbl = padStackList(pfile) |

gerberRead — Simple Import

The gerberRead function imports Gerber files and returns a PCBReader object. Use shapes() to extract the metal layers as polygon shapes.

Basic Usage

P = gerberRead('interdigital_Capacitor.gtl');
shp = shapes(P);      % Extract metal layer shapes
show(shp(1));          % Show top layer polygon

Centering Imported Geometry

Imported shapes often have non-zero offsets from CAD origin. Extract shapes, then center:

P = gerberRead('myDesign.gtl');
shp = shapes(P);
layer1 = shp(1);

% Get bounding box to compute center offset
verts = layer1.Vertices;
cx = (max(verts(:,1)) + min(verts(:,1))) / 2;
cy = (max(verts(:,2)) + min(verts(:,2))) / 2;

% Center using translate
layer1 = translate(layer1, [-cx -cy 0]);
show(layer1);

Supported Gerber File Extensions

| Extension | Layer Type | |-----------|-----------| | .gtl | Top copper | | .gbl | Bottom copper | | .gts | Top solder mask | | .gbs | Bottom solder mask | | .gto | Top silkscreen | | .gbo | Bottom silkscreen | | .drl | Drill file | | .gbr | Generic Gerber |

stackUp — Multi-Layer Definition

The stackUp object defines the full PCB layer structure for importing multi-layer boards.

Default stackUp

S = stackUp;

A default stackup has numbered layers. Odd layers are conductors (metal or Gerber files), even layers are dielectrics.

Assigning Gerber Files to Layers

S = stackUp;
S.Layer1.Thickness = 0.1e-3;           % Air layer above board
S.Layer2 = 'interdigital_Capacitor.gtl'; % Top copper from Gerber

Multi-Layer Stackup

S = stackUp;
S.Layer1.Thickness = 0.1e-3;       % Air
S.Layer2 = 'top_copper.gtl';       % Top copper
S.Layer3.Thickness = 0.2e-3;       % Dielectric
S.Layer3.EpsilonR = 4.4;
S.Layer4 = 'inner_layer.g2';       % Inner copper
S.Layer5.Thickness = 1.0e-3;       % Core dielectric
S.Layer5.EpsilonR = 4.4;
S.Layer6 = 'bottom_copper.gbl';    % Bottom copper

PCBReader — Full Board Import

PCBReader wraps the stackup with Gerber files into a reader object that can be converted to pcbComponent.

Basic Workflow

S = stackUp;
S.Layer1.Thickness = 0.1e-3;
S.Layer2 = 'interdigital_Capacitor.gtl';

p = PCBReader('StackUp', S);
pcb = pcbComponent(p);
pcb.FeedDiameter = 0.001;
show(pcb);

Adding Feeds After Import

After converting to pcbComponent, add feed locations for EM analysis:

pcb = pcbComponent(p);
pcb.FeedDiameter = 1e-3;
pcb.FeedLocations = [-5e-3 0 1 3;    % Port 1
                      5e-3 0 1 3];    % Port 2
sp = sparameters(pcb, linspace(1e9, 10e9, 51), 'SweepOption', 'interp');
rfplot(sp);

Determining Feed Locations from Imported Geometry

Feed locations must fall on metal traces. After converting a Gerber import to pcbComponent, inspect the geometry to find valid feed points:

pcb = pcbComponent(p);
show(pcb);                      % Visual inspection — identify trace endpoints
layout(pcb);                    % Top-down layout view with dimensions

For programmatic placement, extract the imported layer's mesh vertices and compute edge midpoints:

m = mesh(pcb);                  % Get mesh structure for coordinate reference

When feed locations are uncertain, place feeds at the visual endpoints of the main transmission line trace, inset by at least FeedDiameter/2 from the trace edge.

FeedLocations Column Semantics

FeedLocations = [x, y, col3, col4] — Column 3 is the signal layer (where the feed probe/sphere appears). Column 4 is the ground reference layer. The probe connects from col3 to col4. If you swap them, the feed sphere renders on the wrong layer.

Edge Feeds (Strip Model)

For structures fed at the board edge (e.g., microstrip lines terminating at the PCB boundary), use the strip feed model:

pcb.FeedViaModel = 'strip';
pcb.FeedDiameter = traceWidth / 2;  % Must be half the trace width for edge feeds

The 'strip' model creates a planar feed at the board edge rather than a vertical via probe. Place feeds at the exact edge of the BoardShape where the trace terminates.

PCBReader Layer Structure

After pcbComponent(PCBReader), the Layers cell array follows the standard alternating pattern: {metal, dielectric, metal, ...}. The metal layers contain the imported Gerber shapes. Layer indices for FeedLocations follow the same odd-numbered convention (1, 3, 5, ...) as manually assembled pcbComponent objects.

Converting PCBReader to pcbComponent

The pcbComponent constructor accepts a PCBReader object directly.

Cadence Allegro .brd Import

When the user references a .brd file for import or analysis, always ask for their Cadence extracta.exe path before attempting the import. The extracta utility is required and must be configured first. Do not assume it is already set up.

% Step 1: Check if extracta is already configured
extractaSetup()                % Displays current path, or [] if not set

% Step 2: If [], ask user for path and configure (persists across sessions)
extractaSetup('C:/Cadence/SPB_17.4/tools/bin/extracta.exe')

% Step 3: Import
pcb = pcbFileRead('design.brd');

extractaSetup(path) accepts the full path to the Cadence extracta.exe executable. The path persists across MATLAB sessions — it only needs to be run once. Without this, .brd imports fail with an extracta error.

Calling extractaSetup() with no arguments displays the currently configured path (or [] if not yet set). Use this to check whether setup has already been done.

ODB++ Import

pcb = pcbFileRead('design.zip');       % Zipped ODB++
pcb = pcbFileRead('odb_directory');    % Unzipped ODB++

Board and Package Inspection

pcbFileRead opens ODB++, Allegro, or native PCB files for hierarchical inspection — layers, cadnets, components, parts, pins, and shapes. This works identically for PCB boards and IC/SiP packages.

Opening a File

pfile = pcbFileRead('ExampleBoard.odb');

The returned object exposes: NumLayers, NumCadnets, NumPadStacks, NumComponents, NumParts, LayerHeight.

Querying Layer Stackup

stackUp(pfile) returns a table of material details for every layer in the imported board:

su = stackUp(pfile);                   % Full stackup table
su = stackUp(pfile, [2 3 4]);         % Specific layers only

The table has columns: LayerNumber, LayerName, LayerType, Material, Thickness(inch), EpsilonR, LossTangent, Conductivity(S/m).

Note: This is an object function on pcbFileRead that returns a table — it is unrelated to the stackUp constructor used with Gerber import (see the Pitfalls section).

Navigating the Hierarchy

% List cadnets (electrical nets)
tbl = cadnetList(pfile);               % Returns table with net names

% Open a specific cadnet and get its shapes
cnet = cadnet(pfile, "VDD_CORE");
data = cadnetData(cnet);               % Struct with .Surfaces, .Pins, .Vias, .Traces
s = shapes(cnet);                      % Same struct as cadnetData (equivalent call)

% List and inspect components
tbl = componentList(pfile);
comp = component(pfile, "U1");
pins = componentPinData(comp);         % Returns pinsData array (see below)

% List and inspect parts (component types)
tbl = partList(pfile);
p = part(pfile, "IC6ANT");
cdata = componentData(p);             % Components that use this part type

% List padstacks
tbl = padStackList(pfile);

% Layer-level inspection (metal layers only — use pfile.MetalLayer for valid indices)
lyr = layer(pfile, pfile.MetalLayer(1));
ldata = layerData(lyr);

% Search for components in a cadnet
results = findComponents(cnet);
results = findComponents(cnet, 'ComponentType', 'IC');

Shape Data Structure

shapes(cnet) and cadnetData(cnet) are equivalent — both return a struct with fields:

| Field | Type | Content | |-------|------|---------| | .Surfaces | antenna.Polygon array | Copper pours and fills | | .Pins | antenna.Polygon array | Pad shapes | | .Vias | antenna.Polygon array | Via barrel shapes | | .Traces | antenna.Polygon array | Routed trace segments |

s = shapes(cnet);
s.Traces(1).Vertices   % Vertices of first trace segment
numel(s.Surfaces)      % Number of copper pours

layerData(lyr) returns the same struct format. Each antenna.Polygon has a .Vertices property (Nx3 double).

componentPinData — Pin Positions and Properties

componentPinData(comp) returns a pinsData array. Each element has:

| Property | Type | Description | |----------|------|-------------| | Center | 1x2 double | XY position of pin center (board units) | | PinNumber | char/string | Pin number/name | | CadnetName | char/string | Net the pin connects to | | PinShape | char | Shape type (e.g., 'Rect', 'Circle') | | StartLayer | double | First layer the pin spans | | StopLayer | double | Last layer the pin spans

Truncated for display — read the full file on GitHub.

Related Skills

View on GitHub
GitHub Stars1.1k
CategoryContent
Updated18d ago
Forks134

Languages

MATLAB

Trust signals

88/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

1 medium