|
1 | | -# # EDB: geometry creation |
2 | | - |
3 | | -# This example shows how you can use EDB to create a layout. |
4 | | -# ## Final expected project |
| 1 | +# # Parametric differential vias |
| 2 | +# |
| 3 | +# This example demonstrates how a differential via pair can be created using the EDB Python |
| 4 | +# interface. |
| 5 | +# |
| 6 | +# The final differential via pair is shown below. |
5 | 7 | # |
6 | 8 | # <img src="_static/diff_via.png" width="500"> |
| 9 | +# |
| 10 | +# Keywords: **Differential Via** |
7 | 11 |
|
8 | 12 |
|
9 | | -# ## Perform imports and define constants |
| 13 | +# ## Prerequisites |
10 | 14 | # |
11 | | -# Perform required imports. |
| 15 | +# ### Perform imports |
12 | 16 |
|
13 | | -# + |
14 | 17 | import os |
15 | 18 | import tempfile |
16 | | - |
17 | 19 | import pyedb |
18 | | -# - |
| 20 | + |
| 21 | +# ### Define constants |
| 22 | +# Constants help ensure consistency and avoid repetition throughout the example. |
| 23 | + |
| 24 | +AEDT_VERSION = "2025.1" |
| 25 | +NG_MODE = False # Open AEDT UI when it is launched. |
| 26 | + |
| 27 | +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") |
| 28 | + |
| 29 | +# ### Start the EDB |
19 | 30 |
|
20 | 31 | # + |
21 | | -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") |
22 | | -aedb_path = os.path.join(temp_dir.name, "create_via.aedb") |
| 32 | +aedb_path = os.path.join(temp_folder.name, "diff_via.aedb") |
23 | 33 | print(f"AEDB file path: {aedb_path}") |
24 | 34 |
|
25 | | -# Select EDB version (change it manually if needed, e.g. "2025.1") |
26 | | -edb_version = "2025.1" |
27 | | -print(f"EDB version: {edb_version}") |
28 | | - |
29 | | -edb = pyedb.Edb(edbpath=aedb_path, edbversion=edb_version) |
| 35 | +edb = pyedb.Edb(edbpath=aedb_path, edbversion=AEDT_VERSION) |
30 | 36 | # - |
31 | 37 |
|
32 | | -# ## Add stackup layers |
33 | | -# Add stackup layers. |
34 | | -# A stackup can be created layer by layer or imported from a CSV file or XML file. |
| 38 | +# ## Model Creation |
| 39 | +# |
| 40 | +# ### Add stackup layers |
| 41 | +# |
| 42 | +# A stackup can be created layer by layer or imported from a |
| 43 | +# [configuration file](https://examples.aedt.docs.pyansys.com/version/dev/examples/00_edb/use_configuration/import_stackup.html). |
35 | 44 |
|
36 | 45 | edb.stackup.add_layer("GND") |
37 | 46 | edb.stackup.add_layer("Diel", "GND", layer_type="dielectric", thickness="0.1mm", material="FR4_epoxy") |
38 | 47 | edb.stackup.add_layer("TOP", "Diel", thickness="0.05mm") |
39 | 48 |
|
40 | | -# ## Create signal net and ground planes |
| 49 | +# ### Create signal nets and ground planes |
41 | 50 | # Create a signal net and ground planes. |
42 | 51 |
|
43 | 52 | points = [[0.0, 0], [100e-3, 0.0]] |
|
48 | 57 | edb.modeler.create_polygon(points, "TOP") |
49 | 58 |
|
50 | 59 |
|
51 | | -# ## Create vias with parametric positions |
52 | | -# Create vias with parametric positions. |
| 60 | +# ## Place vias |
53 | 61 |
|
54 | 62 | edb.padstacks.create("MyVia") |
55 | 63 | edb.padstacks.place([5e-3, 5e-3], "MyVia") |
|
62 | 70 | edb.padstacks.place([45e-3, -5e-3], "MyVia") |
63 | 71 |
|
64 | 72 |
|
65 | | -# ## Generate geometry plot |
| 73 | +# ### View the nets |
66 | 74 |
|
67 | 75 | edb.nets.plot(None, color_by_net=True) |
68 | 76 |
|
69 | | -# ## Generate stackup plot |
| 77 | +# ### View the stackup |
70 | 78 |
|
71 | 79 | edb.stackup.plot(plot_definitions="MyVia") |
72 | 80 |
|
73 | | -# ## Save and close EDB |
| 81 | +# ## Finish |
| 82 | +# |
| 83 | +# ### Save the project |
74 | 84 | # Save and close EDB. |
75 | 85 |
|
76 | 86 | if edb: |
77 | 87 | edb.save_edb() |
78 | 88 | edb.close_edb() |
79 | 89 | print("EDB saved correctly to {}. You can import in AEDT.".format(aedb_path)) |
80 | 90 |
|
81 | | -# ### Clean up temporary directory |
| 91 | +# ### Clean up |
82 | 92 | # |
83 | | -# The following command removes the project and the temporary directory. |
84 | | -# If you'd like to save this project, save it to a folder of your choice |
85 | | -# prior to running the following cell. |
| 93 | +# All project files are saved in the folder ``temp_folder.name``. |
| 94 | +# If you've run this example as a Jupyter notebook, you |
| 95 | +# can retrieve those project files. The following cell |
| 96 | +# removes all temporary files, including the project folder. |
86 | 97 |
|
87 | | -temp_dir.cleanup() |
| 98 | +temp_folder.cleanup() |
0 commit comments