Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: import_gds_file #826

Merged
merged 18 commits into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading