You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The legacy Ironpython included a command for HasMatrixData.
From HFSS scripting Guide:
..
HasMatrixData
Determines if matrix data exists for a particular solution.
UI Access: N/A
Parameters:
Name Type Description
String Name of specified solution.
String Design variation.
Return Value: Integer (1 - True, 0 - False).
...
This is missing in PyAEDT. Can you add this command to PyAEDT?
Steps To Reproduce
File > Open Examples and add 3D Layout Design: Diff_Via.eadt
Solve design: HFSS > Analyze All
Save the solve project to D:\scrtach\test2 (or similar if you cnage the script project location)
Add a new sweep to "HFSS Setup 1" for a discrete single frequency at 5GHz. (Don't solve this sweep
The script is suppsoed to check the two sweeps and report if it has matrix data or not, i.e. if it is a solved or not.
I tried some code as a work-around, but it is messy.
script.py:
-----------------------------------
import time
import ansys.aedt.core
ansys.aedt.core.settings.enable_logger = False # disable PyAEDT logging
ansys.aedt.core.settings.logger_file_path # prevent logging to a file
ansys.aedt.core.settings.log_level = "ERROR" # suppress INFO messages
from ansys.aedt.core import Hfss3dLayout
data_path = r"D:\scratch\test2\" # folder containing this script and AEDT projects
ansys.aedt.core.settings.enable_logger = True # enable PyAEDT logging
h3d.logger.info("This is a Global test")
the following command should clear the Message Manager, but it did not work
#h3d.logger.clear_messages(level=3)
alternate method to force deleting all messages from the Message Manager
def clear_aedt_messages(level):
# clear the aedt message manager
oDesktop = h3d._desktop
oDesktop.ClearMessages("", "", level)
print("All messages have been cleared from the HFSS 3D Layout Message Manager.")
print("level = " + str(level))
# Allow time for changes to take effect
time.sleep(1)
def print_all_messages():
"""Print all messages from the Message Manager."""
try:
oDesktop = h3d._desktop
messages = oDesktop.GetMessages("", "", 0)
print("Messages in the Message Manager:")
for msg in messages:
print(msg)
except Exception as e:
print(f"Failed to retrieve messages: {e}")
check if solution exists and report in the Message Manager for Global Messages
if data != False:
HasMatrixData = 1 # the design has matrix data
output_string = "The solution exists for the solution: HFSS Setup 1 : Sweep 1"
h3d.logger.info(output_string)
output_string = "HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
else:
h3d.logger.info("** No Solution Data Exists **")
HasMatrixData = 0 # the design does not have matrix data
output_string = "The solution does not exists for the solution: HFSS Setup 1 : Sweep 1"
h3d.logger.info(output_string)
output_string = "HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
check if solution exists and report in the Message Manager for Global Messages
if data2 != False:
HasMatrixData = 1 # the design has matrix data
output_string = "The solution exists for the solution: HFSS Setup 1 : Sweep 2"
h3d.logger.info(output_string)
output_string = "For this case, HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
else:
h3d.logger.info("** No Solution Data Exists **")
HasMatrixData = 0 # the design does not have matrix data
output_string = "The solution does not exists for the solution: HFSS Setup 1 : Sweep2"
h3d.logger.info(output_string)
output_string = "HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
#h3d.analyze()
Before submitting the issue
Description of the bug
The legacy Ironpython included a command for HasMatrixData.
From HFSS scripting Guide:
..
HasMatrixData
Determines if matrix data exists for a particular solution.
UI Access: N/A
Parameters:
Name Type Description
String Name of specified solution.
String Design variation.
Return Value: Integer (1 - True, 0 - False).
...
This is missing in PyAEDT. Can you add this command to PyAEDT?
Steps To Reproduce
File > Open Examples and add 3D Layout Design: Diff_Via.eadt
Solve design: HFSS > Analyze All
Save the solve project to D:\scrtach\test2 (or similar if you cnage the script project location)
Add a new sweep to "HFSS Setup 1" for a discrete single frequency at 5GHz. (Don't solve this sweep
The script is suppsoed to check the two sweeps and report if it has matrix data or not, i.e. if it is a solved or not.
I tried some code as a work-around, but it is messy.
script.py:
-----------------------------------
import time
import ansys.aedt.core
ansys.aedt.core.settings.enable_logger = False # disable PyAEDT logging
ansys.aedt.core.settings.logger_file_path # prevent logging to a file
ansys.aedt.core.settings.log_level = "ERROR" # suppress INFO messages
from ansys.aedt.core import Hfss3dLayout
data_path = r"D:\scratch\test2\" # folder containing this script and AEDT projects
project name
project_name1 = "Diff_Via"
design name
design_name1 = "diffViaNominal"
h3d = Hfss3dLayout(
version="2024.2",
non_graphical=False,
new_desktop=True,
close_on_exit=True,
student_version=False,
project=data_path + project_name1 + ".aedt",
design=design_name1
)
h3d.modeler.fit_all()
print a test message
ansys.aedt.core.settings.enable_logger = True # enable PyAEDT logging
h3d.logger.info("This is a Global test")
the following command should clear the Message Manager, but it did not work
#h3d.logger.clear_messages(level=3)
alternate method to force deleting all messages from the Message Manager
def clear_aedt_messages(level):
# clear the aedt message manager
oDesktop = h3d._desktop
oDesktop.ClearMessages("", "", level)
print("All messages have been cleared from the HFSS 3D Layout Message Manager.")
print("level = " + str(level))
# Allow time for changes to take effect
time.sleep(1)
def print_all_messages():
"""Print all messages from the Message Manager."""
try:
oDesktop = h3d._desktop
messages = oDesktop.GetMessages("", "", 0)
print("Messages in the Message Manager:")
for msg in messages:
print(msg)
except Exception as e:
print(f"Failed to retrieve messages: {e}")
clear_aedt_messages(3)
ansys.aedt.core.settings.enable_logger = False # disable PyAEDT logging
check to see if solutions exist
data = h3d.post.get_solution_data(
"dB(S(Port1:T1,Port1:T1))",
'HFSS Setup 1 : Sweep 1',
)
ansys.aedt.core.settings.enable_logger = True # enable PyAEDT logging
check if solution exists and report in the Message Manager for Global Messages
if data != False:
HasMatrixData = 1 # the design has matrix data
output_string = "The solution exists for the solution: HFSS Setup 1 : Sweep 1"
h3d.logger.info(output_string)
output_string = "HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
else:
h3d.logger.info("** No Solution Data Exists **")
HasMatrixData = 0 # the design does not have matrix data
output_string = "The solution does not exists for the solution: HFSS Setup 1 : Sweep 1"
h3d.logger.info(output_string)
output_string = "HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
check to see if solutions exist
try:
data2 = h3d.post.get_solution_data("dB(S(Port1:T1,Port1:T1))",'HFSS Setup 1 : Sweep2',)
except Exception as e:
print("Error occured: {e}, skipping...")
return_flag1 = 1
print("return error for this case` (Pass) = " + str(data2) + "\n")
check if solution exists and report in the Message Manager for Global Messages
if data2 != False:
HasMatrixData = 1 # the design has matrix data
output_string = "The solution exists for the solution: HFSS Setup 1 : Sweep 2"
h3d.logger.info(output_string)
output_string = "For this case, HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
else:
h3d.logger.info("** No Solution Data Exists **")
HasMatrixData = 0 # the design does not have matrix data
output_string = "The solution does not exists for the solution: HFSS Setup 1 : Sweep2"
h3d.logger.info(output_string)
output_string = "HasMatrixData = " + str(HasMatrixData)
h3d.logger.info(output_string)
#h3d.analyze()
print all messages
print_all_messages()
-----------------------------------
Which Operating System are you using?
Windows
Which Python version are you using?
3.10
Installed packages
(3_10) C:\Users\jrsherma\AppData\Roaming.pyaedt_env\3_10\Scripts>python -m pip freeze
aiohappyeyeballs==2.4.6
aiohttp==3.11.12
aiosignal==1.3.2
annotated-types==0.7.0
ansys-pythonnet==3.1.0rc6
ansys-tools-visualization-interface==0.8.1
anyio==4.8.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.4
async-timeout==5.0.1
attrs==24.2.0
babel==2.17.0
beautifulsoup4==4.13.3
bleach==6.2.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
clr_loader==0.2.7.post0
colorama==0.4.6
comm==0.2.2
contourpy==1.3.1
cycler==0.12.1
debugpy==1.8.12
decorator==5.1.1
defusedxml==0.7.1
et_xmlfile==2.0.0
exceptiongroup==1.2.2
executing==2.2.0
fast_simplification==0.1.9
fastjsonschema==2.21.1
fonttools==4.56.0
fpdf2==2.8.2
fqdn==1.5.1
frozenlist==1.5.0
geopandas==1.0.1
grpcio==1.70.0
h11==0.14.0
httpcore==1.0.7
httpx==0.28.1
idna==3.10
imageio==2.37.0
ipycanvas==0.13.3
ipyevents==2.0.2
ipykernel==6.29.5
ipython==8.32.0
ipython-genutils==0.2.0
ipyvtklink==0.2.3
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.5
joblib==1.4.2
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyterlab==4.3.5
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.8
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.10.0
matplotlib-inline==0.1.7
mdurl==0.1.2
meshio==5.3.5
mistune==3.1.1
more-itertools==10.6.0
MouseInfo==0.1.3
msgpack==1.1.0
multidict==6.1.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
networkx==3.4.2
notebook==7.3.2
notebook_shim==0.2.4
numpy==2.2.3
openpyxl==3.1.5
osmnx==2.0.1
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pillow==11.1.0
platformdirs==4.3.6
plumbum==1.9.0
pooch==1.8.2
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.2.1
psutil==7.0.0
pure_eval==0.2.3
pyaedt==0.14.1
PyAutoGUI==0.9.54
pycparser==2.22
pydantic==2.10.6
pydantic_core==2.27.2
pyedb==0.37.0
PyGetWindow==0.0.9
Pygments==2.19.1
PyMsgBox==1.0.9
pynput==1.8.0
pyogrio==0.10.0
pyparsing==3.2.1
pyperclip==1.9.0
pyproj==3.7.1
PyRect==0.2.0
PyScreeze==1.0.1
python-dateutil==2.9.0.post0
python-json-logger==3.2.1
pytweening==1.2.0
pytz==2025.1
pyvista==0.44.2
pywin32==308
pywinpty==2.0.15
PyYAML==6.0.2
pyzmq==26.2.1
referencing==0.35.1
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==13.9.4
rpds-py==0.22.3
rpyc==6.0.1
Rtree==1.3.0
scikit-learn==1.6.1
scikit-rf==1.5.0
scipy==1.15.2
scooby==0.10.0
Send2Trash==1.8.3
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
threadpoolctl==3.5.0
tinycss2==1.4.0
toml==0.10.2
tomli==2.2.1
tomli_w==1.2.0
tornado==6.4.2
traitlets==5.14.3
trame==3.8.0
trame-client==3.5.2
trame-server==3.3.0
trame-vtk==2.8.15
trame-vuetify==2.8.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.12.2
tzdata==2025.1
uri-template==1.3.0
urllib3==2.3.0
vtk==9.3.1
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==14.2
widgetsnbextension==3.6.10
wslink==2.2.2
yarl==1.18.3
The text was updated successfully, but these errors were encountered: