Tutorial: Draw a Circuit and Run ERC
ECAD symbols and the electrical rules check
You will build: a small circuit and run the electrical rules check. Time: about 15 minutes. Prerequisites: Beep.Skia and Beep.Skia.ECAD.
1. Components
using Beep.Skia;
using Beep.Skia.ECAD;
var manager = new DrawingManager();
var supply = new ECADPowerSupplyNode { X = 60, Y = 140, Width = 120, Height = 80, Label = "5V" };
var resistor = new ECADResistorNode { X = 260, Y = 150, Width = 100, Height = 60, Label = "R1" };
var led = new ECADDiodeNode { X = 440, Y = 150, Width = 100, Height = 60, Label = "D1" };
var ground = new ECADGroundNode { X = 620, Y = 160, Width = 80, Height = 60, Label = "GND" };
foreach (var node in new SkiaComponent[] { supply, resistor, led, ground })
manager.AddComponent(node);
2. Wire it
manager.ConnectComponents(supply, resistor);
manager.ConnectComponents(resistor, led);
manager.ConnectComponents(led, ground);
foreach (var line in manager.GetLines())
line.RoutingMode = LineRoutingMode.Orthogonal;
3. Electrical rules check
var checker = new ElectricalRulesChecker();
checker.RunChecks(manager.GetComponents().ToList(), manager.GetLines());
foreach (var violation in checker.Violations)
Console.WriteLine($"[{violation.Severity}] {violation.Category}: {violation.Message}");
// violations carry the component/port/line so a host can select and highlight them
Next steps
- ECAD family — all symbol types and the rendered grid
- Diagram validation — structural rules beyond electrical ones