How to import .amat file for EDB use in Python? #635
-
I am trying to write a Python script that will automatically generate a stackup, then create some traces/vias/ports etc. However, for my stackup, I need to import certain materials that the default syslib does not have. Is there a way to have the EDB object import an .amat file (containing the material info needed) that will then work correctly with functions like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @bchapman23, you can load .amat by Alternatively, you can use edb.configuration.load. Here is a complete example # Import MaterialsThis example shows how to import materials.### Import the required packages+import json from IPython.display import display from pyedb import Edb AEDT_VERSION = "2024.1" -### Download the example PCB data.temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") ### Load example layout.edbapp = Edb(file_edb, edbversion=AEDT_VERSION) ### Review materials from layoutGet materials from layout in a dictionary. Materials are exported together with stadckup.data_cfg = edbapp.configuration.get_data_from_db(stackup=True) df = pd.DataFrame(data=data_cfg["stackup"]["materials"]) ### Add a new materialdata_cfg["stackup"]["materials"].append( ### Edit existing material propertiesdata_cfg["stackup"]["materials"][1]["name"] = "fr4_epoxy" ### Review modified materialsdf = pd.DataFrame(data=data_cfg["stackup"]["materials"]) ### Write material definition into a json filefile_cfg = Path(temp_folder.name) / "edb_configuration.json" ### Load materials from json configuration fileedbapp.configuration.load(str(file_cfg), apply_file=True) ### Review materials from layoutedbapp.materials.materials ### Check modified material propertiesedbapp.materials["fr4_epoxy"].loss_tangent ### Close EDBedbapp.close() |
Beta Was this translation helpful? Give feedback.
Hi @bchapman23, you can load .amat by
edb.materials.load_amat(mat_file)
Alternatively, you can use edb.configuration.load. Here is a complete example
# Import Materials
This example shows how to import materials.
### Import the required packages
+
import json
from pathlib import Path
import tempfile
from IPython.display import display
import pandas as pd
from pyaedt.downloads import download_file
from pyedb import Edb
AEDT_VERSION = "2024.1"
NG_MODE = False
-
### Download the example PCB data.
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
file_edb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name)
### Load example layout.
edbapp = Edb(file_edb, edbv…