Note
Go to the end to download the full example code.
EDB: geometry creation#
This example shows how you can use EDB to create a layout.
- Import EDB layout object
Import the EDB layout object and initialize it on version 2023 R2.
import os
import time
import pyedb
from pyedb.generic.general_methods import (
generate_unique_folder_name,
generate_unique_name,
)
start = time.time()
aedb_path = os.path.join(generate_unique_folder_name(), generate_unique_name("pcb") + ".aedb")
edb = pyedb.Edb()
edb.save_edb_as(aedb_path)
True
Add stackup layers#
Add stackup layers. A stackup can be created layer by layer or imported from a csv file or xml file.
edb.stackup.add_layer("GND")
edb.stackup.add_layer("Diel", "GND", layer_type="dielectric", thickness="0.1mm", material="FR4_epoxy")
edb.stackup.add_layer("TOP", "Diel", thickness="0.05mm")
Material 'copper' does not exist in material library. Intempt to create it from syslib.
Material 'FR4_epoxy' does not exist in material library. Intempt to create it from syslib.
<pyedb.dotnet.edb_core.edb_data.layer_data.StackupLayerEdbClass object at 0x000001AA53D04220>
Create signal net and ground planes#
Create a signal net and ground planes.
points = [
[0.0, 0],
[100e-3, 0.0],
]
edb.modeler.create_trace(points, "TOP", width=1e-3)
points = [[0.0, 1e-3], [0.0, 10e-3], [100e-3, 10e-3], [100e-3, 1e-3], [0.0, 1e-3]]
edb.modeler.create_polygon(points, "TOP")
points = [[0.0, -1e-3], [0.0, -10e-3], [100e-3, -10e-3], [100e-3, -1e-3], [0.0, -1e-3]]
edb.modeler.create_polygon(points, "TOP")
<pyedb.dotnet.edb_core.edb_data.primitives_data.EdbPolygon object at 0x000001AA47F65210>
Create vias with parametric positions#
Create vias with parametric positions.
edb.padstacks.create("MyVia")
edb.padstacks.place([5e-3, 5e-3], "MyVia")
edb.padstacks.place([15e-3, 5e-3], "MyVia")
edb.padstacks.place([35e-3, 5e-3], "MyVia")
edb.padstacks.place([45e-3, 5e-3], "MyVia")
edb.padstacks.place([5e-3, -5e-3], "MyVia")
edb.padstacks.place([15e-3, -5e-3], "MyVia")
edb.padstacks.place([35e-3, -5e-3], "MyVia")
edb.padstacks.place([45e-3, -5e-3], "MyVia")
<pyedb.dotnet.edb_core.edb_data.padstacks_data.EDBPadstackInstance object at 0x00000169A9BA40A0>
Geometry Plot#
edb.nets.plot(None, color_by_net=True)
Stackup Plot#
edb.stackup.plot(plot_definitions="MyVia")
<module 'matplotlib.pyplot' from 'C:\\actions-runner\\_work\\pyedb\\pyedb\\.venv\\lib\\site-packages\\matplotlib\\pyplot.py'>
Save and close EDB#
Save and close EDB.
EDB saved correctly to C:\Users\ansys\AppData\Local\Temp\pyedb_prj_I24\pcb_Y34HDA.aedb. You can import in AEDT.
0.5155596733093262
Total running time of the script: (0 minutes 0.516 seconds)