Skip to content

Commit

Permalink
Merge pull request #182 from ansys/run_toolkit_2024_grpc
Browse files Browse the repository at this point in the history
Update 2024 GRPC
  • Loading branch information
Samuelopez-ansys authored Oct 27, 2023
2 parents c2ff274 + 3652dac commit 5dc1e02
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/ansys/aedt/toolkits/antenna/run_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,28 @@ def run_command(*command):
# User can pass the desktop ID and version to connect to a specific AEDT session
desktop_pid = None
desktop_version = None
if len(sys.argv) == 3:
grpc = False

if "PYAEDT_SCRIPT_VERSION" in list(os.environ.keys()) and (
"PYAEDT_SCRIPT_PROCESS_ID" in list(os.environ.keys()) or "PYAEDT_SCRIPT_PORT" in list(os.environ.keys())
):
desktop_version = os.environ["PYAEDT_SCRIPT_VERSION"]
if desktop_version > "2023.2" or is_linux:
# GRPC Default
desktop_pid = os.environ["PYAEDT_SCRIPT_PORT"]
grpc = True
else:
# COM Default
desktop_pid = os.environ["PYAEDT_SCRIPT_PROCESS_ID"]
elif len(sys.argv) == 3:
desktop_pid = sys.argv[1]
desktop_version = sys.argv[2]
elif "PYAEDT_SCRIPT_VERSION" in list(os.environ.keys()) and "PYAEDT_SCRIPT_PROCESS_ID" in list(os.environ.keys()):
desktop_pid = os.environ["PYAEDT_SCRIPT_PROCESS_ID"]
desktop_version = os.environ["PYAEDT_SCRIPT_VERSION"]

if desktop_pid and desktop_version:
properties = {
"selected_process": int(desktop_pid),
"aedt_version": desktop_version,
"use_grpc": False,
"use_grpc": grpc,
}
requests.put(url_call + "/set_properties", json=properties)
requests.post(url_call + "/launch_aedt")
Expand Down

0 comments on commit 5dc1e02

Please sign in to comment.