{ "cells": [ { "cell_type": "markdown", "id": "07f2ff9e", "metadata": {}, "source": [ "# EDB: IPC2581 export\n", "\n", "This example shows how you can use PyAEDT to export an IPC2581 file.\n", "\n", "Perform required imports, which includes importing a section." ] }, { "cell_type": "code", "execution_count": null, "id": "e72c9683", "metadata": {}, "outputs": [], "source": [ "import os\n", "import tempfile\n", "\n", "import pyedb\n", "from pyedb.generic.general_methods import generate_unique_name\n", "from pyedb.misc.downloads import download_file\n" ] }, { "cell_type": "markdown", "id": "a27bf7e7", "metadata": {}, "source": [ "## Download the AEDB file and copy it in the temporary folder." ] }, { "cell_type": "code", "execution_count": null, "id": "a84ebb9a", "metadata": {}, "outputs": [], "source": [ "temp_dir = tempfile.TemporaryDirectory(suffix=\".ansys\")\n", "targetfile = download_file(\"edb/ANSYS-HSD_V1.aedb\", destination=temp_dir.name)\n", "ipc2581_file_name = os.path.join(temp_dir.name, \"Ansys_Hsd.xml\")\n", "print(targetfile)" ] }, { "cell_type": "markdown", "id": "e441cba9", "metadata": {}, "source": [ "## Launch EDB\n", "\n", "Launch the `pyedb.Edb` class, using EDB 2023.\n", "> Note that length dimensions passed to EDB are in SI units." ] }, { "cell_type": "code", "execution_count": null, "id": "0e8edba9", "metadata": {}, "outputs": [], "source": [ "# Select EDB version (change it manually if needed, e.g. \"2024.2\")\n", "edb_version = \"2024.2\"\n", "print(f\"EDB version: {edb_version}\")\n", "\n", "edb = pyedb.Edb(edbpath=targetfile, edbversion=edb_version)" ] }, { "cell_type": "markdown", "id": "f0e3689c", "metadata": {}, "source": [ "## Parametrize the width of a trace." ] }, { "cell_type": "code", "execution_count": null, "id": "b96f6b4b", "metadata": {}, "outputs": [], "source": [ "edb.modeler.parametrize_trace_width(\"A0_N\", parameter_name=generate_unique_name(\"Par\"), variable_value=\"0.4321mm\")" ] }, { "cell_type": "markdown", "id": "e553401e", "metadata": {}, "source": [ "## Create a cutout and plot it." ] }, { "cell_type": "code", "execution_count": null, "id": "ca03de37", "metadata": {}, "outputs": [], "source": [ "signal_list = []\n", "for net in edb.nets.netlist:\n", " if \"PCIe\" in net:\n", " signal_list.append(net)\n", "power_list = [\"GND\"]\n", "edb.cutout(\n", " signal_list=signal_list,\n", " reference_list=power_list,\n", " extent_type=\"ConvexHull\",\n", " expansion_size=0.002,\n", " use_round_corner=False,\n", " number_of_threads=4,\n", " remove_single_pin_components=True,\n", " use_pyaedt_extent_computing=True,\n", " extent_defeature=0,\n", ")\n", "edb.nets.plot(None, None, color_by_net=True)" ] }, { "cell_type": "markdown", "id": "8a5737cc", "metadata": {}, "source": [ "## Export the EDB to an IPC2581 file." ] }, { "cell_type": "code", "execution_count": null, "id": "61b469a3", "metadata": {}, "outputs": [], "source": [ "edb.export_to_ipc2581(ipc2581_file_name, \"inch\")\n", "print(\"IPC2581 File has been saved to {}\".format(ipc2581_file_name))" ] }, { "cell_type": "markdown", "id": "366f09a0", "metadata": {}, "source": [ "## Close EDB" ] }, { "cell_type": "code", "execution_count": null, "id": "f4d376e0", "metadata": {}, "outputs": [], "source": [ "edb.close_edb()" ] }, { "cell_type": "markdown", "id": "2b5284dd", "metadata": {}, "source": [ "## Clean up the temporary directory" ] }, { "cell_type": "code", "execution_count": null, "id": "958114fc", "metadata": {}, "outputs": [], "source": [ "temp_dir.cleanup()" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" } }, "nbformat": 4, "nbformat_minor": 5 }