Download this example

Download this example as a Jupyter Notebook or as a Python script.


Import of a PCB and its components via IDF and EDB#

This example shows how to import a PCB and its components using IDF files (LDB and BDF). You can also use a combination of EMN and EMP files in a similar way.

Keywords: Icepak, PCB, IDF.

Perform imports and define constants#

Perform required imports.

[1]:
import os
import tempfile
import time
[2]:
import ansys.aedt.core
from ansys.aedt.core import Hfss3dLayout, Icepak

Define constants.

[3]:
AEDT_VERSION = "2024.2"
NG_MODE = False  # Open AEDT UI when it is launched.

Open project#

Open an empty project in non-graphical mode, using a temporary folder.

[4]:
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")

ipk = Icepak(
    project=os.path.join(temp_folder.name, "Icepak_ECAD_Import.aedt"),
    version=AEDT_VERSION,
    new_desktop=True,
    non_graphical=NG_MODE,
)
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.12.dev0.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_159f6870-55b2-4a3b-9c4e-9915d27123ec.log is enabled.
PyAEDT INFO: Log on AEDT is enabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: New AEDT session is starting on gRPC port 56668
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
PyAEDT INFO: Ansoft.ElectronicsDesktop.2024.2 version started with process ID 4112.
PyAEDT INFO: Project Icepak_ECAD_Import has been created.
PyAEDT INFO: No design is present. Inserting a new design.
PyAEDT INFO: Added design 'Icepak_BDH' of type Icepak.
PyAEDT INFO: Aedt Objects correctly read
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmps5opvf8i.ansys/Icepak_ECAD_Import.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmps5opvf8i.ansys/Icepak_ECAD_Import.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.015624284744262695

Import the IDF files#

Import the BDF and LDF files. Sample files are shown here.

d9da9d6da47741a2a75080f879dd707c

97a844f304854479b2fbbe4a232e2848

You can import the IDF files with several filtering options, including caps, resistors, inductors, power, specific power, and size. There are also options for PCB creation, including number of layers, copper percentages, and layer sizes.

This example uses the default values for the PCB. The imported PCB (from the IDF files) are deleted later and replaced by a PCB that has the trace information (from ECAD) for higher accuracy.

Download ECAD and IDF files.

[5]:
def_path = ansys.aedt.core.downloads.download_file(
    source="icepak/Icepak_ECAD_Import/A1_uprev.aedb",
    name="edb.def",
    destination=temp_folder.name,
)
board_path = ansys.aedt.core.downloads.download_file(
    source="icepak/Icepak_ECAD_Import/", name="A1.bdf", destination=temp_folder.name
)
library_path = ansys.aedt.core.downloads.download_file(
    source="icepak/Icepak_ECAD_Import/", name="A1.ldf", destination=temp_folder.name
)

Import IDF file.

[6]:
ipk.import_idf(board_path=board_path)
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 1sec
[6]:
True

Save the project

[7]:
ipk.save_project()
PyAEDT INFO: Project Icepak_ECAD_Import Saved correctly
[7]:
True

Import ECAD#

Add an HFSS 3D Layout design with the layout information of the PCB.

[8]:
hfss3d_lo = Hfss3dLayout(project=def_path, version=AEDT_VERSION)
hfss3d_lo.save_project()
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.12.dev0.
PyAEDT INFO: Returning found Desktop session with PID 4112!
PyAEDT INFO: EDB folder C:\Users\ansys\AppData\Local\Temp\tmps5opvf8i.ansys\icepak/Icepak_ECAD_Import/A1_uprev.aedb\edb.def has been imported to project A1_uprev
PyAEDT INFO: Active Design set to 0;A1_uprev
PyAEDT INFO: Aedt Objects correctly read
PyAEDT INFO: Project A1_uprev Saved correctly
[8]:
True

Create a PCB component in Icepak linked to the HFSS 3D Layout project. The polygon "poly_0" is used as the outline of the PCB, and a dissipation of "1W" is applied to the PCB.

[9]:
project_file = hfss3d_lo.project_file
design_name = hfss3d_lo.design_name
[10]:
ipk.create_pcb_from_3dlayout(
    component_name="PCB_pyAEDT",
    project_name=project_file,
    design_name=design_name,
    extent_type="Polygon",
    outline_polygon="poly_0",
    power_in=1,
    close_linked_project_after_import=False,
)
PyAEDT INFO: Materials class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: PCB component correctly created in Icepak.
[10]:
<ansys.aedt.core.modules.boundary.NativeComponentPCB at 0x1b17fe2f7f0>

Delete the simplified PCB object coming from the IDF import.

[11]:
ipk.modeler.delete_objects_containing("IDF_BoardOutline", False)
PyAEDT INFO: Parsing design objects. This operation can take time
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmps5opvf8i.ansys/Icepak_ECAD_Import.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmps5opvf8i.ansys/Icepak_ECAD_Import.aedt correctly loaded. Elapsed time: 0m 1sec
PyAEDT INFO: aedt file load time 0.5843667984008789
PyAEDT INFO: 3D Modeler objects parsed. Elapsed time: 0m 1sec
PyAEDT INFO: Deleted 1 Objects: IDF_BoardOutline.
PyAEDT INFO: Deleted 1 objects
[11]:
True

Release AEDT#

[12]:
ipk.save_project()
ipk.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
PyAEDT INFO: Project Icepak_ECAD_Import Saved correctly
PyAEDT INFO: Desktop has been released and closed.

Clean up#

All project files are saved in the folder temp_folder.name. If you’ve run this example as a Jupyter notebook, you can retrieve those project files. The following cell removes all temporary files, including the project folder.

[13]:
temp_folder.cleanup()

Download this example

Download this example as a Jupyter Notebook or as a Python script.