Skip to content

Tutorial_chapter_1_introduction

hui-zhou-a edited this page Mar 31, 2026 · 2 revisions

Chapter 1 Introduction to PyEDB - The Core Engine for PCB Automation

1.1 What is PyEDB

PyEDB is a Python API provided by Ansys for interacting with the Electronic Database (EDB), which is the underlying data structure of PCB designs.

In a traditional workflow, engineers perform tasks manually through a graphical interface, such as:

  • Inspecting nets
  • Modifying stackup
  • Creating vias
  • Defining ports

With PyEDB, all of these operations can be automated using Python scripts.

1.2 Where PyEDB Fits in the Workflow

To understand the value of PyEDB, it is essential to see its role in the overall simulation flow.

A typical SI/PI workflow looks like this:

PCB Design (Allegro / Altium)
        ↓
    EDB Database
        ↓
PyEDB (Data Processing / Automation)
        ↓
PyAEDT (Simulation Control)
        ↓
HFSS / SIwave Simulation

Key Responsibilities - PyEDB - Focus: Pre-processing and model preparation - Objects: Nets, Vias, Stackup, Components - PyAEDT - Focus: Simulation setup and execution - Objects: Setups, Sweeps, Reports

👉 In short:

PyEDB = “Pre-processing engine”
PyAEDT = “Simulation automation engine”

1.3 Why Use PyEDB?

A common question is:

“If I can do everything in the GUI, why should I use PyEDB?”

The answer lies in three key advantages:

  1. Scalability

    Example tasks: - Modify the width of hundreds of nets - Automatically widen all power nets - Create ports in batch

    👉 GUI: repetitive manual work

    👉 PyEDB: one script, fully automated

  2. Pre-Simulation Cleanup

    Before SIwave or HFSS simulations, common issues include:

    • Unused nets
    • Floating copper
    • Redundant vias

    PyEDB can clean up the design automatically, improving simulation robustness and convergence.

  3. Pre-Simulation Stackup Update

    Common issues with stackup include:

    • Wrong layer thicknesses
    • Wrong materials

    PyEDB can update stackup automatically from a pre-prepared stackup file.

  4. Workflow Integration

    In enterprise environments, simulations are rarely one-off tasks. Instead, they are part of automated pipelines:

     Input Design → Automated Processing → Simulation → Report Generation
    

    👉 PyEDB serves as the entry point of this pipeline.

1.4 What Can PyEDB Do?

Below are the most commonly used capabilities, organized by practical relevance:

  1. Net Operations

    • Iterate over all nets
    • Search for specific nets (e.g., GND, VDD)
    • Rename or delete nets
  2. Stackup Manipulation

    • Read layer stackup
    • Modify dielectric thickness
    • Add or remove layers
  3. Via and Padstack Operations

    • Create vias
    • Modify drill sizes
    • Batch-edit padstack parameters
  4. Component Handling

    • Query components
    • Access pin information
    • Identify power vs signal nets
    • Assign SPICE/S-parameter models
  5. Layout-Level Operations

    • Route signal lines
    • Create power planes
  6. Setup Simulations

    • Place ports
    • Create SIwave/HFSS setups

1.5 A Minimal PyEDB Example

Below is a simple script demonstrating basic usage:

from pyedb import Edb

# Open EDB database
edb = Edb("demo.aedb", version="2026.1")

# Access all nets
nets = edb.nets

# Print net names
for net_name in nets.netlist:
    print(net_name)

# Print components on nets
for reference_designator in nets["1V0"].components.keys():
    print(reference_designator)

This script performs three steps:

  1. Opens a PCB database
  2. Retrieves all nets
  3. Prints their names and components on the nets

👉 Even this minimal example highlights the key capability:

Direct programmatic access to PCB structures

1.6 Key Characteristics of PyEDB

  1. Headless Operation

    • No GUI required
    • Can run on servers
    • Ideal for batch processing
  2. Object-Oriented API

    • Nets, Vias, Stackup are all objects
    • Easy to extend and customize workflows
  3. Native Python Integration

    PyEDB can be combined with:

    • numpy for data analysis
    • pandas for reporting
    • Custom scripts for automation

1.7 The Right Way to Learn PyEDB

A common mistake is:

❌ Starting from API documentation

❌ Trying to memorize all functions

👉 A more effective approach:

Step 1: Start with Tasks

Examples:

  • all signal nets
  • vias
  • Modify stackup

Step 2: Learn APIs On Demand

  • Only learn what you need
  • Avoid unnecessary abstraction

Step 3: Build a Script Library

Over time, you will accumulate reusable tools:

  • generation scripts
  • modification tools
  • preprocessing pipelines

👉 This is where PyEDB delivers real value

1.8 What You Will Learn in This Tutorial

In the following chapters, you will learn how to:

  • and analyze PCB data
  • Nets, Stackup, and Vias
  • automation workflows
  • with PyAEDT for simulation

The ultimate goal:

Enable you to build a complete PCB automation workflow using PyEDB

1.9 Summary

This chapter focuses on three key ideas:

  1. PyEDB is a tool for PCB database manipulation
  2. It operates in the pre-processing stage of simulation
  3. Its core value lies in automation, scalability, and reusability

In the next chapter, we will move to hands-on practice:

👉 Environment setup and your first runnable PyEDB script