Skip to content

Commit 169806a

Browse files
committed
Merge branch 'refs/heads/main' into release/0.17
2 parents 4b2c758 + adea30b commit 169806a

File tree

10 files changed

+40
-53
lines changed

10 files changed

+40
-53
lines changed

CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
* [Jonathan Velasco](https://github.com/jvela018)
6060
* [Jorge Martínez](https://github.com/jorgepiloto)
6161
* [Josh Salant](https://github.com/jsalant22)
62-
* [Karan Bhagat](https://github.com/kbhagat-ansys)
6362
* [Karan Bhagat](https://github.com/kbhagat2)
63+
* [Karan Bhagat](https://github.com/kbhagat-ansys)
6464
* [Kathy Pippert](https://github.com/PipKat)
6565
* [kmahajan-cadfem](https://github.com/kmahajan-cadfem)
6666
* [lollipop](https://github.com/cutelolly)

doc/changelog.d/6293.dependencies.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update grpcio requirement from <1.73,>=1.50.0 to >=1.50.0,<1.74

doc/changelog.d/6295.documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update ``contributors.md`` with the latest contributors

doc/changelog.d/6297.maintenance.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update changelog for v0.17.3

doc/changelog.d/6299.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Parametrics fix in add_from_file for maxwell

doc/changelog.d/6302.documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix url link after changes

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ classifiers = [
3535

3636
dependencies = [
3737
"fpdf2",
38-
"grpcio>=1.50.0,<1.73",
38+
"grpcio>=1.50.0,<1.74",
3939
"jsonschema",
4040
"psutil",
4141
"pyedb>=0.4.0; python_version == '3.7'",

src/ansys/aedt/core/extensions/project/configure_layout.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
EXTENSION_TITLE = "Configure Layout"
5656
GRID_PARAMS = {"padx": 10, "pady": 10}
5757

58-
INTRO_LINK = "https://aedt.docs.pyansys.com/version/stable/User_guide/pyaedt_extensions_doc/project/configure_edb.html"
58+
INTRO_LINK = (
59+
"https://aedt.docs.pyansys.com/version/stable/User_guide/pyaedt_extensions_doc/project/configure_layout.html"
60+
)
5961
GUIDE_LINK = "https://examples.aedt.docs.pyansys.com/version/dev/examples/00_edb/use_configuration/index.html"
6062

6163

src/ansys/aedt/core/modules/design_xploration.py

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import copy
2626
import csv
27+
from pathlib import Path
2728
from typing import Any
2829
from typing import Dict
2930
from typing import Optional
@@ -1078,75 +1079,52 @@ def delete(self, name):
10781079

10791080
@pyaedt_function_handler(filename="input_file", parametricname="name")
10801081
def add_from_file(self, input_file, name=None):
1081-
"""Add a Parametric Setup from a csv file.
1082+
"""Add a Parametric setup from either a csv or txt file.
10821083
10831084
Parameters
10841085
----------
10851086
input_file : str
1086-
Csv file path.
1087+
``.csv`` or ``.txt`` file path.
10871088
name : str, option
10881089
Name of parametric setup.
10891090
10901091
Returns
10911092
-------
10921093
bool
1093-
`True` if the import is executed correctly.
1094+
``True`` if the import is executed correctly. ``False`` if it failed.
10941095
"""
10951096
if not name:
10961097
name = generate_unique_name("Parametric")
10971098
setup = SetupParam(self._app, name, optim_type="OptiParametric")
10981099
setup.auto_update = False
10991100
setup.props["Sim. Setups"] = [setup_defined.name for setup_defined in self._app.setups]
1101+
1102+
file_path = Path(input_file)
1103+
if file_path.suffix not in [".csv", ".txt"]:
1104+
raise ValueError("Input file must be a CSV or TXT file.")
1105+
11001106
with open_file(input_file, "r") as csvfile:
11011107
csvreader = csv.DictReader(csvfile)
11021108
first_data_line = next(csvreader)
1103-
setup.props["Sweeps"] = {"SweepDefinition": {}}
1104-
sweep_definition = []
1105-
for var_name in csvreader.fieldnames:
1106-
if var_name != "*":
1107-
sweep_definition.append(
1108-
{
1109-
"Variable": var_name,
1110-
"Data": first_data_line[var_name],
1111-
"OffsetF1": False,
1112-
"Synchronize": 0,
1113-
}
1114-
)
1115-
setup.props["Sweeps"]["SweepDefinition"] = sweep_definition
1116-
1117-
args = ["NAME:" + name]
1118-
_dict2arg(setup.props, args)
1119-
1120-
setup.props["Sweep Operations"] = {"add": []}
1121-
table = []
1122-
for var_name in csvreader.fieldnames:
1123-
if var_name != "*":
1124-
table.append(first_data_line[var_name])
1125-
table = [table]
1126-
for line in csvreader:
1127-
table_line = []
1128-
for var_name in csvreader.fieldnames:
1129-
if var_name != "*":
1130-
table_line.append(line[var_name])
1131-
table.append(table_line)
1132-
1133-
if len(table) > 1:
1134-
for point in table[1:]:
1135-
setup.props["Sweep Operations"]["add"].append(point)
1136-
1137-
cont = 0
1138-
for data in args:
1139-
if isinstance(data, list) and "NAME:Sweep Operations" in data:
1140-
del args[cont]
1141-
args.append(["NAME:Sweep Operations"])
1142-
break
1143-
cont += 1
1144-
1145-
for variation in setup.props["Sweep Operations"].get("add", []):
1146-
args[-1].append("add:=")
1147-
args[-1].append(variation)
1148-
1149-
self.optimodule.InsertSetup("OptiParametric", args)
1109+
sweep_definition = [
1110+
{
1111+
"Variable": var_name,
1112+
"Data": first_data_line[var_name],
1113+
"OffsetF1": False,
1114+
"Synchronize": 0,
1115+
}
1116+
for var_name in csvreader.fieldnames
1117+
if var_name != "*"
1118+
]
1119+
setup.props["Sweeps"] = {"SweepDefinition": sweep_definition}
1120+
1121+
table = [[line[var_name] for var_name in csvreader.fieldnames if var_name != "*"] for line in csvreader]
1122+
if table:
1123+
setup.props["Sweep Operations"] = {"add": table}
1124+
1125+
args = ["NAME:" + name, input_file]
1126+
self.optimodule.ImportSetup("OptiParametric", args)
1127+
11501128
self.setups.append(setup)
11511129
return True
11521130

tests/system/general/test_11_Setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ def test_25a_create_parametrics(self):
240240
assert self.aedtapp.parametrics.add_from_file(
241241
os.path.join(self.local_scratch.path, "test.csv"), "ParametricsfromFile"
242242
)
243+
with pytest.raises(ValueError):
244+
self.aedtapp.parametrics.add_from_file("test.invalid", "ParametricsfromFile")
243245
oo = self.aedtapp.get_oo_object(self.aedtapp.odesign, r"Optimetrics\ParametricsfromFile")
244246
assert oo
245247
assert self.aedtapp.parametrics.delete("ParametricsfromFile")

0 commit comments

Comments
 (0)