-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path03_gui_manipulation.py
89 lines (60 loc) · 2.12 KB
/
03_gui_manipulation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# # User interface modification
#
# This example shows how to modify the 3D Layout user interface.
# <img src="_static/user_interface.png" width="600">
#
# Keywords: **HFSS 3D Layout**, **User interface**.
# # Preparation
# Import required packages
# +
import tempfile
import time
from ansys.aedt.core import Hfss3dLayout
from ansys.aedt.core.downloads import download_file
# -
# Set constant values
AEDT_VERSION = "2024.2"
NUM_CORES = 4
NG_MODE = False # Open Electronics UI when the application is launched.
# Download example board.
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name)
# ## Launch HFSS 3D Layout
#
# Initialize AEDT and launch HFSS 3D Layout.
h3d = Hfss3dLayout(aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True)
h3d.save_project()
# ## Net visibility
# Hide all nets.
h3d.modeler.change_net_visibility(visible=False)
# Show two specified nets.
h3d.modeler.change_net_visibility(["5V", "1V0"], visible=True)
# Show all layers.
for layer in h3d.modeler.layers.all_signal_layers:
layer.is_visible = True
# Change the layer color.
layer = h3d.modeler.layers.layers[h3d.modeler.layers.layer_id("1_Top")]
layer.set_layer_color(0, 255, 0)
h3d.modeler.fit_all()
# ## Disable component visibility
# Disable component visibility for ``"1_Top"`` and ``"16_Bottom"`` layers.
top = h3d.modeler.layers.layers[h3d.modeler.layers.layer_id("1_Top")]
top.is_visible_component = False
bot = h3d.modeler.layers.layers[h3d.modeler.layers.layer_id("16_Bottom")]
bot.is_visible_component = False
# ## Display the Layout
#
# Fit all so that you can visualize all.
h3d.modeler.fit_all()
# ## Release AEDT
h3d.save_project()
h3d.release_desktop()
# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory.
time.sleep(3)
# ## Cleanup
#
# All project files are saved in the folder ``temp_dir.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.
temp_folder.cleanup()