How to import a GDS #4133
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
How to import a GDS in HFSSYou will find two simple scripts below. With the first script you will have to specify:
In this script you will not be able to specify layer thickness, elevation and color. import pyaedt
import os
# Path to the aedt project directory
aedtpath = r'C:\Data\Support\HFSS3D'
# aedt file name
aedtfilename = "GDS_Import"
# aedt filename full path
aedtfilepath = os.path.join(aedtpath, aedtfilename)
# gds file full path
gds_path = r"C:\Data\GDS_Test.gds"
# list of gds number
gds_number = [1, 2, 3, 4, 5, 6]
# Version of AEDT to be used "2023.2" for 2023R2, "2024.1" for 2024R1
version = "2023.2"
hfss = pyaedt.Hfss(projectname=aedtfilepath, designname="HFSSDesign1", specified_version=version)
layermap = ["NAME:LayerMap"]
for i in gds_number:
layername = "signal" + str(i)
layermap.append(["NAME:LayerMapInfo", "LayerNum:=", i, "DestLayer:=", layername, "layer_type:=", "signal"])
# ImportMethod: 0 for script, 1for Parasolid
hfss.oeditor.ImportGDSII(
[
"NAME:options",
"FileName:=", gds_path,
"FlattenHierarchy:=", True,
"ImportMethod:=", 1,
layermap,
])
hfss.save_project()
hfss.release_desktop(close_projects=False, close_desktop=False)` With the second script you will have to specify:
In this script you will be able to specify layer thickness, elevation and color. import pyaedt
import os
# Path to the aedt project directory
aedtpath = r'C:\Data\Support\ST\Tours\HFSS3D'
# aedt file name
aedtfilename = "GDS_Import"
# aedt filename full path
aedtfilepath = os.path.join(aedtpath, aedtfilename)
# gds file full path
gds_path = r"C:\Data\Support\ST\Tours\GDS\PYAEDT_ex1.gds"
# list of gds number
gds_number = [1, 2, 3, 4, 5, 6]
# list of elevation for each GDS layer order must be the same as in gds_number list
elevation = [1E-4, 1.5E-4, 2E-4, 2.6E-4, 3.1E-4, 0]
# list of thickness for each GDS layer order must be the same as in gds_number list
thickness = [2E-05, 1.5E-05, 1E-05, 1E-05, 1E-05, 0]
# list of color for each GDS layer order must be the same as in gds_number list
color = ["yellow", "green", "aquamarine", "cyan", "steel blue", "gray"]
# Version of AEDT to be used "2023.2" for 2023R2, "2024.1" for 2024R1
version = "2023.2"
hfss = pyaedt.Hfss(projectname=aedtfilepath, designname="HFSSDesign1", specified_version=version)
if (len(gds_number) != len(elevation) or len(gds_number) != len(thickness) or len(gds_number) != len(color)):
hfss.logger.error("All list: gds_number, elevation, thickness, color must have the same number of element")
else:
layermap = ["NAME:LayerMap"]
ordermap = []
j = 0
for i in gds_number:
layername = "signal" + str(i)
layermap.append(["NAME:LayerMapInfo", "LayerNum:=", i, "DestLayer:=", layername, "layer_type:=", "signal"])
ordermap1 = ["entry:=", ["order:=", j, "layer:=", layername, "LayerNumber:=", i, "Thickness:=",
thickness[j], "Elevation:=", elevation[j], "Color:=", "color"]]
ordermap = ordermap + ordermap1
j = j + 1
# ImportMethod: 0 for script, 1for Parasolid
hfss.oeditor.ImportGDSII(
[
"NAME:options",
"FileName:=", gds_path,
"FlattenHierarchy:=", True,
"ImportMethod:=", 0,
layermap,
"OrderMap:=", ordermap,
])
hfss.save_project()
hfss.release_desktop(close_projects=False, close_desktop=False) |
Beta Was this translation helpful? Give feedback.
-
A pyaedt function for import GDSII in HFSS will be implmented and available in further pyaedt version |
Beta Was this translation helpful? Give feedback.
A pyaedt function for import GDSII in HFSS will be implmented and available in further pyaedt version