Skip to content

Commit 3539828

Browse files
REFACTOR: Refactor application init arguments (#4777)
Co-authored-by: maxcapodi78 <Shark78> Co-authored-by: Samuelopez-ansys <[email protected]>
1 parent d3aa856 commit 3539828

File tree

144 files changed

+1121
-2444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+1121
-2444
lines changed

_unittest/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ def _method(
199199
if not application:
200200
application = Hfss
201201
return application(
202-
projectname=test_project,
203-
designname=design_name,
202+
project=test_project,
203+
design=design_name,
204204
solution_type=solution_type,
205-
specified_version=desktop_version,
205+
version=desktop_version,
206206
non_graphical=NONGRAPHICAL,
207207
)
208208

_unittest/test_01_3dlayout_edb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import pytest
3030

3131
from pyaedt import Hfss3dLayout
32-
from pyaedt import is_linux
32+
from pyaedt.generic.settings import is_linux
3333

3434
test_subfolder = "T40"
3535
original_project_name = "ANSYS-HSD_V1"

_unittest/test_01_Design.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def test_34_force_project_path_disable(self):
390390
e = None
391391
exception_raised = False
392392
try:
393-
h = Hfss("c:/dummy/test.aedt", specified_version=desktop_version)
393+
h = Hfss("c:/dummy/test.aedt", version=desktop_version)
394394
except Exception as e:
395395
exception_raised = True
396396
assert e.args[0] == "Project doesn't exist. Check it and retry."
@@ -426,15 +426,15 @@ def test_36_test_load(self, add_app):
426426
with open(file_name2_lock, "w") as f:
427427
f.write(" ")
428428
try:
429-
hfss = Hfss(projectname=file_name2, specified_version=desktop_version)
429+
hfss = Hfss(project=file_name2, version=desktop_version)
430430
except Exception:
431431
assert True
432432
try:
433433
os.makedirs(os.path.join(self.local_scratch.path, "test_36_2.aedb"))
434434
file_name3 = os.path.join(self.local_scratch.path, "test_36_2.aedb", "edb.def")
435435
with open(file_name3, "w") as f:
436436
f.write(" ")
437-
hfss = Hfss3dLayout(projectname=file_name3, specified_version=desktop_version)
437+
hfss = Hfss3dLayout(project=file_name3, version=desktop_version)
438438
except Exception:
439439
assert True
440440

_unittest/test_01_downloads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import pytest
2929

3030
from pyaedt import downloads
31-
from pyaedt import is_linux
3231
from pyaedt.generic.general_methods import generate_unique_name
32+
from pyaedt.generic.settings import is_linux
3333

3434

3535
@pytest.fixture(scope="module", autouse=True)

_unittest/test_04_SBR.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from _unittest.conftest import desktop_version
3535
from _unittest.conftest import local_path
3636

37-
from pyaedt import is_linux
37+
from pyaedt.generic.settings import is_linux
3838

3939
if desktop_version > "2022.2":
4040
test_project_name = "Cassegrain_231"

_unittest/test_08_Primitives3D.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
from pyaedt import Icepak
3434
from pyaedt import Q2d
3535
from pyaedt import generate_unique_name
36-
from pyaedt import is_linux
3736
from pyaedt.generic.constants import AXIS
37+
from pyaedt.generic.settings import is_linux
3838
from pyaedt.modeler.cad.Primitives import PolylineSegment
3939
from pyaedt.modeler.cad.components_3d import UserDefinedComponent
4040
from pyaedt.modeler.cad.object3d import Object3d

_unittest/test_09_VariableManager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def test_15_arrays(self):
459459
assert self.aedtapp.variable_manager["getvalue2"].numeric_value == 1.0
460460

461461
def test_16_maxwell_circuit_variables(self):
462-
mc = MaxwellCircuit(specified_version=desktop_version)
462+
mc = MaxwellCircuit(version=desktop_version)
463463
mc["var2"] = "10mm"
464464
assert mc["var2"] == "10mm"
465465
v_circuit = mc.variable_manager

_unittest/test_11_Setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_01c_create_hfss_setup_auto_open(self):
101101
assert setup1.props["SolveType"] == "MultiFrequency"
102102

103103
def test_02_create_circuit_setup(self):
104-
circuit = Circuit(specified_version=desktop_version)
104+
circuit = Circuit(version=desktop_version)
105105
setup1 = circuit.create_setup("circuit", self.aedtapp.SETUPS.NexximLNA)
106106
assert setup1.name == "circuit"
107107
setup1.props["SweepDefinition"]["Data"] = "LINC 0GHz 4GHz 501"

_unittest/test_14_AedtLogger.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ def test_log_when_accessing_non_existing_object(self, caplog):
254254
from pyaedt import Hfss
255255

256256
app = Hfss(
257-
projectname="log_project",
258-
designname="log_design",
259-
specified_version=desktop_version,
260-
new_desktop_session=True,
257+
project="log_project",
258+
design="log_design",
259+
version=desktop_version,
260+
new_desktop=True,
261261
)
262262
with pytest.raises(AttributeError):
263263
app.get_object_material_properties("MS1", "conductivity")

_unittest/test_21_Circuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import pytest
3131

3232
from pyaedt import Circuit
33-
from pyaedt import is_linux
33+
from pyaedt.generic.settings import is_linux
3434

3535
test_subfolder = "T21"
3636

_unittest/test_22_Circuit_DynamicLink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
from pyaedt import Circuit
3232
from pyaedt import Q2d
3333
from pyaedt import Q3d
34-
from pyaedt import is_ironpython
35-
from pyaedt import is_linux
34+
from pyaedt.generic.general_methods import is_ironpython
35+
from pyaedt.generic.settings import is_linux
3636

3737
test_subfloder = "T22"
3838
test_project_name = "Dynamic_Link"

_unittest/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
import pytest
3333

34-
from pyaedt import settings
3534
from pyaedt.generic.general_methods import pyaedt_function_handler
35+
from pyaedt.generic.settings import settings
3636

3737
SETTINGS_RELEASE_ON_EXCEPTION = settings.release_on_exception
3838
SETTINGS_ENABLE_ERROR_HANDLER = settings.enable_error_handler

_unittest_solvers/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ def _method(
164164
if not application:
165165
application = Hfss
166166
return application(
167-
projectname=test_project,
168-
designname=design_name,
167+
project=test_project,
168+
design=design_name,
169169
solution_type=solution_type,
170-
specified_version=desktop_version,
170+
version=desktop_version,
171171
)
172172

173173
return _method

_unittest_solvers/test_00_analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from pathlib import Path
1212

13-
from pyaedt import is_linux
13+
from pyaedt.generic.settings import is_linux
1414
from pyaedt import Icepak
1515
from pyaedt import Hfss3dLayout
1616
from pyaedt import Circuit, Maxwell3d

_unittest_solvers/test_45_workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import shutil
44

55
import pyaedt
6-
from pyaedt import is_linux
6+
from pyaedt.generic.settings import is_linux
77
from _unittest.conftest import local_path
88
from _unittest_solvers.conftest import local_path as solver_local_path
99

examples/01-HFSS3DLayout/Dcir_in_3DLayout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
# Analysis DCIR in AEDT
9999
# ~~~~~~~~~~~~~~~~~~~~~
100100
# Launch AEDT and import the configured EDB and analysis DCIR
101-
desktop = pyaedt.Desktop(aedt_version, non_graphical=False, new_desktop_session=True)
101+
desktop = pyaedt.Desktop(aedt_version, non_graphical=False, new_desktop=True)
102102
hfss3dl = pyaedt.Hfss3dLayout(local_path)
103103
hfss3dl.analyze()
104104
hfss3dl.save_project()

examples/01-HFSS3DLayout/HFSS3DLayout_Via.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# ~~~~~~~~~~~
3333
# Launch AEDT 2023 R2 in graphical mode.
3434

35-
h3d = pyaedt.Hfss3dLayout(specified_version=aedt_version, new_desktop_session=True, non_graphical=non_graphical)
35+
h3d = pyaedt.Hfss3dLayout(version=aedt_version, new_desktop=True, non_graphical=non_graphical)
3636

3737
###############################################################################
3838
# Set up variables

examples/01-HFSS3DLayout/Hfss3DComponent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# ~~~~~~~~~~~
5353
# Launch HFSS application
5454

55-
hfss = pyaedt.Hfss(new_desktop_session=True, specified_version=aedt_version, non_graphical=non_graphical)
55+
hfss = pyaedt.Hfss(new_desktop=True, version=aedt_version, non_graphical=non_graphical)
5656

5757
hfss.solution_type = "Terminal"
5858

examples/01-Modeling-Setup/Configurations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555

5656
project_full_name = pyaedt.downloads.download_icepak(pyaedt.generate_unique_folder_name(folder_name="Graphic_Card"))
5757

58-
ipk = pyaedt.Icepak(projectname=project_full_name, specified_version=aedt_version,
59-
new_desktop_session=True, non_graphical=non_graphical)
58+
ipk = pyaedt.Icepak(project=project_full_name, version=aedt_version,
59+
new_desktop=True, non_graphical=non_graphical)
6060
ipk.autosave_disable()
6161

6262
###############################################################################
@@ -115,7 +115,7 @@
115115
# ~~~~~~~~~~~~~~
116116
# Create an Icepak project and import the step.
117117

118-
app = pyaedt.Icepak(projectname="new_proj_Ipk")
118+
app = pyaedt.Icepak(project="new_proj_Ipk")
119119
app.modeler.import_3d_cad(file_path)
120120

121121
###############################################################################

examples/01-Modeling-Setup/HFSS_CoordinateSystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3333
# Launch AEDT 2023 R2 in graphical mode.
3434

35-
d = pyaedt.launch_desktop(specified_version=aedt_version, non_graphical=non_graphical, new_desktop_session=True)
35+
d = pyaedt.launch_desktop(version=aedt_version, non_graphical=non_graphical, new_desktop=True)
3636

3737
###############################################################################
3838
# Insert HFSS design
3939
# ~~~~~~~~~~~~~~~~~~
4040
# Insert an HFSS design with the default name.
4141

42-
hfss = pyaedt.Hfss(projectname=pyaedt.generate_unique_project_name(folder_name="CoordSysDemo"))
42+
hfss = pyaedt.Hfss(project=pyaedt.generate_unique_project_name(folder_name="CoordSysDemo"))
4343

4444
###############################################################################
4545
# Create coordinate system

examples/01-Modeling-Setup/Optimetrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# Initialize the ``Hfss`` object and create two needed design variables,
3535
# ``w1`` and ``w2``.
3636

37-
hfss = pyaedt.Hfss(specified_version=aedt_version, new_desktop_session=True, non_graphical=non_graphical)
37+
hfss = pyaedt.Hfss(version=aedt_version, new_desktop=True, non_graphical=non_graphical)
3838
hfss["w1"] = "1mm"
3939
hfss["w2"] = "100mm"
4040

examples/01-Modeling-Setup/Polyline_Primitives.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
# ~~~~~~~~~~~~~~~~~~~~~~~~
3333
# Create a :class:`pyaedt.maxwell.Maxwell3d` object and set the unit type to ``"mm"``.
3434

35-
M3D = pyaedt.Maxwell3d(solution_type="Transient", designname="test_polyline_3D", specified_version=aedt_version,
36-
new_desktop_session=True, non_graphical=non_graphical, )
35+
M3D = pyaedt.Maxwell3d(solution_type="Transient", design="test_polyline_3D", version=aedt_version,
36+
new_desktop=True, non_graphical=non_graphical, )
3737
M3D.modeler.model_units = "mm"
3838
prim3D = M3D.modeler
3939

examples/02-HFSS/Array.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4141
# Launch HFSS and save the project.
4242
project_name = pyaedt.generate_unique_project_name(project_name="array")
43-
hfss = pyaedt.Hfss(projectname=project_name,
44-
specified_version=aedt_version,
45-
designname="Array_Simple",
43+
hfss = pyaedt.Hfss(project=project_name,
44+
version=aedt_version,
45+
design="Array_Simple",
4646
non_graphical=non_graphical,
47-
new_desktop_session=True)
47+
new_desktop=True)
4848

4949
print("Project name " + project_name)
5050

examples/02-HFSS/Create_3d_Component_and_use_it.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# PyAEDT can initialize a new session of Electronics Desktop or connect to an existing one.
3131
# Once Desktop is connected, a new HFSS session is started and a design is created.
3232

33-
hfss = Hfss(specified_version=aedt_version, new_desktop_session=True, close_on_exit=True)
33+
hfss = Hfss(version=aedt_version, new_desktop=True, close_on_exit=True)
3434

3535
##########################################################
3636
# Variables
@@ -100,7 +100,7 @@
100100
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
101101
# PyAEDT allows to control multiple projects, design and solution type at the same time.
102102

103-
hfss2 = Hfss(projectname="new_project", designname="new_design")
103+
hfss2 = Hfss(project="new_project", design="new_design")
104104

105105
##########################################################
106106
# Insert of 3d component

examples/02-HFSS/Flex_CPWG.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
# ~~~~~~~~~~~
3434
# Launch AEDT 2023 R2 in graphical mode.
3535

36-
hfss = pyaedt.Hfss(specified_version=aedt_version,
36+
hfss = pyaedt.Hfss(version=aedt_version,
3737
solution_type="DrivenTerminal",
38-
new_desktop_session=True,
38+
new_desktop=True,
3939
non_graphical=non_graphical)
4040
hfss.change_material_override(True)
4141
hfss.change_automatically_use_causal_materials(True)

examples/02-HFSS/HFSS_Choke.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
# ~~~~~~~~~~~
4444
# Launches HFSS 2023 R2 in graphical mode.
4545

46-
hfss = pyaedt.Hfss(projectname=project_name,
47-
specified_version=aedt_version,
46+
hfss = pyaedt.Hfss(project=project_name,
47+
version=aedt_version,
4848
non_graphical=non_graphical,
49-
new_desktop_session=True,
49+
new_desktop=True,
5050
solution_type="Terminal")
5151

5252
###############################################################################

examples/02-HFSS/HFSS_Dipole.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
# ~~~~~~~~~~~
3535
# Launch AEDT 2023 R2 in graphical mode.
3636

37-
d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop_session=True)
37+
d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop=True)
3838

3939
###############################################################################
4040
# Launch HFSS
4141
# ~~~~~~~~~~~
4242
# Launch HFSS 2023 R2 in graphical mode.
4343

44-
hfss = pyaedt.Hfss(projectname=project_name, solution_type="Modal")
44+
hfss = pyaedt.Hfss(project=project_name, solution_type="Modal")
4545

4646
###############################################################################
4747
# Define variable

examples/02-HFSS/HFSS_FSS_unitcell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
# ~~~~~~~~~~~
3535
# Launch AEDT 2023 R2 in graphical mode.
3636

37-
d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop_session=True)
37+
d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop=True)
3838

3939
###############################################################################
4040
# Launch HFSS
4141
# ~~~~~~~~~~~
4242
# Launch HFSS 2023 R2 in graphical mode.
4343

44-
hfss = pyaedt.Hfss(projectname=project_name, solution_type="Modal")
44+
hfss = pyaedt.Hfss(project=project_name, solution_type="Modal")
4545

4646
###############################################################################
4747
# Define variable

examples/02-HFSS/HFSS_Spiral.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
# Launch HFSS 2023 R2 in non-graphical mode and change the
3636
# units to microns.
3737

38-
hfss = pyaedt.Hfss(specified_version=aedt_version, non_graphical=non_graphical, designname="A1",
39-
new_desktop_session=True)
38+
hfss = pyaedt.Hfss(version=aedt_version, non_graphical=non_graphical, design="A1",
39+
new_desktop=True)
4040
hfss.solution_type = "Modal"
4141
hfss.modeler.model_units = "um"
4242
p = hfss.modeler

examples/02-HFSS/HFSS_eigenmode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@
5757
# ~~~~~~~~~~~
5858
# Launch AEDT 2023 R2 in graphical mode.
5959

60-
d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop_session=True)
60+
d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop=True)
6161

6262
###############################################################################
6363
# Launch HFSS
6464
# ~~~~~~~~~~~
6565
# Launch HFSS 2023 R2 in graphical mode.
6666

67-
hfss = pyaedt.Hfss(projectname=project_path, non_graphical=non_graphical)
67+
hfss = pyaedt.Hfss(project=project_path, non_graphical=non_graphical)
6868

6969
###############################################################################
7070
# Input parameters for eigenmode solver

examples/02-HFSS/Probe_Fed_Patch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
# -----------
6161
#
6262

63-
hfss = pyaedt.Hfss(projectname=proj_name,
63+
hfss = pyaedt.Hfss(project=proj_name,
6464
solution_type="Terminal",
65-
designname="patch",
65+
design="patch",
6666
non_graphical=non_graphical,
67-
new_desktop_session=True,
68-
specified_version=aedt_version)
67+
new_desktop=True,
68+
version=aedt_version)
6969

7070
hfss.modeler.model_units = length_units
7171

0 commit comments

Comments
 (0)