Skip to content

Commit

Permalink
FIX: import_gds_file (#826)
Browse files Browse the repository at this point in the history
* FIX: RaptorX Max Frequency, Mesh Frequency, Edge Mesh

* FIX: GDS_input

* MISC: Auto fixes from pre-commit.com hooks

For more information, see https://pre-commit.ci

* FIX: GDS_input

* Update src/pyedb/dotnet/edb.py

Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com>

* Update src/pyedb/dotnet/edb.py

Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com>

---------

Co-authored-by: geofetsis <geofetsis@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 1, 2024
1 parent e96a833 commit afdf399
Showing 1 changed file with 56 additions and 24 deletions.
80 changes: 56 additions & 24 deletions src/pyedb/dotnet/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1455,12 +1455,12 @@ def import_cadence_file(self, inputBrd, WorkDir=None, anstranslator_full_path=""
def import_gds_file(
self,
inputGDS,
WorkDir=None,
anstranslator_full_path="",
use_ppe=False,
control_file=None,
tech_file=None,
map_file=None,
layer_filter=None,
):
"""Import a GDS file and generate an ``edb.def`` file in the working directory.
Expand All @@ -1471,10 +1471,6 @@ def import_gds_file(
----------
inputGDS : str
Full path to the GDS file.
WorkDir : str, optional
Directory in which to create the ``aedb`` folder. The default value is ``None``,
in which case the AEDB file is given the same name as the GDS file. Only the extension
differs.
anstranslator_full_path : str, optional
Full path to the Ansys translator.
use_ppe : bool, optional
Expand All @@ -1484,31 +1480,67 @@ def import_gds_file(
the XML file in the same directory as the GDS file. To succeed, the XML file and GDS file must
have the same name. Only the extension differs.
tech_file : str, optional
Technology file. It uses Helic to convert tech file to xml and then imports the gds. Works on Linux only.
Technology file. For versions<2024.1 it uses Helic to convert tech file to xml and then imports
the gds. Works on Linux only.
For versions>=2024.1 it can directly parse through supported foundry tech files.
map_file : str, optional
Layer map file.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
layer_filter:str,optional
Layer filter file.
"""
if not is_linux and tech_file:
self.logger.error("Technology files are supported only in Linux. Use control file instead.")
return False
control_file_temp = os.path.join(tempfile.gettempdir(), os.path.split(inputGDS)[-1][:-3] + "xml")
ControlFile(xml_input=control_file, tecnhology=tech_file, layer_map=map_file).write_xml(control_file_temp)
if self.import_layout_pcb(
inputGDS,
working_dir=WorkDir,
anstranslator_full_path=anstranslator_full_path,
use_ppe=use_ppe,
control_file=control_file_temp,
):
return True
if float(self.edbversion) < 2024.1:
if not is_linux and tech_file:
self.logger.error("Technology files are supported only in Linux. Use control file instead.")
return False

ControlFile(xml_input=control_file, tecnhology=tech_file, layer_map=map_file).write_xml(control_file_temp)
if self.import_layout_pcb(
inputGDS,
anstranslator_full_path=anstranslator_full_path,
use_ppe=use_ppe,
control_file=control_file_temp,
):
return True
else:
return False
else:
return False
temp_map_file = os.path.splitext(inputGDS)[0] + ".map"
temp_layermap_file = os.path.splitext(inputGDS)[0] + ".layermap"

if map_file is None:
if os.path.isfile(temp_map_file):
map_file = temp_map_file
elif os.path.isfile(temp_layermap_file):
map_file = temp_layermap_file
else:
self.logger.error("Unable to define map file.")

if tech_file is None:
if control_file is None:
temp_control_file = os.path.splitext(inputGDS)[0] + ".xml"
if os.path.isfile(temp_control_file):
control_file = temp_control_file
else:
self.logger.error("Unable to define control file.")

command = [anstranslator_full_path, inputGDS, f'-g="{map_file}"', f'-c="{control_file}"']
else:
command = [
anstranslator_full_path,
inputGDS,
f'-o="{control_file_temp}"' f'-t="{tech_file}"',
f'-g="{map_file}"',
f'-f="{layer_filter}"',
]

result = subprocess.run(command, capture_output=True, text=True, shell=True)
print(result.stdout)
print(command)
temp_inputGDS = inputGDS.split(".gds")[0]
self.edbpath = temp_inputGDS + ".aedb"
return self.open_edb()

def _create_extent(
self,
Expand Down

0 comments on commit afdf399

Please sign in to comment.