diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d368033e733..e7f00ace9ff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -64,6 +64,14 @@ repos: hooks: - id: check-pre-commit-ci-config +- repo: https://github.com/ansys/pre-commit-hooks + rev: v0.3.1 + hooks: + - id: add-license-headers + files: '(pyaedt|examples|_unittest|_unittest_ironpython|_unittest_solvers)/.*\.(py)' + args: + - --custom_template=mit_license.jinja2 + - --start_year=2021 # - repo: https://github.com/numpy/numpydoc # rev: v1.6.0 diff --git a/.reuse/templates/mit_license.jinja2 b/.reuse/templates/mit_license.jinja2 new file mode 100644 index 00000000000..06fc58439b5 --- /dev/null +++ b/.reuse/templates/mit_license.jinja2 @@ -0,0 +1,29 @@ +-*- coding: utf-8 -*- + +{% for copyright_line in copyright_lines %} +{{ copyright_line }} +{% endfor %} +{% for expression in spdx_expressions %} +SPDX-License-Identifier: {{ expression }} +{% endfor %} + + +{% if "MIT" in spdx_expressions %} +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +{% endif %} diff --git a/LICENSE b/LICENSE index a9d9a2ef7eb..6a949e7fd8c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,13 @@ MIT License -Copyright (c) 2021 ANSYS, Inc. All rights reserved. +Copyright (c) 2021 - 2024 ANSYS, Inc. and/or its affiliates. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. diff --git a/_unittest/__init__.py b/_unittest/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/_unittest/__init__.py +++ b/_unittest/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/_unittest/conftest.py b/_unittest/conftest.py index c65f120585c..aa4dbb3f73a 100644 --- a/_unittest/conftest.py +++ b/_unittest/conftest.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ Unit Test Configuration Module ------------------------------- @@ -175,10 +199,10 @@ def _method( if not application: application = Hfss return application( - projectname=test_project, - designname=design_name, + project=test_project, + design=design_name, solution_type=solution_type, - specified_version=desktop_version, + version=desktop_version, non_graphical=NONGRAPHICAL, ) diff --git a/_unittest/test_01_3dlayout_edb.py b/_unittest/test_01_3dlayout_edb.py index 3bcab9a0c07..3feb99fe27c 100644 --- a/_unittest/test_01_3dlayout_edb.py +++ b/_unittest/test_01_3dlayout_edb.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import config @@ -5,7 +29,7 @@ import pytest from pyaedt import Hfss3dLayout -from pyaedt import is_linux +from pyaedt.generic.settings import is_linux test_subfolder = "T40" original_project_name = "ANSYS-HSD_V1" diff --git a/_unittest/test_01_Design.py b/_unittest/test_01_Design.py index 5b59215d671..68a06aa48da 100644 --- a/_unittest/test_01_Design.py +++ b/_unittest/test_01_Design.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import tempfile @@ -221,6 +245,8 @@ def test_19_create_project_dataset(self): assert self.aedtapp.dataset_exists("Test_DataSet", is_project_dataset=True) assert ds2.delete() assert not self.aedtapp.dataset_exists("Test_DataSet", is_project_dataset=True) + ds3 = self.aedtapp.create_dataset1d_project("Test_DataSet2", x, y, sort=False) + assert ds3.name == "$Test_DataSet2" def test_19_create_3dproject_dataset(self): x = [1, 100] @@ -230,6 +256,9 @@ def test_19_create_3dproject_dataset(self): vunits = "cel" ds3 = self.aedtapp.create_dataset3d("Test_DataSet3D", x, y, z, v, v_unit=vunits) assert ds3.name == "$Test_DataSet3D" + ds3.sort = False + ds3.v = [50, 200] + assert ds3.update() ds30 = self.aedtapp.create_dataset3d("Test_DataSet3D1", x, y, z, v, v_unit=vunits, is_project_dataset=False) assert ds30.name == "$Test_DataSet3D1" ds31 = self.aedtapp.create_dataset3d("$Test_DataSet3D2", x, y, z, v, v_unit=vunits, is_project_dataset=False) @@ -361,7 +390,7 @@ def test_34_force_project_path_disable(self): e = None exception_raised = False try: - h = Hfss("c:/dummy/test.aedt", specified_version=desktop_version) + h = Hfss("c:/dummy/test.aedt", version=desktop_version) except Exception as e: exception_raised = True assert e.args[0] == "Project doesn't exist. Check it and retry." @@ -397,7 +426,7 @@ def test_36_test_load(self, add_app): with open(file_name2_lock, "w") as f: f.write(" ") try: - hfss = Hfss(projectname=file_name2, specified_version=desktop_version) + hfss = Hfss(project=file_name2, version=desktop_version) except Exception: assert True try: @@ -405,7 +434,7 @@ def test_36_test_load(self, add_app): file_name3 = os.path.join(self.local_scratch.path, "test_36_2.aedb", "edb.def") with open(file_name3, "w") as f: f.write(" ") - hfss = Hfss3dLayout(projectname=file_name3, specified_version=desktop_version) + hfss = Hfss3dLayout(project=file_name3, version=desktop_version) except Exception: assert True diff --git a/_unittest/test_01_GeometryOperators.py b/_unittest/test_01_GeometryOperators.py index cd1e88f3ec9..9ec435b2464 100644 --- a/_unittest/test_01_GeometryOperators.py +++ b/_unittest/test_01_GeometryOperators.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math import pytest diff --git a/_unittest/test_01_configuration_files.py b/_unittest/test_01_configuration_files.py index b369e0b6130..b2cbcf3e2d2 100644 --- a/_unittest/test_01_configuration_files.py +++ b/_unittest/test_01_configuration_files.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # standard imports import json import os diff --git a/_unittest/test_01_downloads.py b/_unittest/test_01_downloads.py index f8d1b71a447..66f89601a2c 100644 --- a/_unittest/test_01_downloads.py +++ b/_unittest/test_01_downloads.py @@ -1,11 +1,35 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import tempfile import pytest from pyaedt import downloads -from pyaedt import is_linux from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.settings import is_linux @pytest.fixture(scope="module", autouse=True) diff --git a/_unittest/test_01_general_methods.py b/_unittest/test_01_general_methods.py index 6b53e40f0ca..d8e3e5ab8f8 100644 --- a/_unittest/test_01_general_methods.py +++ b/_unittest/test_01_general_methods.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import pytest from pyaedt.generic.DataHandlers import str_to_bool diff --git a/_unittest/test_01_report_file_parser.py b/_unittest/test_01_report_file_parser.py index 5241f2f1c29..aa046f0f63e 100644 --- a/_unittest/test_01_report_file_parser.py +++ b/_unittest/test_01_report_file_parser.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import pytest diff --git a/_unittest/test_01_toolkit_icons.py b/_unittest/test_01_toolkit_icons.py index 99922aa102d..303eb3c23a8 100644 --- a/_unittest/test_01_toolkit_icons.py +++ b/_unittest/test_01_toolkit_icons.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import defusedxml.ElementTree as ET diff --git a/_unittest/test_02_2D_modeler.py b/_unittest/test_02_2D_modeler.py index ce1a6d1a416..49cb7175fb6 100644 --- a/_unittest/test_02_2D_modeler.py +++ b/_unittest/test_02_2D_modeler.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # standard imports import filecmp import math diff --git a/_unittest/test_02_3D_modeler.py b/_unittest/test_02_3D_modeler.py index e5004ff86a7..e9e4ef510ec 100644 --- a/_unittest/test_02_3D_modeler.py +++ b/_unittest/test_02_3D_modeler.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import random from _unittest.conftest import config diff --git a/_unittest/test_03_Materials.py b/_unittest/test_03_Materials.py index 6cece448949..3779bdae18d 100644 --- a/_unittest/test_03_Materials.py +++ b/_unittest/test_03_Materials.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import config diff --git a/_unittest/test_04_SBR.py b/_unittest/test_04_SBR.py index 0bdf8a10593..56848e82877 100644 --- a/_unittest/test_04_SBR.py +++ b/_unittest/test_04_SBR.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import pytest @@ -10,7 +34,7 @@ from _unittest.conftest import desktop_version from _unittest.conftest import local_path -from pyaedt import is_linux +from pyaedt.generic.settings import is_linux if desktop_version > "2022.2": test_project_name = "Cassegrain_231" diff --git a/_unittest/test_05_Mesh.py b/_unittest/test_05_Mesh.py index fe73eb8ebce..03c6399ce62 100644 --- a/_unittest/test_05_Mesh.py +++ b/_unittest/test_05_Mesh.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest.conftest import config from _unittest.conftest import desktop_version import pytest diff --git a/_unittest/test_06_MessageManager.py b/_unittest/test_06_MessageManager.py index dbe9fda245d..c85d7c41082 100644 --- a/_unittest/test_06_MessageManager.py +++ b/_unittest/test_06_MessageManager.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import logging import os.path diff --git a/_unittest/test_07_Object3D.py b/_unittest/test_07_Object3D.py index 40f5e03a47a..1fe9aada249 100644 --- a/_unittest/test_07_Object3D.py +++ b/_unittest/test_07_Object3D.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math import pytest diff --git a/_unittest/test_08_Primitives3D.py b/_unittest/test_08_Primitives3D.py index 1c047ab5be3..3d34aabf3fa 100644 --- a/_unittest/test_08_Primitives3D.py +++ b/_unittest/test_08_Primitives3D.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import sys import time @@ -9,8 +33,8 @@ from pyaedt import Icepak from pyaedt import Q2d from pyaedt import generate_unique_name -from pyaedt import is_linux from pyaedt.generic.constants import AXIS +from pyaedt.generic.settings import is_linux from pyaedt.modeler.cad.Primitives import PolylineSegment from pyaedt.modeler.cad.components_3d import UserDefinedComponent from pyaedt.modeler.cad.object3d import Object3d diff --git a/_unittest/test_09_Primitives2D.py b/_unittest/test_09_Primitives2D.py index e448859e878..b688ede2849 100644 --- a/_unittest/test_09_Primitives2D.py +++ b/_unittest/test_09_Primitives2D.py @@ -1,4 +1,29 @@ #!/ekm/software/anaconda3/bin/python + +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import pytest from pyaedt import Maxwell2d diff --git a/_unittest/test_09_VariableManager.py b/_unittest/test_09_VariableManager.py index b4a14e4493c..23844f3a5c1 100644 --- a/_unittest/test_09_VariableManager.py +++ b/_unittest/test_09_VariableManager.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import division # noreorder import math @@ -435,7 +459,7 @@ def test_15_arrays(self): assert self.aedtapp.variable_manager["getvalue2"].numeric_value == 1.0 def test_16_maxwell_circuit_variables(self): - mc = MaxwellCircuit(specified_version=desktop_version) + mc = MaxwellCircuit(version=desktop_version) mc["var2"] = "10mm" assert mc["var2"] == "10mm" v_circuit = mc.variable_manager diff --git a/_unittest/test_11_Setup.py b/_unittest/test_11_Setup.py index b97a6c8a584..5ac553f8e5f 100644 --- a/_unittest/test_11_Setup.py +++ b/_unittest/test_11_Setup.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import desktop_version @@ -77,7 +101,7 @@ def test_01c_create_hfss_setup_auto_open(self): assert setup1.props["SolveType"] == "MultiFrequency" def test_02_create_circuit_setup(self): - circuit = Circuit(specified_version=desktop_version) + circuit = Circuit(version=desktop_version) setup1 = circuit.create_setup("circuit", self.aedtapp.SETUPS.NexximLNA) assert setup1.name == "circuit" setup1.props["SweepDefinition"]["Data"] = "LINC 0GHz 4GHz 501" diff --git a/_unittest/test_12_1_PostProcessing.py b/_unittest/test_12_1_PostProcessing.py index 45382124944..6efb2d9ba49 100644 --- a/_unittest/test_12_1_PostProcessing.py +++ b/_unittest/test_12_1_PostProcessing.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import sys import uuid diff --git a/_unittest/test_12_PostProcessing.py b/_unittest/test_12_PostProcessing.py index c3539714afc..c3ccee930ae 100644 --- a/_unittest/test_12_PostProcessing.py +++ b/_unittest/test_12_PostProcessing.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import sys diff --git a/_unittest/test_13_LoadAEDTFile.py b/_unittest/test_13_LoadAEDTFile.py index 32dae828262..256260eb42f 100644 --- a/_unittest/test_13_LoadAEDTFile.py +++ b/_unittest/test_13_LoadAEDTFile.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import base64 import filecmp import os diff --git a/_unittest/test_14_AedtLogger.py b/_unittest/test_14_AedtLogger.py index 09f246b13ec..ba8900b741a 100644 --- a/_unittest/test_14_AedtLogger.py +++ b/_unittest/test_14_AedtLogger.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import io import logging import os @@ -230,10 +254,10 @@ def test_log_when_accessing_non_existing_object(self, caplog): from pyaedt import Hfss app = Hfss( - projectname="log_project", - designname="log_design", - specified_version=desktop_version, - new_desktop_session=True, + project="log_project", + design="log_design", + version=desktop_version, + new_desktop=True, ) with pytest.raises(AttributeError): app.get_object_material_properties("MS1", "conductivity") diff --git a/_unittest/test_15_ibs_reader.py b/_unittest/test_15_ibs_reader.py index e1d5453dacb..0fa6de41c51 100644 --- a/_unittest/test_15_ibs_reader.py +++ b/_unittest/test_15_ibs_reader.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import local_path diff --git a/_unittest/test_16_3d_stackup.py b/_unittest/test_16_3d_stackup.py index 0a503983b66..9250fdd7dea 100644 --- a/_unittest/test_16_3d_stackup.py +++ b/_unittest/test_16_3d_stackup.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import pytest diff --git a/_unittest/test_20_HFSS.py b/_unittest/test_20_HFSS.py index a05a76b49e9..48ffe2c4f37 100644 --- a/_unittest/test_20_HFSS.py +++ b/_unittest/test_20_HFSS.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math import os import shutil diff --git a/_unittest/test_21_Circuit.py b/_unittest/test_21_Circuit.py index 23b44ed622e..f342e63d75d 100644 --- a/_unittest/test_21_Circuit.py +++ b/_unittest/test_21_Circuit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import time @@ -6,7 +30,7 @@ import pytest from pyaedt import Circuit -from pyaedt import is_linux +from pyaedt.generic.settings import is_linux test_subfolder = "T21" diff --git a/_unittest/test_22_Circuit_DynamicLink.py b/_unittest/test_22_Circuit_DynamicLink.py index 4756805a3b9..37891b77d86 100644 --- a/_unittest/test_22_Circuit_DynamicLink.py +++ b/_unittest/test_22_Circuit_DynamicLink.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import config @@ -7,8 +31,8 @@ from pyaedt import Circuit from pyaedt import Q2d from pyaedt import Q3d -from pyaedt import is_ironpython -from pyaedt import is_linux +from pyaedt.generic.general_methods import is_ironpython +from pyaedt.generic.settings import is_linux test_subfloder = "T22" test_project_name = "Dynamic_Link" diff --git a/_unittest/test_27_Maxwell2D.py b/_unittest/test_27_Maxwell2D.py index 39f36dae04a..d19bd64ce6b 100644 --- a/_unittest/test_27_Maxwell2D.py +++ b/_unittest/test_27_Maxwell2D.py @@ -1,4 +1,29 @@ #!/ekm/software/anaconda3/bin/python + +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict import os import shutil diff --git a/_unittest/test_28_Maxwell3D.py b/_unittest/test_28_Maxwell3D.py index d60dbd56748..5b744c5f442 100644 --- a/_unittest/test_28_Maxwell3D.py +++ b/_unittest/test_28_Maxwell3D.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import shutil diff --git a/_unittest/test_29_Mechanical.py b/_unittest/test_29_Mechanical.py index c353a1d505d..d00903202b2 100644 --- a/_unittest/test_29_Mechanical.py +++ b/_unittest/test_29_Mechanical.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import shutil diff --git a/_unittest/test_30_Q2D.py b/_unittest/test_30_Q2D.py index e0157b7daeb..53a4e41c8f9 100644 --- a/_unittest/test_30_Q2D.py +++ b/_unittest/test_30_Q2D.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import config diff --git a/_unittest/test_32_RMxprt.py b/_unittest/test_32_RMxprt.py index 97ffb03a56d..a6883dcd807 100644 --- a/_unittest/test_32_RMxprt.py +++ b/_unittest/test_32_RMxprt.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import pytest diff --git a/_unittest/test_34_TwinBuilder.py b/_unittest/test_34_TwinBuilder.py index b7714db35ef..27103b11947 100644 --- a/_unittest/test_34_TwinBuilder.py +++ b/_unittest/test_34_TwinBuilder.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import NONGRAPHICAL diff --git a/_unittest/test_35_MaxwellCircuit.py b/_unittest/test_35_MaxwellCircuit.py index 1e4b627bb86..a13e7bd1360 100644 --- a/_unittest/test_35_MaxwellCircuit.py +++ b/_unittest/test_35_MaxwellCircuit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import local_path diff --git a/_unittest/test_36_Q2D_PostProcessing.py b/_unittest/test_36_Q2D_PostProcessing.py index 6a50e6feb4e..7c0e58d8076 100644 --- a/_unittest/test_36_Q2D_PostProcessing.py +++ b/_unittest/test_36_Q2D_PostProcessing.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import config diff --git a/_unittest/test_37_Genetic_Algorithm.py b/_unittest/test_37_Genetic_Algorithm.py index a0b382abc80..323eed56c4a 100644 --- a/_unittest/test_37_Genetic_Algorithm.py +++ b/_unittest/test_37_Genetic_Algorithm.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import random import time diff --git a/_unittest/test_41_3dlayout_modeler.py b/_unittest/test_41_3dlayout_modeler.py index d6c27b2c59a..bbc425e938e 100644 --- a/_unittest/test_41_3dlayout_modeler.py +++ b/_unittest/test_41_3dlayout_modeler.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import tempfile import time diff --git a/_unittest/test_43_CableModeling.py b/_unittest/test_43_CableModeling.py index ea2430f4cb0..a200d51ce64 100644 --- a/_unittest/test_43_CableModeling.py +++ b/_unittest/test_43_CableModeling.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import config diff --git a/_unittest/test_44_TouchstoneParser.py b/_unittest/test_44_TouchstoneParser.py index a7ed22c3ff8..45fb945c164 100644 --- a/_unittest/test_44_TouchstoneParser.py +++ b/_unittest/test_44_TouchstoneParser.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import local_path diff --git a/_unittest/test_98_Icepak.py b/_unittest/test_98_Icepak.py index da96f58c87f..c08a88edf5c 100644 --- a/_unittest/test_98_Icepak.py +++ b/_unittest/test_98_Icepak.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from _unittest.conftest import config diff --git a/_unittest/test_launch_desktop.py b/_unittest/test_launch_desktop.py index 37e928cbdf6..6f1e464321c 100644 --- a/_unittest/test_launch_desktop.py +++ b/_unittest/test_launch_desktop.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest.conftest import config import pytest diff --git a/_unittest/test_utils.py b/_unittest/test_utils.py index a87c0010036..397d493630d 100644 --- a/_unittest/test_utils.py +++ b/_unittest/test_utils.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Test utility functions of PyAEDT. """ @@ -7,8 +31,8 @@ import pytest -from pyaedt import settings from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.settings import settings SETTINGS_RELEASE_ON_EXCEPTION = settings.release_on_exception SETTINGS_ENABLE_ERROR_HANDLER = settings.enable_error_handler diff --git a/_unittest/test_warnings.py b/_unittest/test_warnings.py index 7a2c7b1bec4..a1ba7badbb7 100644 --- a/_unittest/test_warnings.py +++ b/_unittest/test_warnings.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import sys from unittest.mock import patch import warnings diff --git a/_unittest_solvers/conftest.py b/_unittest_solvers/conftest.py index 6d581605884..29a6b3b864f 100644 --- a/_unittest_solvers/conftest.py +++ b/_unittest_solvers/conftest.py @@ -164,10 +164,10 @@ def _method( if not application: application = Hfss return application( - projectname=test_project, - designname=design_name, + project=test_project, + design=design_name, solution_type=solution_type, - specified_version=desktop_version, + version=desktop_version, ) return _method diff --git a/_unittest_solvers/test_00_analyze.py b/_unittest_solvers/test_00_analyze.py index f90439b07d2..7d892d7f718 100644 --- a/_unittest_solvers/test_00_analyze.py +++ b/_unittest_solvers/test_00_analyze.py @@ -10,7 +10,7 @@ from pathlib import Path -from pyaedt import is_linux +from pyaedt.generic.settings import is_linux from pyaedt import Icepak from pyaedt import Hfss3dLayout from pyaedt import Circuit, Maxwell3d @@ -108,7 +108,13 @@ def init(self, local_scratch, icepak_app, hfss3dl_solve): @pytest.mark.skipif(is_linux or sys.version_info < (3, 8), reason="Not supported.") def test_01a_sbr_link_array(self, sbr_platform, array): assert sbr_platform.create_sbr_linked_antenna(array, target_cs="antenna_CS", field_type="farfield") - sbr_platform.analyze(cores=6) + profile = sbr_platform.setups[0].get_profile() + assert profile is None + sbr_platform.analyze(cores=4) + profile = sbr_platform.setups[0].get_profile() + assert isinstance(profile, dict) + assert not sbr_platform.get_profile("Invented_setup") + ffdata = sbr_platform.get_antenna_ffd_solution_data(frequencies=12e9, sphere="3D") ffdata2 = sbr_platform.get_antenna_ffd_solution_data(frequencies=12e9, sphere="3D", overwrite=False) @@ -176,7 +182,7 @@ def test_02_hfss_export_results(self, hfss_app): setup.props["Frequency"] = "1GHz" exported_files = hfss_app.export_results() assert len(exported_files) == 0 - hfss_app.analyze_setup(name="test", cores=6) + hfss_app.analyze_setup(name="test", cores=4) exported_files = hfss_app.export_results() assert len(exported_files) == 39 exported_files = hfss_app.export_results( @@ -214,7 +220,7 @@ def test_03a_icepak_analyze_and_export_summary(self): monitor_quantity=["Temperature", "HeatFlowRate"], monitor_name="test_monitor2", ) - self.icepak_app.analyze("SetupIPK", cores=6) + self.icepak_app.analyze("SetupIPK", cores=4) self.icepak_app.save_project() assert self.icepak_app.export_summary( self.icepak_app.working_directory, geometryType="Surface", variationlist=[], filename="A" @@ -321,14 +327,14 @@ def test_04a_3dl_generate_mesh(self): @pytest.mark.skipif(desktop_version < "2023.2", reason="Working only from 2023 R2") def test_04b_3dl_analyze_setup(self): - assert self.hfss3dl_solve.analyze_setup("Setup1", cores=6, blocking=False) + assert self.hfss3dl_solve.analyze_setup("Setup1", cores=4, blocking=False) assert self.hfss3dl_solve.are_there_simulations_running assert self.hfss3dl_solve.stop_simulations() while self.hfss3dl_solve.are_there_simulations_running: time.sleep(1) def test_04c_3dl_analyze_setup(self): - assert self.hfss3dl_solve.analyze_setup("Setup1", cores=6) + assert self.hfss3dl_solve.analyze_setup("Setup1", cores=4) self.hfss3dl_solve.save_project() assert os.path.exists(self.hfss3dl_solve.export_profile("Setup1")) assert os.path.exists(self.hfss3dl_solve.export_mesh_stats("Setup1")) @@ -406,13 +412,13 @@ def test_06_m3d_harmonic_forces(self, m3dtransient): use_number_of_last_cycles=True, last_cycles_number=3, calculate_force="Harmonic") m3dtransient.save_project() - m3dtransient.analyze(m3dtransient.active_setup, cores=2, use_auto_settings=False) + m3dtransient.analyze(m3dtransient.active_setup, cores=4, use_auto_settings=False) assert m3dtransient.export_element_based_harmonic_force(start_frequency=1, stop_frequency=100, number_of_frequency=None) assert m3dtransient.export_element_based_harmonic_force(number_of_frequency=5) def test_07_export_maxwell_fields(self, m3dtransient): - m3dtransient.analyze(m3dtransient.active_setup, cores=2, use_auto_settings=False) + m3dtransient.analyze(m3dtransient.active_setup, cores=4, use_auto_settings=False) fld_file_3 = os.path.join(self.local_scratch.path, "test_fld_3.fld") assert m3dtransient.post.export_field_file(quantity="Mag_B", solution=m3dtransient.nominal_sweep, variations={}, output_dir=fld_file_3, assignment="Coil_A2", objects_type="Surf", diff --git a/_unittest_solvers/test_45_workflows.py b/_unittest_solvers/test_45_workflows.py index c9e9adc713b..e3c5cac074d 100644 --- a/_unittest_solvers/test_45_workflows.py +++ b/_unittest_solvers/test_45_workflows.py @@ -3,7 +3,7 @@ import shutil import pyaedt -from pyaedt import is_linux +from pyaedt.generic.settings import is_linux from _unittest.conftest import local_path from _unittest_solvers.conftest import local_path as solver_local_path diff --git a/examples/01-HFSS3DLayout/Dcir_in_3DLayout.py b/examples/01-HFSS3DLayout/Dcir_in_3DLayout.py index 1d50229b835..50937948d9d 100644 --- a/examples/01-HFSS3DLayout/Dcir_in_3DLayout.py +++ b/examples/01-HFSS3DLayout/Dcir_in_3DLayout.py @@ -98,7 +98,7 @@ # Analysis DCIR in AEDT # ~~~~~~~~~~~~~~~~~~~~~ # Launch AEDT and import the configured EDB and analysis DCIR -desktop = pyaedt.Desktop(aedt_version, non_graphical=False, new_desktop_session=True) +desktop = pyaedt.Desktop(aedt_version, non_graphical=False, new_desktop=True) hfss3dl = pyaedt.Hfss3dLayout(local_path) hfss3dl.analyze() hfss3dl.save_project() diff --git a/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py b/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py index 483e06aa081..8bc57f40882 100644 --- a/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py +++ b/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py @@ -32,7 +32,7 @@ # ~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode. -h3d = pyaedt.Hfss3dLayout(specified_version=aedt_version, new_desktop_session=True, non_graphical=non_graphical) +h3d = pyaedt.Hfss3dLayout(version=aedt_version, new_desktop=True, non_graphical=non_graphical) ############################################################################### # Set up variables diff --git a/examples/01-HFSS3DLayout/Hfss3DComponent.py b/examples/01-HFSS3DLayout/Hfss3DComponent.py index daeb0177ae3..ad29c9bc499 100644 --- a/examples/01-HFSS3DLayout/Hfss3DComponent.py +++ b/examples/01-HFSS3DLayout/Hfss3DComponent.py @@ -52,7 +52,7 @@ # ~~~~~~~~~~~ # Launch HFSS application -hfss = pyaedt.Hfss(new_desktop_session=True, specified_version=aedt_version, non_graphical=non_graphical) +hfss = pyaedt.Hfss(new_desktop=True, version=aedt_version, non_graphical=non_graphical) hfss.solution_type = "Terminal" diff --git a/examples/01-Modeling-Setup/Configurations.py b/examples/01-Modeling-Setup/Configurations.py index 34fd7b1eedb..ee397799237 100644 --- a/examples/01-Modeling-Setup/Configurations.py +++ b/examples/01-Modeling-Setup/Configurations.py @@ -55,8 +55,8 @@ project_full_name = pyaedt.downloads.download_icepak(pyaedt.generate_unique_folder_name(folder_name="Graphic_Card")) -ipk = pyaedt.Icepak(projectname=project_full_name, specified_version=aedt_version, - new_desktop_session=True, non_graphical=non_graphical) +ipk = pyaedt.Icepak(project=project_full_name, version=aedt_version, + new_desktop=True, non_graphical=non_graphical) ipk.autosave_disable() ############################################################################### @@ -115,7 +115,7 @@ # ~~~~~~~~~~~~~~ # Create an Icepak project and import the step. -app = pyaedt.Icepak(projectname="new_proj_Ipk") +app = pyaedt.Icepak(project="new_proj_Ipk") app.modeler.import_3d_cad(file_path) ############################################################################### diff --git a/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py b/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py index da40f1b1d3c..bafa2513ab6 100644 --- a/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py +++ b/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py @@ -32,14 +32,14 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode. -d = pyaedt.launch_desktop(specified_version=aedt_version, non_graphical=non_graphical, new_desktop_session=True) +d = pyaedt.launch_desktop(version=aedt_version, non_graphical=non_graphical, new_desktop=True) ############################################################################### # Insert HFSS design # ~~~~~~~~~~~~~~~~~~ # Insert an HFSS design with the default name. -hfss = pyaedt.Hfss(projectname=pyaedt.generate_unique_project_name(folder_name="CoordSysDemo")) +hfss = pyaedt.Hfss(project=pyaedt.generate_unique_project_name(folder_name="CoordSysDemo")) ############################################################################### # Create coordinate system diff --git a/examples/01-Modeling-Setup/Optimetrics.py b/examples/01-Modeling-Setup/Optimetrics.py index 2e3143e9e94..7ebb12b1d39 100644 --- a/examples/01-Modeling-Setup/Optimetrics.py +++ b/examples/01-Modeling-Setup/Optimetrics.py @@ -34,7 +34,7 @@ # Initialize the ``Hfss`` object and create two needed design variables, # ``w1`` and ``w2``. -hfss = pyaedt.Hfss(specified_version=aedt_version, new_desktop_session=True, non_graphical=non_graphical) +hfss = pyaedt.Hfss(version=aedt_version, new_desktop=True, non_graphical=non_graphical) hfss["w1"] = "1mm" hfss["w2"] = "100mm" diff --git a/examples/01-Modeling-Setup/Polyline_Primitives.py b/examples/01-Modeling-Setup/Polyline_Primitives.py index 3d91003ffd6..869fa62b32f 100644 --- a/examples/01-Modeling-Setup/Polyline_Primitives.py +++ b/examples/01-Modeling-Setup/Polyline_Primitives.py @@ -32,8 +32,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~ # Create a :class:`pyaedt.maxwell.Maxwell3d` object and set the unit type to ``"mm"``. -M3D = pyaedt.Maxwell3d(solution_type="Transient", designname="test_polyline_3D", specified_version=aedt_version, - new_desktop_session=True, non_graphical=non_graphical, ) +M3D = pyaedt.Maxwell3d(solution_type="Transient", design="test_polyline_3D", version=aedt_version, + new_desktop=True, non_graphical=non_graphical, ) M3D.modeler.model_units = "mm" prim3D = M3D.modeler diff --git a/examples/02-HFSS/Array.py b/examples/02-HFSS/Array.py index 57db00411d4..6226fc58fc1 100644 --- a/examples/02-HFSS/Array.py +++ b/examples/02-HFSS/Array.py @@ -40,11 +40,11 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Launch HFSS and save the project. project_name = pyaedt.generate_unique_project_name(project_name="array") -hfss = pyaedt.Hfss(projectname=project_name, - specified_version=aedt_version, - designname="Array_Simple", +hfss = pyaedt.Hfss(project=project_name, + version=aedt_version, + design="Array_Simple", non_graphical=non_graphical, - new_desktop_session=True) + new_desktop=True) print("Project name " + project_name) diff --git a/examples/02-HFSS/Create_3d_Component_and_use_it.py b/examples/02-HFSS/Create_3d_Component_and_use_it.py index d04c7c6480d..20e10cfb9d1 100644 --- a/examples/02-HFSS/Create_3d_Component_and_use_it.py +++ b/examples/02-HFSS/Create_3d_Component_and_use_it.py @@ -30,7 +30,7 @@ # PyAEDT can initialize a new session of Electronics Desktop or connect to an existing one. # Once Desktop is connected, a new HFSS session is started and a design is created. -hfss = Hfss(specified_version=aedt_version, new_desktop_session=True, close_on_exit=True) +hfss = Hfss(version=aedt_version, new_desktop=True, close_on_exit=True) ########################################################## # Variables @@ -100,7 +100,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # PyAEDT allows to control multiple projects, design and solution type at the same time. -hfss2 = Hfss(projectname="new_project", designname="new_design") +hfss2 = Hfss(project="new_project", design="new_design") ########################################################## # Insert of 3d component diff --git a/examples/02-HFSS/Flex_CPWG.py b/examples/02-HFSS/Flex_CPWG.py index 90b5e26d3a8..b69b0267d9b 100644 --- a/examples/02-HFSS/Flex_CPWG.py +++ b/examples/02-HFSS/Flex_CPWG.py @@ -33,9 +33,9 @@ # ~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode. -hfss = pyaedt.Hfss(specified_version=aedt_version, +hfss = pyaedt.Hfss(version=aedt_version, solution_type="DrivenTerminal", - new_desktop_session=True, + new_desktop=True, non_graphical=non_graphical) hfss.change_material_override(True) hfss.change_automatically_use_causal_materials(True) diff --git a/examples/02-HFSS/HFSS_Choke.py b/examples/02-HFSS/HFSS_Choke.py index cfdc790d040..90d0699617b 100644 --- a/examples/02-HFSS/HFSS_Choke.py +++ b/examples/02-HFSS/HFSS_Choke.py @@ -43,10 +43,10 @@ # ~~~~~~~~~~~ # Launches HFSS 2023 R2 in graphical mode. -hfss = pyaedt.Hfss(projectname=project_name, - specified_version=aedt_version, +hfss = pyaedt.Hfss(project=project_name, + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, solution_type="Terminal") ############################################################################### diff --git a/examples/02-HFSS/HFSS_Dipole.py b/examples/02-HFSS/HFSS_Dipole.py index 99d0d31aabd..d6585e37ae8 100644 --- a/examples/02-HFSS/HFSS_Dipole.py +++ b/examples/02-HFSS/HFSS_Dipole.py @@ -34,14 +34,14 @@ # ~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode. -d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop_session=True) +d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop=True) ############################################################################### # Launch HFSS # ~~~~~~~~~~~ # Launch HFSS 2023 R2 in graphical mode. -hfss = pyaedt.Hfss(projectname=project_name, solution_type="Modal") +hfss = pyaedt.Hfss(project=project_name, solution_type="Modal") ############################################################################### # Define variable diff --git a/examples/02-HFSS/HFSS_FSS_unitcell.py b/examples/02-HFSS/HFSS_FSS_unitcell.py index 182ea23c047..6c0768dc67f 100644 --- a/examples/02-HFSS/HFSS_FSS_unitcell.py +++ b/examples/02-HFSS/HFSS_FSS_unitcell.py @@ -34,14 +34,14 @@ # ~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode. -d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop_session=True) +d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop=True) ############################################################################### # Launch HFSS # ~~~~~~~~~~~ # Launch HFSS 2023 R2 in graphical mode. -hfss = pyaedt.Hfss(projectname=project_name, solution_type="Modal") +hfss = pyaedt.Hfss(project=project_name, solution_type="Modal") ############################################################################### # Define variable diff --git a/examples/02-HFSS/HFSS_Spiral.py b/examples/02-HFSS/HFSS_Spiral.py index 4ba80a21c52..37a591f0edc 100644 --- a/examples/02-HFSS/HFSS_Spiral.py +++ b/examples/02-HFSS/HFSS_Spiral.py @@ -35,8 +35,8 @@ # Launch HFSS 2023 R2 in non-graphical mode and change the # units to microns. -hfss = pyaedt.Hfss(specified_version=aedt_version, non_graphical=non_graphical, designname="A1", - new_desktop_session=True) +hfss = pyaedt.Hfss(version=aedt_version, non_graphical=non_graphical, design="A1", + new_desktop=True) hfss.solution_type = "Modal" hfss.modeler.model_units = "um" p = hfss.modeler diff --git a/examples/02-HFSS/HFSS_eigenmode.py b/examples/02-HFSS/HFSS_eigenmode.py index c7de9106ab5..a770bd22d62 100644 --- a/examples/02-HFSS/HFSS_eigenmode.py +++ b/examples/02-HFSS/HFSS_eigenmode.py @@ -57,14 +57,14 @@ # ~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode. -d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop_session=True) +d = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop=True) ############################################################################### # Launch HFSS # ~~~~~~~~~~~ # Launch HFSS 2023 R2 in graphical mode. -hfss = pyaedt.Hfss(projectname=project_path, non_graphical=non_graphical) +hfss = pyaedt.Hfss(project=project_path, non_graphical=non_graphical) ############################################################################### # Input parameters for eigenmode solver diff --git a/examples/02-HFSS/Probe_Fed_Patch.py b/examples/02-HFSS/Probe_Fed_Patch.py index 626620508bf..1409fe0e4f0 100644 --- a/examples/02-HFSS/Probe_Fed_Patch.py +++ b/examples/02-HFSS/Probe_Fed_Patch.py @@ -60,12 +60,12 @@ # ----------- # -hfss = pyaedt.Hfss(projectname=proj_name, +hfss = pyaedt.Hfss(project=proj_name, solution_type="Terminal", - designname="patch", + design="patch", non_graphical=non_graphical, - new_desktop_session=True, - specified_version=aedt_version) + new_desktop=True, + version=aedt_version) hfss.modeler.model_units = length_units diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index 163f893c281..092f17f9e0c 100644 --- a/examples/02-HFSS/Waveguide_Filter.py +++ b/examples/02-HFSS/Waveguide_Filter.py @@ -61,11 +61,11 @@ project_name = os.path.join(project_folder, general_methods.generate_unique_name("wgf", n=2)) # Instantiate the HFSS application -hfss = pyaedt.Hfss(projectname=project_name + '.aedt', - specified_version=aedt_version, - designname="filter", +hfss = pyaedt.Hfss(project=project_name + '.aedt', + version=aedt_version, + design="filter", non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, solution_type="Modal") diff --git a/examples/02-SBR+/SBR_City_Import.py b/examples/02-SBR+/SBR_City_Import.py index 2b727fea10c..818733d24d0 100644 --- a/examples/02-SBR+/SBR_City_Import.py +++ b/examples/02-SBR+/SBR_City_Import.py @@ -35,10 +35,10 @@ # Each design is connected to a different object. app = Hfss( - designname="Ansys", + design="Ansys", solution_type="SBR+", - specified_version=aedt_version, - new_desktop_session=True, + version=aedt_version, + new_desktop=True, non_graphical=non_graphical ) diff --git a/examples/02-SBR+/SBR_Doppler_Example.py b/examples/02-SBR+/SBR_Doppler_Example.py index 2e92b5f1cce..f5e7a68a7b0 100644 --- a/examples/02-SBR+/SBR_Doppler_Example.py +++ b/examples/02-SBR+/SBR_Doppler_Example.py @@ -45,10 +45,10 @@ # Instantiate the application. app = pyaedt.Hfss( - specified_version=aedt_version, + version=aedt_version, solution_type="SBR+", - new_desktop_session=True, - projectname=project_name, + new_desktop=True, + project=project_name, close_on_exit=True, non_graphical=non_graphical ) diff --git a/examples/02-SBR+/SBR_Example.py b/examples/02-SBR+/SBR_Example.py index ca5e2ed1c13..41e6f8a16a1 100644 --- a/examples/02-SBR+/SBR_Example.py +++ b/examples/02-SBR+/SBR_Example.py @@ -37,17 +37,17 @@ # a different object. target = pyaedt.Hfss( - projectname=project_full_name, - designname="Cassegrain_", + project=project_full_name, + design="Cassegrain_", solution_type="SBR+", - specified_version=aedt_version, - new_desktop_session=True, + version=aedt_version, + new_desktop=True, non_graphical=non_graphical ) -source = pyaedt.Hfss(projectname=target.project_name, - designname="feeder", - specified_version=aedt_version, +source = pyaedt.Hfss(project=target.project_name, + design="feeder", + version=aedt_version, ) ############################################################################### diff --git a/examples/02-SBR+/SBR_Time_Plot.py b/examples/02-SBR+/SBR_Time_Plot.py index 6384ef137ff..94d6c625e0f 100644 --- a/examples/02-SBR+/SBR_Time_Plot.py +++ b/examples/02-SBR+/SBR_Time_Plot.py @@ -35,7 +35,7 @@ project_file = downloads.download_sbr_time() -hfss = Hfss(projectname=project_file, specified_version=aedt_version, non_graphical=non_graphical, new_desktop_session=True) +hfss = Hfss(project=project_file, version=aedt_version, non_graphical=non_graphical, new_desktop=True) hfss.analyze() diff --git a/examples/03-Maxwell/Maxwell2D_DCConduction.py b/examples/03-Maxwell/Maxwell2D_DCConduction.py index 2b9828647ae..7a693c8f97f 100644 --- a/examples/03-Maxwell/Maxwell2D_DCConduction.py +++ b/examples/03-Maxwell/Maxwell2D_DCConduction.py @@ -26,12 +26,12 @@ # ``Maxwell2d`` class named ``m2d``. m2d = pyaedt.Maxwell2d( - specified_version=aedt_version, - new_desktop_session=True, + version=aedt_version, + new_desktop=True, close_on_exit=True, solution_type="DCConduction", - projectname="M2D_DC_Conduction", - designname="Ansys_resistor" + project="M2D_DC_Conduction", + design="Ansys_resistor" ) ########################################################## diff --git a/examples/03-Maxwell/Maxwell2D_Electrostatic.py b/examples/03-Maxwell/Maxwell2D_Electrostatic.py index 3f044ffd9bc..f9866f34186 100644 --- a/examples/03-Maxwell/Maxwell2D_Electrostatic.py +++ b/examples/03-Maxwell/Maxwell2D_Electrostatic.py @@ -66,11 +66,11 @@ # ~~~~~~~~~~~~~~~~~ # Launch Maxwell 2D and save the project. -M2D = pyaedt.Maxwell2d(projectname=project_name, - specified_version=aedt_version, - designname=design_name, +M2D = pyaedt.Maxwell2d(project=project_name, + version=aedt_version, + design=design_name, solution_type=solver, - new_desktop_session=True, + new_desktop=True, non_graphical=non_graphical ) diff --git a/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py b/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py index 4435be7cc96..4d0d80e04b9 100644 --- a/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py +++ b/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py @@ -123,11 +123,11 @@ # ~~~~~~~~~~~~~~~~~ # Launch Maxwell 2D and save the project. -M2D = pyaedt.Maxwell2d(projectname=project_name, - specified_version=aedt_version, - designname=design_name, +M2D = pyaedt.Maxwell2d(project=project_name, + version=aedt_version, + design=design_name, solution_type=solver, - new_desktop_session=True, + new_desktop=True, non_graphical=non_graphical ) diff --git a/examples/03-Maxwell/Maxwell2D_Transformer_LL.py b/examples/03-Maxwell/Maxwell2D_Transformer_LL.py index c31e708102c..7137bcee552 100644 --- a/examples/03-Maxwell/Maxwell2D_Transformer_LL.py +++ b/examples/03-Maxwell/Maxwell2D_Transformer_LL.py @@ -30,10 +30,10 @@ solver = "MagnetostaticXY" desktop_version = "2024.1" -m2d = Maxwell2d(specified_version=desktop_version, - new_desktop_session=False, - designname=design_name, - projectname=project_name, +m2d = Maxwell2d(version=desktop_version, + new_desktop=False, + design=design_name, + project=project_name, solution_type=solver, non_graphical=non_graphical) diff --git a/examples/03-Maxwell/Maxwell2D_Transient.py b/examples/03-Maxwell/Maxwell2D_Transient.py index d92c6f87247..f9b14ceff37 100644 --- a/examples/03-Maxwell/Maxwell2D_Transient.py +++ b/examples/03-Maxwell/Maxwell2D_Transient.py @@ -54,8 +54,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Insert a Maxwell 2D design and save the project. -maxwell_2d = pyaedt.Maxwell2d(solution_type="TransientXY", specified_version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True, projectname=pyaedt.generate_unique_project_name()) +maxwell_2d = pyaedt.Maxwell2d(solution_type="TransientXY", version=aedt_version, non_graphical=non_graphical, + new_desktop=True, project=pyaedt.generate_unique_project_name()) ############################################################################### # Create rectangle and duplicate it diff --git a/examples/03-Maxwell/Maxwell3DTeam7.py b/examples/03-Maxwell/Maxwell3DTeam7.py index 436ca8f3382..68fccd5ca7e 100644 --- a/examples/03-Maxwell/Maxwell3DTeam7.py +++ b/examples/03-Maxwell/Maxwell3DTeam7.py @@ -50,12 +50,12 @@ solver = "EddyCurrent" m3d = Maxwell3d( - projectname=project_name, - designname=design_name, + project=project_name, + design=design_name, solution_type=solver, - specified_version=aedt_version, + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True + new_desktop=True ) m3d.modeler.model_units = "mm" diff --git a/examples/03-Maxwell/Maxwell3D_Choke.py b/examples/03-Maxwell/Maxwell3D_Choke.py index e6f59c608a0..8b19f350943 100644 --- a/examples/03-Maxwell/Maxwell3D_Choke.py +++ b/examples/03-Maxwell/Maxwell3D_Choke.py @@ -40,11 +40,11 @@ # ~~~~~~~~~~~~~~~~ # Launch Maxwell 3D 2023 R2 in graphical mode. -m3d = pyaedt.Maxwell3d(projectname=pyaedt.generate_unique_project_name(), +m3d = pyaedt.Maxwell3d(project=pyaedt.generate_unique_project_name(), solution_type="EddyCurrent", - specified_version=aedt_version, + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True + new_desktop=True ) ############################################################################### diff --git a/examples/03-Maxwell/Maxwell3D_Segmentation.py b/examples/03-Maxwell/Maxwell3D_Segmentation.py index 49956cd9f90..fa38433ff52 100644 --- a/examples/03-Maxwell/Maxwell3D_Segmentation.py +++ b/examples/03-Maxwell/Maxwell3D_Segmentation.py @@ -48,9 +48,9 @@ # ~~~~~~~~~~~~~~~~~ # Launch Maxwell 3D. -m3d = Maxwell3d(projectname=aedt_file, - specified_version=aedt_version, - new_desktop_session=True, +m3d = Maxwell3d(project=aedt_file, + version=aedt_version, + new_desktop=True, non_graphical=non_graphical) ################################################################################## diff --git a/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py b/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py index 67cc322a43d..ee7a9933280 100644 --- a/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py +++ b/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py @@ -48,12 +48,12 @@ solver = "EddyCurrent" m3d = pyaedt.Maxwell3d( - projectname=project_name, - designname=design_name, + project=project_name, + design=design_name, solution_type=solver, - specified_version=aedt_version, + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, ) m3d.modeler.model_units = "mm" diff --git a/examples/03-Maxwell/Maxwell_Control_Program.py b/examples/03-Maxwell/Maxwell_Control_Program.py index 035f1f8db69..cace045c035 100644 --- a/examples/03-Maxwell/Maxwell_Control_Program.py +++ b/examples/03-Maxwell/Maxwell_Control_Program.py @@ -13,7 +13,7 @@ # Perform required imports. from pyaedt import downloads -from pyaedt import generate_unique_folder_name +from pyaedt.generic.general_methods import generate_unique_folder_name from pyaedt import Maxwell2d ########################################################## @@ -44,9 +44,9 @@ # ~~~~~~~~~~~~~~~~~ # Launch Maxwell 2D. -m2d = Maxwell2d(projectname=aedt_file, - specified_version=aedt_version, - new_desktop_session=True, +m2d = Maxwell2d(project=aedt_file, + version=aedt_version, + new_desktop=True, non_graphical=non_graphical) ################################################################################## diff --git a/examples/03-Maxwell/Maxwell_Magnet.py b/examples/03-Maxwell/Maxwell_Magnet.py index 41882c8bb3f..1dc2fdd1fe9 100644 --- a/examples/03-Maxwell/Maxwell_Magnet.py +++ b/examples/03-Maxwell/Maxwell_Magnet.py @@ -41,9 +41,9 @@ # ~~~~~~~~~~~ # Launch AEDT in graphical mode. -m3d = Maxwell3d(projectname=generate_unique_project_name(), - specified_version=aedt_version, - new_desktop_session=True, +m3d = Maxwell3d(project=generate_unique_project_name(), + version=aedt_version, + new_desktop=True, non_graphical=non_graphical) ############################################################################### diff --git a/examples/03-Maxwell/Maxwell_Transformer_Coreloss.py b/examples/03-Maxwell/Maxwell_Transformer_Coreloss.py index bc975659219..768f4c33275 100644 --- a/examples/03-Maxwell/Maxwell_Transformer_Coreloss.py +++ b/examples/03-Maxwell/Maxwell_Transformer_Coreloss.py @@ -10,7 +10,7 @@ # Perform required imports. from pyaedt import downloads -from pyaedt import generate_unique_folder_name +from pyaedt.generic.general_methods import generate_unique_folder_name from pyaedt import Maxwell3d from pyaedt.generic.constants import unit_converter from pyaedt.generic.general_methods import read_csv_pandas @@ -60,10 +60,10 @@ # ~~~~~~~~~~~ # Launch AEDT in graphical mode. -m3d = Maxwell3d(projectname=aedt_file, - designname="02_3D eddycurrent_CmXY_for_thermal", - specified_version=aedt_version, - new_desktop_session=True, +m3d = Maxwell3d(project=aedt_file, + design="02_3D eddycurrent_CmXY_for_thermal", + version=aedt_version, + new_desktop=True, non_graphical=False) ############################################################################### diff --git a/examples/04-Icepak/Icepak_3DComponents_Example.py b/examples/04-Icepak/Icepak_3DComponents_Example.py index a2088a67fd7..fecf8aec461 100644 --- a/examples/04-Icepak/Icepak_3DComponents_Example.py +++ b/examples/04-Icepak/Icepak_3DComponents_Example.py @@ -38,11 +38,11 @@ # ~~~~~~~~~~~~~~~ # Open a new project in non-graphical mode. -ipk = Icepak(projectname=os.path.join(temp_folder, "Heatsink.aedt"), - specified_version=aedt_version, +ipk = Icepak(project=os.path.join(temp_folder, "Heatsink.aedt"), + version=aedt_version, non_graphical=non_graphical, close_on_exit=True, - new_desktop_session=True) + new_desktop=True) # Remove air region created by default because it is not needed as the heatsink will be exported as a 3DComponent. @@ -94,7 +94,7 @@ # Create QFP # ~~~~~~~~~~ # Download and open a project containing a QPF. -ipk = Icepak(projectname=qfp_temp_name) +ipk = Icepak(project=qfp_temp_name) ipk.plot(show=False, output_file=os.path.join(temp_folder, "QFP2.jpg")) # Create dataset for power dissipation. @@ -137,8 +137,8 @@ # Create electronic package # ~~~~~~~~~~~~~~~~~~~~~~~~~ # Download and open a project containing the electronic package. -ipk = Icepak(projectname=package_temp_name, - specified_version=aedt_version, +ipk = Icepak(project=package_temp_name, + version=aedt_version, non_graphical=non_graphical) ipk.plot(show=False, output_file=os.path.join(temp_folder, "electronic_package_missing_obj.jpg")) diff --git a/examples/04-Icepak/Icepak_CSV_Import.py b/examples/04-Icepak/Icepak_CSV_Import.py index d4d0dd11980..9fe505d335f 100644 --- a/examples/04-Icepak/Icepak_CSV_Import.py +++ b/examples/04-Icepak/Icepak_CSV_Import.py @@ -39,9 +39,9 @@ temp_folder = pyaedt.generate_unique_folder_name() -ipk = pyaedt.Icepak(projectname=os.path.join(temp_folder, "Icepak_CSV_Import.aedt"), - specified_version=aedt_version, - new_desktop_session=True, +ipk = pyaedt.Icepak(project=os.path.join(temp_folder, "Icepak_CSV_Import.aedt"), + version=aedt_version, + new_desktop=True, non_graphical=non_graphical ) diff --git a/examples/04-Icepak/Icepak_ECAD_Import.py b/examples/04-Icepak/Icepak_ECAD_Import.py index dd3f045dce3..2e4caa2dcde 100644 --- a/examples/04-Icepak/Icepak_ECAD_Import.py +++ b/examples/04-Icepak/Icepak_ECAD_Import.py @@ -43,9 +43,9 @@ temp_folder = pyaedt.generate_unique_folder_name() -ipk = pyaedt.Icepak(projectname=os.path.join(temp_folder, "Icepak_ECAD_Import.aedt"), - specified_version=aedt_version, - new_desktop_session=True, +ipk = pyaedt.Icepak(project=os.path.join(temp_folder, "Icepak_ECAD_Import.aedt"), + version=aedt_version, + new_desktop=True, non_graphical=non_graphical ) diff --git a/examples/04-Icepak/Icepak_Example.py b/examples/04-Icepak/Icepak_Example.py index 1d728543ab9..ec0415c16e3 100644 --- a/examples/04-Icepak/Icepak_Example.py +++ b/examples/04-Icepak/Icepak_Example.py @@ -35,9 +35,9 @@ temp_folder = pyaedt.generate_unique_folder_name() project_temp_name = pyaedt.downloads.download_icepak(temp_folder) -ipk = pyaedt.Icepak(projectname=project_temp_name, - specified_version=aedt_version, - new_desktop_session=True, +ipk = pyaedt.Icepak(project=project_temp_name, + version=aedt_version, + new_desktop=True, non_graphical=non_graphical ) diff --git a/examples/04-Icepak/Sherlock_Example.py b/examples/04-Icepak/Sherlock_Example.py index 573dc92b3ed..ddd4b250a26 100644 --- a/examples/04-Icepak/Sherlock_Example.py +++ b/examples/04-Icepak/Sherlock_Example.py @@ -52,7 +52,7 @@ # ~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode. -d = pyaedt.launch_desktop(specified_version=aedt_version, non_graphical=non_graphical, new_desktop_session=True) +d = pyaedt.launch_desktop(version=aedt_version, non_graphical=non_graphical, new_desktop=True) start = time.time() material_list = os.path.join(input_dir, material_name) diff --git a/examples/05-Q3D/Q2D_Armoured_Cable.py b/examples/05-Q3D/Q2D_Armoured_Cable.py index 00d431a755b..6a933a6ff47 100644 --- a/examples/05-Q3D/Q2D_Armoured_Cable.py +++ b/examples/05-Q3D/Q2D_Armoured_Cable.py @@ -90,7 +90,7 @@ setup_name = "MySetupAuto" sweep_name = "sweep1" tb_design_name = 'CableSystem' -q2d = pyaedt.Q2d(projectname=project_name, designname=q2d_design_name, specified_version=aedt_version) +q2d = pyaedt.Q2d(project=project_name, design=q2d_design_name, version=aedt_version) ########################################################## # Define variables from dictionaries @@ -238,7 +238,7 @@ # Add a Simplorer/Twin Builder design and the Q3D dynamic component # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tb = pyaedt.TwinBuilder(designname=tb_design_name) +tb = pyaedt.TwinBuilder(design=tb_design_name) ########################################################## # Add a Q3D dynamic component diff --git a/examples/05-Q3D/Q2D_Example_CPWG.py b/examples/05-Q3D/Q2D_Example_CPWG.py index 5afd3abcb71..ce244f1d304 100644 --- a/examples/05-Q3D/Q2D_Example_CPWG.py +++ b/examples/05-Q3D/Q2D_Example_CPWG.py @@ -33,11 +33,11 @@ # Launch AEDT 2023 R2 in graphical mode and launch 2D Extractor. This example # uses SI units. -q = pyaedt.Q2d(specified_version=aedt_version, +q = pyaedt.Q2d(version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True, - projectname=pyaedt.generate_unique_name("pyaedt_q2d_example"), - designname="coplanar_waveguide") + new_desktop=True, + project=pyaedt.generate_unique_name("pyaedt_q2d_example"), + design="coplanar_waveguide") ############################################################################### # Define variables diff --git a/examples/05-Q3D/Q2D_Example_Stripline.py b/examples/05-Q3D/Q2D_Example_Stripline.py index d76b2f7a974..9b5abf112a4 100644 --- a/examples/05-Q3D/Q2D_Example_Stripline.py +++ b/examples/05-Q3D/Q2D_Example_Stripline.py @@ -34,11 +34,11 @@ # Launch AEDT 2023 R2 in graphical mode and launch 2D Extractor. This example # uses SI units. -q = pyaedt.Q2d(projectname=project_path, - designname="differential_stripline", - specified_version=aedt_version, +q = pyaedt.Q2d(project=project_path, + design="differential_stripline", + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True + new_desktop=True ) ############################################################################### diff --git a/examples/05-Q3D/Q3D_DC_IR.py b/examples/05-Q3D/Q3D_DC_IR.py index e0ccdcd97c7..88775d31728 100644 --- a/examples/05-Q3D/Q3D_DC_IR.py +++ b/examples/05-Q3D/Q3D_DC_IR.py @@ -93,7 +93,7 @@ edb.save_edb_as(output_edb) edb.close_edb() -h3d = pyaedt.Hfss3dLayout(output_edb, specified_version=aedt_version, non_graphical=False, new_desktop_session=True) +h3d = pyaedt.Hfss3dLayout(output_edb, version=aedt_version, non_graphical=False, new_desktop=True) ############################################################################### # Export to Q3D diff --git a/examples/05-Q3D/Q3D_Example.py b/examples/05-Q3D/Q3D_Example.py index cf3a870abcb..14b4fc13f4b 100644 --- a/examples/05-Q3D/Q3D_Example.py +++ b/examples/05-Q3D/Q3D_Example.py @@ -44,10 +44,10 @@ # Launch AEDT 2023 R2 in graphical mode and launch Q3D Extractor. # This example uses SI units. -q = pyaedt.Q3d(projectname=pyaedt.generate_unique_project_name(), - specified_version=aedt_version, +q = pyaedt.Q3d(project=pyaedt.generate_unique_project_name(), + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True) + new_desktop=True) ############################################################################### # Create primitives diff --git a/examples/05-Q3D/Q3D_from_EDB.py b/examples/05-Q3D/Q3D_from_EDB.py index 8124187ba76..2b5cbc53f9c 100644 --- a/examples/05-Q3D/Q3D_from_EDB.py +++ b/examples/05-Q3D/Q3D_from_EDB.py @@ -78,7 +78,7 @@ edb.save_edb() edb.close_edb() -h3d = pyaedt.Hfss3dLayout(output_edb, specified_version=aedt_version, non_graphical=True, new_desktop_session=True) +h3d = pyaedt.Hfss3dLayout(output_edb, version=aedt_version, non_graphical=True, new_desktop=True) ############################################################################### # Export to Q3D diff --git a/examples/06-Multiphysics/Hfss_Icepak_Coupling.py b/examples/06-Multiphysics/Hfss_Icepak_Coupling.py index 272bcb130d3..0e9e22ace4e 100644 --- a/examples/06-Multiphysics/Hfss_Icepak_Coupling.py +++ b/examples/06-Multiphysics/Hfss_Icepak_Coupling.py @@ -48,10 +48,10 @@ # Launch AEDT and initialize HFSS. If there is an active HFSS design, the ``aedtapp`` # object is linked to it. Otherwise, a new design is created. -aedtapp = pyaedt.Hfss(projectname=project_file, - specified_version=aedt_version, +aedtapp = pyaedt.Hfss(project=project_file, + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=NewThread + new_desktop=NewThread ) ############################################################################### diff --git a/examples/06-Multiphysics/Hfss_Mechanical.py b/examples/06-Multiphysics/Hfss_Mechanical.py index 5972750c9d9..e2f4912ea52 100644 --- a/examples/06-Multiphysics/Hfss_Mechanical.py +++ b/examples/06-Multiphysics/Hfss_Mechanical.py @@ -40,8 +40,8 @@ # ~~~~~~~~~~ # Start HFSS and initialize the PyAEDT object. -hfss = pyaedt.Hfss(projectname=project_temp_name, specified_version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True) +hfss = pyaedt.Hfss(project=project_temp_name, version=aedt_version, non_graphical=non_graphical, + new_desktop=True) pin_names = hfss.excitations hfss.change_material_override(True) diff --git a/examples/06-Multiphysics/MRI.py b/examples/06-Multiphysics/MRI.py index 75f5c496eaa..be712f8794f 100644 --- a/examples/06-Multiphysics/MRI.py +++ b/examples/06-Multiphysics/MRI.py @@ -47,8 +47,8 @@ # Material properties defined in this project already contain #electrical and thermal properties. project_path = downloads.download_file(directory="mri") -hfss = Hfss(os.path.join(project_path, "background_SAR.aedt"), specified_version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True) +hfss = Hfss(os.path.join(project_path, "background_SAR.aedt"), version=aedt_version, non_graphical=non_graphical, + new_desktop=True) ############################################################################### # Insert 3D component @@ -152,7 +152,7 @@ # Initialize a new Mechanical Transient Thermal analysis. # Mechanical Transient Thermal is available in AEDT from 2023 R2 as a Beta feature. -mech = Mechanical(solution_type="Transient Thermal", specified_version=aedt_version) +mech = Mechanical(solution_type="Transient Thermal", version=aedt_version) ############################################################################### # Copy geometries @@ -220,7 +220,7 @@ # ~~~~~~~~~~~~~~~~~~ # Initialize a new Icepak Transient Thermal analysis. -ipk = Icepak(solution_type="Transient", specified_version=aedt_version) +ipk = Icepak(solution_type="Transient", version=aedt_version) ipk.design_solutions.problem_type = "TemperatureOnly" ############################################################################### diff --git a/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py b/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py index 9ae83d184ea..1a6eb9a69e9 100644 --- a/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py +++ b/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py @@ -41,10 +41,10 @@ icepak_design_name = "2 Icepak" m3d = pyaedt.Maxwell3d( - projectname=project_name, - designname=maxwell_design_name, + project=project_name, + design=maxwell_design_name, solution_type="EddyCurrent", - specified_version=aedt_version, + version=aedt_version, non_graphical=non_graphical, ) @@ -175,7 +175,7 @@ # ~~~~~~~~~~~~~ # Insert Icepak design, copy solid objects from Maxwell, and modify region dimensions. -ipk = pyaedt.Icepak(designname=icepak_design_name) +ipk = pyaedt.Icepak(design=icepak_design_name) ipk.copy_solid_bodies_from(m3d, no_pec=False) # Set domain dimensions suitable for natural convection using the diameter of the coil diff --git a/examples/07-Circuit/Circuit_AMI.py b/examples/07-Circuit/Circuit_AMI.py index f90e8e5b0b3..df422dafdce 100644 --- a/examples/07-Circuit/Circuit_AMI.py +++ b/examples/07-Circuit/Circuit_AMI.py @@ -47,8 +47,8 @@ # and starts the specified version in the specified mode. pyaedt.settings.enable_pandas_output = True -cir = pyaedt.Circuit(projectname=os.path.join(project_path), non_graphical=non_graphical, - specified_version=aedt_version, new_desktop_session=NewThread) +cir = pyaedt.Circuit(project=os.path.join(project_path), non_graphical=non_graphical, + version=aedt_version, new_desktop=NewThread) ############################################################################### # Solve AMI setup diff --git a/examples/07-Circuit/Circuit_Example.py b/examples/07-Circuit/Circuit_Example.py index fff442bf276..fa0e686bf66 100644 --- a/examples/07-Circuit/Circuit_Example.py +++ b/examples/07-Circuit/Circuit_Example.py @@ -38,7 +38,7 @@ # starts the specified version in the specified mode. desktop = pyaedt.launch_desktop(aedt_version, non_graphical, new_thread) -aedt_app = pyaedt.Circuit(projectname=pyaedt.generate_unique_project_name()) +aedt_app = pyaedt.Circuit(project=pyaedt.generate_unique_project_name()) aedt_app.modeler.schematic.schematic_units = "mil" ############################################################################### # Create circuit setup diff --git a/examples/07-Circuit/Circuit_Siwave_Multizones.py b/examples/07-Circuit/Circuit_Siwave_Multizones.py index 28a61516a3b..9b91153b6ab 100644 --- a/examples/07-Circuit/Circuit_Siwave_Multizones.py +++ b/examples/07-Circuit/Circuit_Siwave_Multizones.py @@ -69,7 +69,7 @@ # ~~~~~~~ # Create circuit design, import all sub-project as EM model and connect all corresponding pins in circuit. -circuit = Circuit(specified_version=aedt_version, projectname=circuit_project_file) +circuit = Circuit(version=aedt_version, project=circuit_project_file) circuit.connect_circuit_models_from_multi_zone_cutout(project_connections=project_connexions, edb_zones_dict=edb_zones, ports=defined_ports, model_inc=70) diff --git a/examples/07-Circuit/Circuit_Subcircuit_Example.py b/examples/07-Circuit/Circuit_Subcircuit_Example.py index c7d33d9d312..359508e4f41 100644 --- a/examples/07-Circuit/Circuit_Subcircuit_Example.py +++ b/examples/07-Circuit/Circuit_Subcircuit_Example.py @@ -32,10 +32,10 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode with Circuit. -circuit = pyaedt.Circuit(projectname=pyaedt.generate_unique_project_name(), - specified_version=aedt_version, +circuit = pyaedt.Circuit(project=pyaedt.generate_unique_project_name(), + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=True + new_desktop=True ) circuit.modeler.schematic_units = "mil" diff --git a/examples/07-Circuit/Circuit_Transient.py b/examples/07-Circuit/Circuit_Transient.py index e63fdb6655d..25972732565 100644 --- a/examples/07-Circuit/Circuit_Transient.py +++ b/examples/07-Circuit/Circuit_Transient.py @@ -35,9 +35,9 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~ # Launch AEDT 2023 R2 in graphical mode with Circuit. -cir = pyaedt.Circuit(projectname=pyaedt.generate_unique_project_name(), - specified_version=aedt_version, - new_desktop_session=True, +cir = pyaedt.Circuit(project=pyaedt.generate_unique_project_name(), + version=aedt_version, + new_desktop=True, non_graphical=non_graphical ) diff --git a/examples/07-Circuit/Create_Netlist.py b/examples/07-Circuit/Create_Netlist.py index e284bcbf17a..c2f999fe746 100644 --- a/examples/07-Circuit/Create_Netlist.py +++ b/examples/07-Circuit/Create_Netlist.py @@ -44,7 +44,7 @@ # and starts it on the specified version in the specified graphical mode. desktop = pyaedt.launch_desktop(aedt_version, non_graphical, NewThread) -aedtapp = pyaedt.Circuit(projectname=project_name) +aedtapp = pyaedt.Circuit(project=project_name) ############################################################################### # Define variable diff --git a/examples/07-Circuit/Reports.py b/examples/07-Circuit/Reports.py index baf0118c3e7..14f4db69c87 100644 --- a/examples/07-Circuit/Reports.py +++ b/examples/07-Circuit/Reports.py @@ -41,10 +41,10 @@ # Launch AEDT with Circuit. The :class:`pyaedt.Desktop` class initializes AEDT # and starts the specified version in the specified mode. -cir = pyaedt.Circuit(projectname=os.path.join(project_path, 'CISPR25_Radiated_Emissions_Example23R1.aedtz'), +cir = pyaedt.Circuit(project=os.path.join(project_path, 'CISPR25_Radiated_Emissions_Example23R1.aedtz'), non_graphical=non_graphical, - specified_version=aedt_version, - new_desktop_session=True + version=aedt_version, + new_desktop=True ) cir.analyze() diff --git a/examples/07-Circuit/Virtual_Compliance.py b/examples/07-Circuit/Virtual_Compliance.py index 721e06437a2..05fbe880dd8 100644 --- a/examples/07-Circuit/Virtual_Compliance.py +++ b/examples/07-Circuit/Virtual_Compliance.py @@ -45,7 +45,7 @@ # ~~~~~~~~~~~ # Launch AEDT. -d = pyaedt.Desktop(aedt_version, new_desktop_session=new_thread, non_graphical=non_graphical) +d = pyaedt.Desktop(aedt_version, new_desktop=new_thread, non_graphical=non_graphical) ############################################################################### # Open and solve layout @@ -54,7 +54,7 @@ # Before solving, this code ensures that the model is solved from DC to 70GHz and that # causality and passivity are enforced. -h3d = pyaedt.Hfss3dLayout(os.path.join(projectdir, "PCIE_GEN5_only_layout.aedtz"), specified_version=241) +h3d = pyaedt.Hfss3dLayout(os.path.join(projectdir, "PCIE_GEN5_only_layout.aedtz"), version=241) h3d.remove_all_unused_definitions() h3d.edit_cosim_options(simulate_missing_solution=False) h3d.setups[0].sweeps[0].props["EnforcePassivity"] = True @@ -62,7 +62,7 @@ h3d.setups[0].sweeps[0].props["EnforceCausality"] = True h3d.setups[0].sweeps[0].update() h3d.analyze() -h3d = pyaedt.Hfss3dLayout(specified_version=241) +h3d = pyaedt.Hfss3dLayout(version=241) touchstone_path = h3d.export_touchstone() ############################################################################### @@ -71,7 +71,7 @@ # Use the LNA setup to retrieve Touchstone files # and generate frequency domain reports. -cir = pyaedt.Circuit(projectname=h3d.project_name, designname="Touchstone") +cir = pyaedt.Circuit(project=h3d.project_name, design="Touchstone") status, diff_pairs, comm_pairs = cir.create_lna_schematic_from_snp(input_file=touchstone_path, start_frequency=0, stop_frequency=70, auto_assign_diff_pairs=True, separation=".", pattern=["component", "pin", "net"], diff --git a/examples/07-EMIT/ComputeInterferenceType.py b/examples/07-EMIT/ComputeInterferenceType.py index fc368b36cc0..00572e3268c 100644 --- a/examples/07-EMIT/ComputeInterferenceType.py +++ b/examples/07-EMIT/ComputeInterferenceType.py @@ -60,10 +60,10 @@ def install(package): non_graphical = False new_thread = True -desktop = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop_session=new_thread) +desktop = pyaedt.launch_desktop(aedt_version, non_graphical=non_graphical, new_desktop=new_thread) path_to_desktop_project = pyaedt.downloads.download_file("emit", "interference.aedtz") -emitapp = Emit(non_graphical=False, new_desktop_session=False, projectname=path_to_desktop_project) +emitapp = Emit(non_graphical=False, new_desktop=False, project=path_to_desktop_project) # Get all the radios in the project # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/07-TwinBuilder/01-RC_Circuit_Example.py b/examples/07-TwinBuilder/01-RC_Circuit_Example.py index 0deec81cc46..940f6e50080 100644 --- a/examples/07-TwinBuilder/01-RC_Circuit_Example.py +++ b/examples/07-TwinBuilder/01-RC_Circuit_Example.py @@ -39,10 +39,10 @@ # Launch Twin Builder using an implicit declaration and add a new design with # a default setup. -tb = pyaedt.TwinBuilder(projectname=pyaedt.generate_unique_project_name(), - specified_version=aedt_version, +tb = pyaedt.TwinBuilder(project=pyaedt.generate_unique_project_name(), + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=new_thread + new_desktop=new_thread ) tb.modeler.schematic_units = "mil" diff --git a/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py b/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py index c9192f669e2..ba977468e41 100644 --- a/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py +++ b/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py @@ -41,10 +41,10 @@ # Launch Twin Builder using an implicit declaration and add a new design with # a default setup. -tb = pyaedt.TwinBuilder(projectname=pyaedt.generate_unique_project_name(), - specified_version=aedt_version, +tb = pyaedt.TwinBuilder(project=pyaedt.generate_unique_project_name(), + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=new_thread + new_desktop=new_thread ) ############################################################################### diff --git a/examples/07-TwinBuilder/03-Dynamic_ROM_Creation_And_Visualization.py b/examples/07-TwinBuilder/03-Dynamic_ROM_Creation_And_Visualization.py index 78bdef0d291..e891c1b811c 100644 --- a/examples/07-TwinBuilder/03-Dynamic_ROM_Creation_And_Visualization.py +++ b/examples/07-TwinBuilder/03-Dynamic_ROM_Creation_And_Visualization.py @@ -19,9 +19,9 @@ import matplotlib.pyplot as plt from pyaedt import TwinBuilder from pyaedt import generate_unique_project_name -from pyaedt import generate_unique_folder_name +from pyaedt.generic.general_methods import generate_unique_folder_name from pyaedt import downloads -from pyaedt import settings +from pyaedt.generic.settings import settings ########################################################## # Set AEDT version @@ -73,10 +73,10 @@ # Launch Twin Builder using an implicit declaration and add a new design with # a default setup for building the dynamic ROM component. -tb = TwinBuilder(projectname=generate_unique_project_name(), - specified_version=aedt_version, +tb = TwinBuilder(project=generate_unique_project_name(), + version=aedt_version, non_graphical=non_graphical, - new_desktop_session=new_thread) + new_desktop=new_thread) # Switch the current desktop configuration and the schematic environment to "Twin Builder". # The Dynamic ROM feature is only available with a twin builder license. diff --git a/examples/07-TwinBuilder/04-Static_ROM_Creation_And_Visualization.py b/examples/07-TwinBuilder/04-Static_ROM_Creation_And_Visualization.py index 1583c42fdd4..df40afe2985 100644 --- a/examples/07-TwinBuilder/04-Static_ROM_Creation_And_Visualization.py +++ b/examples/07-TwinBuilder/04-Static_ROM_Creation_And_Visualization.py @@ -20,9 +20,9 @@ import matplotlib.pyplot as plt from pyaedt import TwinBuilder from pyaedt import generate_unique_project_name -from pyaedt import generate_unique_folder_name +from pyaedt.generic.general_methods import generate_unique_folder_name from pyaedt import downloads -from pyaedt import settings +from pyaedt.generic.settings import settings ########################################################## # Set AEDT version @@ -77,8 +77,8 @@ # Launch Twin Builder using an implicit declaration and add a new design with # a default setup for building the static ROM component. -tb = TwinBuilder(projectname=generate_unique_project_name(), specified_version=aedt_version, - non_graphical=non_graphical, new_desktop_session=new_thread) +tb = TwinBuilder(project=generate_unique_project_name(), version=aedt_version, + non_graphical=non_graphical, new_desktop=new_thread) # Switch the current desktop configuration and the schematic environment to "Twin Builder". # The Static ROM feature is only available with a twin builder license. diff --git a/pyaedt/__init__.py b/pyaedt/__init__.py index 34f82cf8fb1..813506620dc 100644 --- a/pyaedt/__init__.py +++ b/pyaedt/__init__.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import sys import warnings @@ -44,33 +67,17 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non version = __version__ # - -import pyaedt.downloads as downloads +if not ("IronPython" in sys.version or ".NETFramework" in sys.version): # pragma: no cover + import pyaedt.downloads as downloads +from pyaedt.edb import Edb # nosec +from pyaedt.edb import Siwave # nosec from pyaedt.generic import constants import pyaedt.generic.DataHandlers as data_handler -import pyaedt.generic.general_methods as general_methods -from pyaedt.generic.general_methods import _retry_ntimes -from pyaedt.generic.general_methods import generate_unique_folder_name -from pyaedt.generic.general_methods import generate_unique_name -from pyaedt.generic.general_methods import generate_unique_project_name -from pyaedt.generic.general_methods import inside_desktop -from pyaedt.generic.general_methods import is_ironpython -from pyaedt.generic.general_methods import is_linux -from pyaedt.generic.general_methods import is_windows -from pyaedt.generic.general_methods import online_help -from pyaedt.generic.general_methods import pyaedt_function_handler -from pyaedt.generic.general_methods import settings - -try: - from pyaedt.generic.design_types import Hfss3dLayout -except Exception: - from pyaedt.generic.design_types import Hfss3dLayout - from pyaedt.generic.design_types import Circuit from pyaedt.generic.design_types import Desktop -from pyaedt.generic.design_types import Edb from pyaedt.generic.design_types import Emit from pyaedt.generic.design_types import Hfss +from pyaedt.generic.design_types import Hfss3dLayout from pyaedt.generic.design_types import Icepak from pyaedt.generic.design_types import Maxwell2d from pyaedt.generic.design_types import Maxwell3d @@ -80,10 +87,21 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non from pyaedt.generic.design_types import Q3d from pyaedt.generic.design_types import Rmxprt from pyaedt.generic.design_types import Simplorer -from pyaedt.generic.design_types import Siwave from pyaedt.generic.design_types import TwinBuilder from pyaedt.generic.design_types import get_pyaedt_app from pyaedt.generic.design_types import launch_desktop +import pyaedt.generic.general_methods as general_methods +from pyaedt.generic.general_methods import _retry_ntimes +from pyaedt.generic.general_methods import generate_unique_folder_name +from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import generate_unique_project_name +from pyaedt.generic.general_methods import inside_desktop +from pyaedt.generic.general_methods import is_ironpython +from pyaedt.generic.general_methods import is_linux +from pyaedt.generic.general_methods import is_windows +from pyaedt.generic.general_methods import online_help +from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.general_methods import settings from pyaedt.misc import current_student_version from pyaedt.misc import current_version from pyaedt.misc import installed_versions diff --git a/pyaedt/aedt_logger.py b/pyaedt/aedt_logger.py index 060afeabda5..fce4e646541 100644 --- a/pyaedt/aedt_logger.py +++ b/pyaedt/aedt_logger.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import logging from logging.handlers import RotatingFileHandler import os diff --git a/pyaedt/application/AEDT_File_Management.py b/pyaedt/application/AEDT_File_Management.py index 6d641ba45a4..bd64a1aeed0 100644 --- a/pyaedt/application/AEDT_File_Management.py +++ b/pyaedt/application/AEDT_File_Management.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import csv import os import re diff --git a/pyaedt/application/Analysis.py b/pyaedt/application/Analysis.py index abd7571957d..9f24e28c45b 100644 --- a/pyaedt/application/Analysis.py +++ b/pyaedt/application/Analysis.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains the ``analysis`` class. @@ -14,9 +38,6 @@ import tempfile import time -from pyaedt import is_ironpython -from pyaedt import is_linux -from pyaedt import is_windows from pyaedt.application.Design import Design from pyaedt.application.JobManager import update_hpc_option from pyaedt.application.Variables import Variable @@ -29,6 +50,9 @@ from pyaedt.generic.constants import VIEW from pyaedt.generic.general_methods import filter_tuple from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import is_ironpython +from pyaedt.generic.general_methods import is_linux +from pyaedt.generic.general_methods import is_windows from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.settings import settings @@ -77,7 +101,7 @@ class Analysis(Design, object): Version of AEDT to use. NG : bool Whether to run AEDT in the non-graphical mode. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. @@ -86,12 +110,15 @@ class Analysis(Design, object): student_version : bool Whether to enable the student version of AEDT. aedt_process_id : int, optional - Only used when ``new_desktop_session = False``, specifies by process ID which instance + Only used when ``new_desktop = False``, specifies by process ID which instance of Electronics Desktop to point PyAEDT at. ic_mode : bool, optional Whether to set the design to IC mode. The default is ``None``, which means to retain the existing setting. This parameter applies only to HFSS 3D Layout. - + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. """ def __init__( @@ -103,13 +130,14 @@ def __init__( setup_name, specified_version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine="", port=0, aedt_process_id=None, ic_mode=None, + remove_lock=False, ): Design.__init__( self, @@ -119,13 +147,14 @@ def __init__( solution_type, specified_version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, ic_mode, + remove_lock, ) self._excitation_objects = {} self._setup = None @@ -1922,7 +1951,7 @@ def solve_in_batch( Number of tasks to use in the simulation. Set ``num_tasks`` to ``-1`` to apply auto settings and distributed mode. setup : str - Name of the setup, which can be an optimetric setup or a simple setup. + Name of the setup, which can be an optimetrics setup or a simple setup. The default is ``None``, in which case all setups are solved. revert_to_initial_mesh : bool, optional Whether to revert to the initial mesh before solving. The default is ``False``. diff --git a/pyaedt/application/Analysis3D.py b/pyaedt/application/Analysis3D.py index 3d07f69f87a..435badc9708 100644 --- a/pyaedt/application/Analysis3D.py +++ b/pyaedt/application/Analysis3D.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import csv import ntpath import os @@ -38,13 +62,13 @@ class FieldAnalysis3D(Analysis, object): Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional Whether to run AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in the graphical mode. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -54,8 +78,12 @@ class FieldAnalysis3D(Analysis, object): Whether to enable the student version of AEDT. The default is ``False``. aedt_process_id : int, optional - Only used when ``new_desktop_session = False``, specifies by process ID which instance + Only used when ``new_desktop = False``, specifies by process ID which instance of Electronics Desktop to point PyAEDT at. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. """ def __init__( @@ -65,14 +93,15 @@ def __init__( designname, solution_type, setup_name=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): Analysis.__init__( self, @@ -81,14 +110,15 @@ def __init__( designname, solution_type, setup_name, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self._post = None self._modeler = None diff --git a/pyaedt/application/Analysis3DLayout.py b/pyaedt/application/Analysis3DLayout.py index 7e720234103..fee24cda10e 100644 --- a/pyaedt/application/Analysis3DLayout.py +++ b/pyaedt/application/Analysis3DLayout.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from pyaedt.application.Analysis import Analysis @@ -35,13 +59,13 @@ class FieldAnalysis3DLayout(Analysis): Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. - NG : bool, optional + non_graphical : bool, optional Whether to run AEDT in the non-graphical mode. The default is ``False``, in which case AEDT is launched in the graphical mode. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -52,10 +76,14 @@ class FieldAnalysis3DLayout(Analysis): is ``False``. aedt_process_id : int, optional Specifies by process ID the instance of AEDT to point PyAEDT at. - This parameter is only used when ``new_desktop_session=False``. + This parameter is only used when ``new_desktop=False``. ic_mode : bool, optional Whether to set the design to IC mode. The default is ``None``, which means to retain the existing setting. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. """ @@ -66,15 +94,16 @@ def __init__( designname, solution_type, setup_name=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, ic_mode=None, + remove_lock=False, ): Analysis.__init__( self, @@ -83,15 +112,16 @@ def __init__( designname, solution_type, setup_name, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, ic_mode, + remove_lock=remove_lock, ) self._modeler = None self._mesh = None diff --git a/pyaedt/application/AnalysisMaxwellCircuit.py b/pyaedt/application/AnalysisMaxwellCircuit.py index 3e53372604a..8f34e2e9977 100644 --- a/pyaedt/application/AnalysisMaxwellCircuit.py +++ b/pyaedt/application/AnalysisMaxwellCircuit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.application.Analysis import Analysis from pyaedt.generic.settings import settings @@ -19,14 +43,14 @@ class AnalysisMaxwellCircuit(Analysis): Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``. If ``None``, the active setup is used or the latest installed version is used. NG : bool, optional Whether to launch AEDT in the non-graphical mode. The default is ``False``, in which case AEDT is launched in the graphical mode. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -35,9 +59,12 @@ class AnalysisMaxwellCircuit(Analysis): student_version : bool, optional Whether to open the AEDT student version. The default is ``False``. aedt_process_id : int, optional - Only used when ``new_desktop_session = False``, specifies by process ID which instance + Only used when ``new_desktop = False``, specifies by process ID which instance of Electronics Desktop to point PyAEDT at. - + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. """ def __init__( @@ -45,14 +72,15 @@ def __init__( application, projectname, designname, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): Analysis.__init__( self, @@ -61,14 +89,15 @@ def __init__( designname, None, None, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self._modeler = None if not settings.lazy_load: diff --git a/pyaedt/application/AnalysisNexxim.py b/pyaedt/application/AnalysisNexxim.py index 30a3307ff53..4ae54d9e5a9 100644 --- a/pyaedt/application/AnalysisNexxim.py +++ b/pyaedt/application/AnalysisNexxim.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.application.Analysis import Analysis from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.settings import settings @@ -35,14 +59,15 @@ def __init__( designname, solution_type, setup_name=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): Analysis.__init__( self, @@ -51,14 +76,15 @@ def __init__( designname, solution_type, setup_name, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self._modeler = None @@ -123,7 +149,7 @@ def push_down(self, component): out_name = component try: self.desktop_class.active_design(self.oproject, out_name, self.design_type) - self.__init__(projectname=self.project_name, designname=out_name) + self.__init__(project=self.project_name, design=out_name) except Exception: # pragma: no cover return False return True @@ -140,7 +166,7 @@ def pop_up(self): try: parent_name = self.odesign.GetName().split(";")[1].split("/")[0] self.desktop_class.active_design(self.oproject, parent_name, self.design_type) - self.__init__(projectname=self.project_name, designname=parent_name) + self.__init__(project=self.project_name, design=parent_name) except Exception: return False return True diff --git a/pyaedt/application/AnalysisRMxprt.py b/pyaedt/application/AnalysisRMxprt.py index a63acd5bc83..4989ecc2ef7 100644 --- a/pyaedt/application/AnalysisRMxprt.py +++ b/pyaedt/application/AnalysisRMxprt.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.application.Analysis import Analysis from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.settings import settings @@ -24,14 +48,15 @@ def __init__( designname, solution_type, setup_name=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): Analysis.__init__( self, @@ -40,14 +65,15 @@ def __init__( designname, solution_type, setup_name, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self._modeler = None self._post = None diff --git a/pyaedt/application/AnalysisTwinBuilder.py b/pyaedt/application/AnalysisTwinBuilder.py index 85d9dc246a0..1acabd68878 100644 --- a/pyaedt/application/AnalysisTwinBuilder.py +++ b/pyaedt/application/AnalysisTwinBuilder.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.application.Analysis import Analysis from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.settings import settings @@ -46,14 +70,15 @@ def __init__( designname, solution_type, setup_name=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): Analysis.__init__( self, @@ -62,14 +87,15 @@ def __init__( designname, solution_type, setup_name, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self._modeler = None self._post = None diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 54d5325410f..72af63da05a 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: ``Design``. @@ -51,6 +75,7 @@ from pyaedt.generic.general_methods import read_csv from pyaedt.generic.general_methods import read_tab from pyaedt.generic.general_methods import read_xlsx +from pyaedt.generic.general_methods import remove_project_lock from pyaedt.generic.general_methods import settings from pyaedt.generic.general_methods import write_csv from pyaedt.modules.Boundary import BoundaryObject @@ -89,13 +114,13 @@ class Design(AedtObjects): solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional Whether to run AEDT in non-graphical mode. The default is ``False``, in which case AEDT launches in graphical mode. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -105,12 +130,15 @@ class Design(AedtObjects): Whether to enable the student version of AEDT. The default is ``False``. aedt_process_id : int, optional - Only used when ``new_desktop_session = False``, specifies by process ID which instance + Only used when ``new_desktop = False``, specifies by process ID which instance of Electronics Desktop to point PyAEDT at. ic_mode : bool, optional Whether to set the design to IC mode or not. The default is ``None``, which means to retain the existing setting. Applicable only to ``Hfss3dLayout``. - + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. """ @property @@ -178,12 +206,12 @@ def info(self): def _init_design(self, project_name, design_name, solution_type=None): # calls the method from the application class self._init_from_design( - projectname=project_name, - designname=design_name, + project=project_name, + design=design_name, solution_type=solution_type, - specified_version=settings.aedt_version, + version=settings.aedt_version, non_graphical=self._desktop_class.non_graphical, - new_desktop_session=False, + new_desktop=False, close_on_exit=self.close_on_exit, student_version=self.student_version, machine=self._desktop_class.machine, @@ -196,15 +224,16 @@ def __init__( project_name=None, design_name=None, solution_type=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, ic_mode=None, + remove_lock=False, ): self.__t = None @@ -230,9 +259,9 @@ def __init__( self.close_on_exit = close_on_exit self._desktop_class = None self._desktop_class = _init_desktop_from_design( - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, @@ -263,14 +292,13 @@ def __init__( self.design_solutions = DesignSolution(None, design_type, self._aedt_version) self.design_solutions._solution_type = solution_type self._temp_solution_type = solution_type + self._remove_lock = remove_lock self.oproject = project_name self.odesign = design_name self._logger.oproject = self.oproject self._logger.odesign = self.odesign AedtObjects.__init__(self, self._desktop_class, self.oproject, self.odesign, is_inherithed=True) self.logger.info("Aedt Objects correctly read") - # if t: - # t.join() if not self.__t and not settings.lazy_load and not is_ironpython and os.path.exists(self.project_file): self.__t = threading.Thread(target=load_aedt_thread, args=(self.project_file,), daemon=True) self.__t.start() @@ -1152,7 +1180,11 @@ def oproject(self, proj_name=None): self.logger.info("Project %s set to active.", pname) elif os.path.exists(project): if is_project_locked(project): - raise RuntimeError("Project is locked. Close or remove the lock before proceeding.") + if self._remove_lock: # pragma: no cover + self.logger.warning("Project is locked. Removing it and opening.") + remove_project_lock(project) + else: # pragma: no cover + raise RuntimeError("Project is locked. Close or remove the lock before proceeding.") self.logger.info("aedt project found. Loading it.") self._oproject = self.odesktop.OpenProject(project) self._add_handler() @@ -1177,7 +1209,11 @@ def oproject(self, proj_name=None): self.logger.info("Project %s set to active.", pname) else: if is_project_locked(proj_name): - raise RuntimeError("Project is locked. Close or remove the lock before proceeding.") + if self._remove_lock: # pragma: no cover + self.logger.warning("Project is locked. Removing it and opening.") + remove_project_lock(proj_name) + else: # pragma: no cover + raise RuntimeError("Project is locked. Close or remove the lock before proceeding.") self._oproject = self.odesktop.OpenProject(proj_name) if not is_windows and settings.aedt_version: time.sleep(1) @@ -1250,6 +1286,47 @@ def remove_all_unused_definitions(self): self.oproject.RemoveAllUnusedDefinitions() return True + @pyaedt_function_handler() + def get_profile(self, name=None): + """Get profile information. + + Parameters + ---------- + name : str + Setup name. The default is ``None``, in which case all available setups are returned. + + Returns + ------- + dict of :class:`pyaedt.modeler.cad.elements3d.BinaryTree` when successful, + ``False`` when failed. + """ + from pyaedt.modeler.cad.elements3d import BinaryTreeNode + + if not name: + name = self.setup_names + if not isinstance(name, list): + name = [name] + + profile_setups_obj = self.get_oo_object(self.odesign, "results/profile") + + profile_objs = {} + if profile_setups_obj: + profile_setup_names = self.get_oo_name(self.odesign, "results/profile") + for n in name: + for profile_setup_name in profile_setup_names: + if n in profile_setup_name: + profile_setup_obj = self.get_oo_object(profile_setups_obj, profile_setup_name) + if profile_setup_obj and self.get_oo_name(profile_setup_obj): + try: + profile_tree = BinaryTreeNode("profile", profile_setup_obj) + profile_objs[profile_setup_name] = profile_tree + except Exception: # pragma: no cover + self.logger.error("{} profile could not be obtained.".format(profile_setup_name)) + return profile_objs + else: # pragma: no cover + self.logger.error("Profile can not be obtained.") + return False + @pyaedt_function_handler() def get_oo_name(self, aedt_object, object_name=None): """Return the object-oriented AEDT property names. @@ -2553,7 +2630,7 @@ def _close_edb(self): self.modeler._edb.close_edb() @pyaedt_function_handler(dsname="name", xlist="x", ylist="y", xunit="x_unit", yunit="y_unit") - def create_dataset1d_design(self, name, x, y, x_unit="", y_unit=""): + def create_dataset1d_design(self, name, x, y, x_unit="", y_unit="", sort=True): """Create a design dataset. Parameters @@ -2568,6 +2645,8 @@ def create_dataset1d_design(self, name, x, y, x_unit="", y_unit=""): Units for the X axis. The default is ``""``. y_unit : str, optional Units for the Y axis. The default is ``""``. + sort : bool, optional + Sort dataset. The default is ``True``. Returns ------- @@ -2579,10 +2658,10 @@ def create_dataset1d_design(self, name, x, y, x_unit="", y_unit=""): >>> oProject.AddDataset >>> oDesign.AddDataset """ - return self.create_dataset(name, x, y, is_project_dataset=False, x_unit=x_unit, y_unit=y_unit) + return self.create_dataset(name, x, y, is_project_dataset=False, x_unit=x_unit, y_unit=y_unit, sort=sort) @pyaedt_function_handler(dsname="name", xlist="x", ylist="y", xunit="x_unit", yunit="y_unit") - def create_dataset1d_project(self, name, x, y, x_unit="", y_unit=""): + def create_dataset1d_project(self, name, x, y, x_unit="", y_unit="", sort=True): """Create a project dataset. Parameters @@ -2597,6 +2676,8 @@ def create_dataset1d_project(self, name, x, y, x_unit="", y_unit=""): Units for the X axis. The default is ``""``. y_unit : str, optional Units for the Y axis. The default is ``""``. + sort : bool, optional + Sort dataset. The default is ``True``. Returns ------- @@ -2609,7 +2690,7 @@ def create_dataset1d_project(self, name, x, y, x_unit="", y_unit=""): >>> oProject.AddDataset >>> oDesign.AddDataset """ - return self.create_dataset(name, x, y, is_project_dataset=True, x_unit=x_unit, y_unit=y_unit) + return self.create_dataset(name, x, y, is_project_dataset=True, x_unit=x_unit, y_unit=y_unit, sort=sort) @pyaedt_function_handler( dsname="name", @@ -2623,17 +2704,7 @@ def create_dataset1d_project(self, name, x, y, x_unit="", y_unit=""): vunit="v_unit", ) def create_dataset3d( - self, - name, - x, - y, - z=None, - v=None, - x_unit="", - y_unit="", - z_unit="", - v_unit="", - is_project_dataset=True, + self, name, x, y, z=None, v=None, x_unit="", y_unit="", z_unit="", v_unit="", is_project_dataset=True, sort=True ): """Create a 3D dataset. @@ -2659,6 +2730,8 @@ def create_dataset3d( Units for the V axis for a 3D dataset only. The default is ``""``. is_project_dataset : bool, optional Whether it is a project data set. The default is ``True``. + sort : bool, optional + Sort dataset. The default is ``True``. Returns ------- @@ -2687,10 +2760,11 @@ def create_dataset3d( y_unit=y_unit, z_unit=z_unit, v_unit=v_unit, + sort=sort, ) @pyaedt_function_handler(filename="input_file", dsname="name") - def import_dataset1d(self, input_file, name=None, is_project_dataset=True): + def import_dataset1d(self, input_file, name=None, is_project_dataset=True, sort=True): """Import a 1D dataset. Parameters @@ -2701,6 +2775,8 @@ def import_dataset1d(self, input_file, name=None, is_project_dataset=True): Name of the dataset. The default is the file name. is_project_dataset : bool, optional Whether it is a project data set. The default is ``True``. + sort : bool, optional + Sort dataset. The default is ``True``. Returns ------- @@ -2740,11 +2816,11 @@ def import_dataset1d(self, input_file, name=None, is_project_dataset=True): is_project_dataset = True return self.create_dataset( - name, xlist, ylist, is_project_dataset=is_project_dataset, x_unit=units[0], y_unit=units[1] + name, xlist, ylist, is_project_dataset=is_project_dataset, x_unit=units[0], y_unit=units[1], sort=sort ) @pyaedt_function_handler(filename="input_file", dsname="name") - def import_dataset3d(self, input_file, name=None, encoding="utf-8-sig", is_project_dataset=True): + def import_dataset3d(self, input_file, name=None, encoding="utf-8-sig", is_project_dataset=True, sort=True): """Import a 3D dataset. Parameters @@ -2757,6 +2833,8 @@ def import_dataset3d(self, input_file, name=None, encoding="utf-8-sig", is_proje File encoding to be provided for csv. is_project_dataset : bool, optional Whether it is a project data set. The default is ``True``. + sort : bool, optional + Sort dataset. The default is ``True``. Returns ------- @@ -2834,6 +2912,7 @@ def import_dataset3d(self, input_file, name=None, encoding="utf-8-sig", is_proje y_unit=units[1], z_unit=units[2], v_unit=units[3], + sort=sort, ) @pyaedt_function_handler( @@ -2848,17 +2927,7 @@ def import_dataset3d(self, input_file, name=None, encoding="utf-8-sig", is_proje vunit="v_unit", ) def create_dataset( - self, - name, - x, - y, - z=None, - v=None, - is_project_dataset=True, - x_unit="", - y_unit="", - z_unit="", - v_unit="", + self, name, x, y, z=None, v=None, is_project_dataset=True, x_unit="", y_unit="", z_unit="", v_unit="", sort=True ): """Create a dataset. @@ -2884,6 +2953,8 @@ def create_dataset( Units for the Z axis for a 3D dataset only. The default is ``""``. v_unit : str, optional Units for the V axis for a 3D dataset only. The default is ``""``. + sort : bool, optional + Sort dataset. The default is ``True``. Returns ------- @@ -2899,7 +2970,7 @@ def create_dataset( if not self.dataset_exists(name, is_project_dataset): if is_project_dataset: name = "$" + name - ds = DataSet(self, name, x, y, z, v, x_unit, y_unit, z_unit, v_unit) + ds = DataSet(self, name, x, y, z, v, x_unit, y_unit, z_unit, v_unit, sort) else: self.logger.warning("Dataset %s already exists", name) return False diff --git a/pyaedt/application/JobManager.py b/pyaedt/application/JobManager.py index 1277424e1f5..67f2777b570 100644 --- a/pyaedt/application/JobManager.py +++ b/pyaedt/application/JobManager.py @@ -1,3 +1,28 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + def get_hpc_info(filename): """Retrieve HPC information. diff --git a/pyaedt/application/Variables.py b/pyaedt/application/Variables.py index 8f463b124c0..cf147a0570c 100644 --- a/pyaedt/application/Variables.py +++ b/pyaedt/application/Variables.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `CSVDataset`, `DataSet`, `Expression`, `Variable`, and `VariableManager`. @@ -22,7 +46,6 @@ import types import warnings -from pyaedt import pyaedt_function_handler from pyaedt.generic.constants import AEDT_UNITS from pyaedt.generic.constants import SI_UNITS from pyaedt.generic.constants import _resolve_unit_system @@ -32,6 +55,7 @@ from pyaedt.generic.general_methods import is_array from pyaedt.generic.general_methods import is_number from pyaedt.generic.general_methods import open_file +from pyaedt.generic.general_methods import pyaedt_function_handler class CSVDataset: @@ -2132,10 +2156,11 @@ class DataSet(object): Units for the Z axis for a 3D dataset only. The default is ``""``. vunit : str, optional Units for the V axis for a 3D dataset only. The default is ``""``. - + sort : bool, optional + Sort dataset. The default is ``True``. """ - def __init__(self, app, name, x, y, z=None, v=None, xunit="", yunit="", zunit="", vunit=""): + def __init__(self, app, name, x, y, z=None, v=None, xunit="", yunit="", zunit="", vunit="", sort=True): self._app = app self.name = name self.x = x @@ -2146,12 +2171,12 @@ def __init__(self, app, name, x, y, z=None, v=None, xunit="", yunit="", zunit="" self.yunit = yunit self.zunit = zunit self.vunit = vunit + self.sort = sort @pyaedt_function_handler() def _args(self): """Retrieve arguments.""" - arg = [] - arg.append("Name:" + self.name) + arg = ["Name:" + self.name] arg2 = ["Name:Coordinates"] if self.z is None: arg2.append(["NAME:DimUnits", self.xunit, self.yunit]) @@ -2159,16 +2184,25 @@ def _args(self): arg2.append(["NAME:DimUnits", self.xunit, self.yunit, self.zunit, self.vunit]) else: return False + z = {} + v = {} if self.z: - x, y, z, v = (list(t) for t in zip(*sorted(zip(self.x, self.y, self.z, self.v), key=lambda e: float(e[0])))) + if self.sort: + x, y, z, v = ( + list(t) for t in zip(*sorted(zip(self.x, self.y, self.z, self.v), key=lambda e: float(e[0]))) + ) + else: + x, y, z, v = (list(t) for t in zip(*zip(self.x, self.y, self.z, self.v))) else: - x, y = (list(t) for t in zip(*sorted(zip(self.x, self.y), key=lambda e: float(e[0])))) + if self.sort: + x, y = (list(t) for t in zip(*sorted(zip(self.x, self.y), key=lambda e: float(e[0])))) + else: + x, y = (list(t) for t in zip(*(zip(self.x, self.y)))) + ver = self._app._aedt_version for i in range(len(x)): if ver >= "2022.1": - arg3 = ["NAME:Point"] - arg3.append(float(x[i])) - arg3.append(float(y[i])) + arg3 = ["NAME:Point", float(x[i]), float(y[i])] if self.z: arg3.append(float(z[i])) arg3.append(float(v[i])) diff --git a/pyaedt/application/__init__.py b/pyaedt/application/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/application/__init__.py +++ b/pyaedt/application/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/application/aedt_objects.py b/pyaedt/application/aedt_objects.py index 81fad1bd4fc..eb26dfef1bd 100644 --- a/pyaedt/application/aedt_objects.py +++ b/pyaedt/application/aedt_objects.py @@ -1,10 +1,34 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import sys import time -from pyaedt import is_linux -from pyaedt import pyaedt_function_handler -from pyaedt import settings from pyaedt.generic.desktop_sessions import _desktop_sessions +from pyaedt.generic.general_methods import is_linux +from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.general_methods import settings class AedtObjects(object): diff --git a/pyaedt/application/analysis_hf.py b/pyaedt/application/analysis_hf.py index 1171624b856..d361b5ef3d0 100644 --- a/pyaedt/application/analysis_hf.py +++ b/pyaedt/application/analysis_hf.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.generic.general_methods import pyaedt_function_handler diff --git a/pyaedt/application/design_solutions.py b/pyaedt/application/design_solutions.py index 8b0fa36aab9..af0e789d263 100644 --- a/pyaedt/application/design_solutions.py +++ b/pyaedt/application/design_solutions.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import copy from pyaedt.aedt_logger import pyaedt_logger as logger diff --git a/pyaedt/circuit.py b/pyaedt/circuit.py index 6c1221cc4e1..96626fb5778 100644 --- a/pyaedt/circuit.py +++ b/pyaedt/circuit.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains the ``Circuit`` class.""" from __future__ import absolute_import # noreorder @@ -10,8 +33,6 @@ import shutil import time -from pyaedt import Hfss3dLayout -from pyaedt import settings from pyaedt.application.AnalysisNexxim import FieldAnalysisCircuit from pyaedt.application.analysis_hf import ScatteringMethods from pyaedt.generic import ibis_reader @@ -22,6 +43,8 @@ from pyaedt.generic.general_methods import is_linux from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.settings import settings +from pyaedt.hfss3dlayout import Hfss3dLayout from pyaedt.modules.Boundary import CurrentSinSource from pyaedt.modules.Boundary import PowerIQSource from pyaedt.modules.Boundary import PowerSinSource @@ -37,23 +60,23 @@ class Circuit(FieldAnalysisCircuit, ScatteringMethods): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when Script is launched within AEDT. @@ -62,7 +85,7 @@ class Circuit(FieldAnalysisCircuit, ScatteringMethods): Whether to run AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. This parameter is ignored when @@ -84,7 +107,11 @@ class Circuit(FieldAnalysisCircuit, ScatteringMethods): `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -113,45 +140,53 @@ class Circuit(FieldAnalysisCircuit, ScatteringMethods): Create an instance of Circuit using the 2023 R2 version and open the specified project, which is ``"myfile.aedt"``. - >>> aedtapp = Circuit(specified_version=2023.2, projectname="myfile.aedt") + >>> aedtapp = Circuit(version=2023.2, project="myfile.aedt") Create an instance of Circuit using the 2023 R2 student version and open the specified project, which is named ``"myfile.aedt"``. - >>> hfss = Circuit(specified_version="2023.2", projectname="myfile.aedt", student_version=True) + >>> hfss = Circuit(version="2023.2", project="myfile.aedt", student_version=True) """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): FieldAnalysisCircuit.__init__( self, "Circuit Design", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) ScatteringMethods.__init__(self, self) self.onetwork_data_explorer = self._desktop.GetTool("NdExplorer") diff --git a/pyaedt/common_rpc.py b/pyaedt/common_rpc.py index b53a519c420..d5739c5bd3b 100644 --- a/pyaedt/common_rpc.py +++ b/pyaedt/common_rpc.py @@ -1,11 +1,35 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import signal import sys import tempfile import time -from pyaedt import is_ironpython from pyaedt.aedt_logger import pyaedt_logger as logger +from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.settings import settings from pyaedt.misc import list_installed_ansysem @@ -252,7 +276,7 @@ def launch_server(port=18000, ansysem_path=None, non_graphical=False, threaded=T t.start() -def create_session(server_name, client_port=None, launch_aedt_on_server=False, aedt_port=None, non_graphical=True): +def create_session(server_name, client_port=None, launch_aedt_on_server=False, aedt_port=None, non_graphical=False): """ Connect to an existing AEDT server session and create a new client session from it. diff --git a/pyaedt/desktop.py b/pyaedt/desktop.py index f9d5624cb85..7f69457a469 100644 --- a/pyaedt/desktop.py +++ b/pyaedt/desktop.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains the ``Desktop`` class. This module is used to initialize AEDT and the message manager for managing AEDT. @@ -22,12 +46,12 @@ import warnings from pyaedt import __version__ as pyaedt_version -from pyaedt import is_ironpython -from pyaedt import is_linux -from pyaedt import is_windows from pyaedt.aedt_logger import AedtLogger from pyaedt.aedt_logger import pyaedt_logger from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import is_ironpython +from pyaedt.generic.general_methods import is_linux +from pyaedt.generic.general_methods import is_windows if is_linux: os.environ["ANS_NODEPCHECK"] = str(1) @@ -38,7 +62,6 @@ import subprocess from pyaedt import __version__ -from pyaedt import pyaedt_function_handler from pyaedt.generic.desktop_sessions import _desktop_sessions from pyaedt.generic.desktop_sessions import _edb_sessions from pyaedt.generic.general_methods import active_sessions @@ -48,6 +71,7 @@ from pyaedt.generic.general_methods import inside_desktop from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.settings import settings from pyaedt.misc import current_student_version from pyaedt.misc import current_version @@ -390,7 +414,7 @@ class Desktop(object): Parameters ---------- - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active setup or latest installed version is used. Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. @@ -398,7 +422,7 @@ class Desktop(object): Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``True``. @@ -420,17 +444,17 @@ class Desktop(object): later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. Examples -------- Launch AEDT 2023 R1 in non-graphical mode and initialize HFSS. >>> import pyaedt - >>> desktop = pyaedt.Desktop(specified_version="2023.2", non_graphical=True) + >>> desktop = pyaedt.Desktop(version="2023.2", non_graphical=False) PyAEDT INFO: pyaedt v... PyAEDT INFO: Python version ... - >>> hfss = pyaedt.Hfss(designname="HFSSDesign1") + >>> hfss = pyaedt.Hfss(design="HFSSDesign1") PyAEDT INFO: Project... PyAEDT INFO: Added design 'HFSSDesign1' of type HFSS. @@ -439,7 +463,7 @@ class Desktop(object): >>> desktop = Desktop(232) PyAEDT INFO: pyaedt v... PyAEDT INFO: Python version ... - >>> hfss = pyaedt.Hfss(designname="HFSSDesign1") + >>> hfss = pyaedt.Hfss(design="HFSSDesign1") PyAEDT INFO: No project is defined. Project... """ @@ -448,14 +472,14 @@ class Desktop(object): def __new__(cls, *args, **kwargs): # The following commented lines will be useful when we will need to search among multiple saved desktop. - specified_version = kwargs.get("specified_version") or None if (not args or len(args) < 1) else args[0] - new_desktop_session = kwargs.get("new_desktop_session") or False if (not args or len(args) < 3) else args[2] + specified_version = kwargs.get("version") or None if (not args or len(args) < 1) else args[0] + new_desktop = kwargs.get("new_desktop") or False if (not args or len(args) < 3) else args[2] # student_version = kwargs.get("student_version") or False if (not args or len(args)<5) else args[4] # machine = kwargs.get("machine") or "" if (not args or len(args)<6) else args[5] specified_version = get_string_version(specified_version) port = kwargs.get("port") or 0 if (not args or len(args) < 7) else args[6] aedt_process_id = kwargs.get("aedt_process_id") or None if (not args or len(args) < 8) else args[7] - if settings.use_multi_desktop and not inside_desktop and new_desktop_session: + if settings.use_multi_desktop and not inside_desktop and new_desktop: pyaedt_logger.info("Initializing new Desktop session.") return object.__new__(cls) elif len(_desktop_sessions.keys()) > 0: @@ -482,20 +506,23 @@ def __new__(cls, *args, **kwargs): pyaedt_logger.info("Initializing new Desktop session.") return object.__new__(cls) - @pyaedt_function_handler() + @pyaedt_function_handler( + specified_version="version", + new_desktop_session="new_desktop", + ) def __init__( self, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, machine="", port=0, aedt_process_id=None, ): - if _desktop_sessions and specified_version is None: - specified_version = list(_desktop_sessions.values())[-1].aedt_version_id + if _desktop_sessions and version is None: + version = list(_desktop_sessions.values())[-1].aedt_version_id if aedt_process_id: # pragma no cover aedt_process_id = int(aedt_process_id) if getattr(self, "_initialized", None) is not None and self._initialized: @@ -516,20 +543,20 @@ def __init__( self.launched_by_pyaedt = False # Used in unit tests. The ``PYAEDT_NON_GRAPHICAL`` environment variable overrides - # the ``non_graphical`` argument. + # the ``graphical`` argument. if os.getenv("PYAEDT_NON_GRAPHICAL", None) is not None: # pragma no cover - non_graphical = os.getenv("PYAEDT_NON_GRAPHICAL", "false").lower() in ("true", "1", "t") + non_graphical = not os.getenv("PYAEDT_NON_GRAPHICAL", "false").lower() in ("true", "1", "t") # Used in Examples generation to force the desktop opening if os.getenv("PYAEDT_DOC_GENERATION", "False").lower() in ("true", "1", "t"): # pragma no cover - new_desktop_session = True + new_desktop = True # Used in toolkit scripts. The ``PYAEDT_SCRIPT_PROCESS_ID`` environment variable overrides # the ``aedt_process_id`` argument. if os.getenv("PYAEDT_SCRIPT_PROCESS_ID", None): # pragma no cover aedt_process_id = int(os.getenv("PYAEDT_SCRIPT_PROCESS_ID")) # Used in toolkit scripts. The ``PYAEDT_SCRIPT_VERSION`` environment variable overrides - # the ``specified_version`` argument. + # the ``version`` argument. if os.getenv("PYAEDT_SCRIPT_VERSION", None): # pragma no cover - specified_version = str(os.getenv("PYAEDT_SCRIPT_VERSION")) + version = str(os.getenv("PYAEDT_SCRIPT_VERSION")) self.close_on_exit = close_on_exit self.machine = machine @@ -557,7 +584,7 @@ def __init__( self._logger.info("Debug logger is enabled. PyAEDT methods will be logged.") else: self._logger.info("Debug logger is disabled. PyAEDT methods will not be logged.") - student_version_flag, version_key, version = self._assert_version(specified_version, student_version) + student_version_flag, version_key, version = self._assert_version(version, student_version) # start the AEDT opening decision tree # starting_mode can be one of these: "grpc", "com", "ironpython", "console_in", "console_out" @@ -573,10 +600,10 @@ def __init__( starting_mode = "grpc" elif is_ironpython: starting_mode = "ironpython" - elif aedt_process_id and not new_desktop_session and not is_ironpython: # pragma: no cover + elif aedt_process_id and not new_desktop and not is_ironpython: # pragma: no cover # connecting to an existing session has the precedence over use_grpc_api user preference sessions = active_sessions( - version=specified_version, student_version=student_version_flag, non_graphical=non_graphical + version=version, student_version=student_version_flag, non_graphical=non_graphical ) self.logger.info(sessions) if aedt_process_id in sessions: @@ -588,15 +615,15 @@ def __init__( else: raise ValueError( "The version specified ({}) doesn't correspond to the pid specified ({})".format( - specified_version, aedt_process_id + version, aedt_process_id ) ) elif float(version_key[0:6]) < 2022.2: # pragma no cover starting_mode = "com" - if non_graphical: + if self.non_graphical: self._logger.disable_desktop_log() elif float(version_key[0:6]) == 2022.2: # pragma no cover - if non_graphical: + if self.non_graphical: self._logger.disable_desktop_log() if self.machine and self.port: starting_mode = "grpc" # if the machine and port is specified, user wants to use gRPC @@ -627,12 +654,12 @@ def __init__( settings.aedt_version = version_key if starting_mode == "ironpython": # pragma no cover self._logger.info("Launching PyAEDT outside AEDT with IronPython.") - self._init_ironpython(non_graphical, new_desktop_session, version) + self._init_ironpython(non_graphical, new_desktop, version) elif starting_mode == "com": # pragma no cover self._logger.info("Launching PyAEDT outside AEDT with CPython and PythonNET.") self._init_dotnet( non_graphical, - new_desktop_session, + new_desktop, version, student_version_flag, version_key, @@ -640,7 +667,7 @@ def __init__( ) elif starting_mode == "grpc": self._logger.info("Launching PyAEDT outside AEDT with gRPC plugin.") - self._init_grpc(non_graphical, new_desktop_session, version, student_version_flag, version_key) + self._init_grpc(non_graphical, new_desktop, version, student_version_flag, version_key) self._set_logger_file() settings.enable_desktop_logs = not self.non_graphical @@ -650,7 +677,7 @@ def __init__( self._logger.info("Python version %s", sys.version) current_pid = int(self.odesktop.GetProcessID()) - if aedt_process_id and not new_desktop_session and aedt_process_id != current_pid: # pragma no cover + if aedt_process_id and not new_desktop and aedt_process_id != current_pid: # pragma no cover raise Exception( "AEDT started a new session instead of connecting to the session with pid: {}".format(aedt_process_id) ) @@ -1926,7 +1953,7 @@ def submit_ansys_cloud_job( -------- >>> from pyaedt import Desktop - >>> d = Desktop(specified_version="2023.1", new_desktop_session=False) + >>> d = Desktop(version="2023.1", new_desktop=False) >>> d.select_scheduler("Ansys Cloud") >>> out = d.get_available_cloud_config() >>> job_id, job_name = d.submit_ansys_cloud_job('via_gsg.aedt', @@ -2015,7 +2042,7 @@ def get_ansyscloud_job_info(self, job_id=None, job_name=None): # pragma: no cov -------- >>> from pyaedt import Desktop - >>> d = Desktop(specified_version="2023.1", new_desktop_session=False) + >>> d = Desktop(version="2023.1", new_desktop=False) >>> d.select_scheduler("Ansys Cloud") >>> out = d.get_available_cloud_config() >>> job_id, job_name = d.submit_ansys_cloud_job('via_gsg.aedt', @@ -2082,7 +2109,7 @@ def select_scheduler( -------- >>> from pyaedt import Desktop - >>> d = Desktop(specified_version="2023.1", new_desktop_session=False) + >>> d = Desktop(version="2023.1", new_desktop=False) >>> d.select_scheduler("Ansys Cloud") >>> out = d.get_available_cloud_config() >>> job_id, job_name = d.submit_ansys_cloud_job('via_gsg.aedt', @@ -2124,7 +2151,7 @@ def get_available_cloud_config(self, region="westeurope"): # pragma: no cover -------- >>> from pyaedt import Desktop - >>> d = Desktop(specified_version="2023.1", new_desktop_session=False) + >>> d = Desktop(version="2023.1", new_desktop=False) >>> d.select_scheduler("Ansys Cloud") >>> out = d.get_available_cloud_config() >>> job_id, job_name = d.submit_ansys_cloud_job('via_gsg.aedt', diff --git a/pyaedt/downloads.py b/pyaedt/downloads.py index bb85da981c5..6057dc170c6 100644 --- a/pyaedt/downloads.py +++ b/pyaedt/downloads.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Download example datasets from https://github.com/ansys/example-data""" import os diff --git a/pyaedt/edb.py b/pyaedt/edb.py index a3cc69fa28c..bbb9fc0d1b9 100644 --- a/pyaedt/edb.py +++ b/pyaedt/edb.py @@ -1,8 +1,140 @@ -from pyedb import Edb as App +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import os from pyaedt.generic.settings import settings log = settings.logger -log.warning("pyaedt.edb.Edb is Deprecated. Please use pyedb.Edb or pyaedt.Edb call instead") -Edb = App + +# lazy imports +def Edb( + edbpath=None, + cellname=None, + isreadonly=False, + edbversion=None, + isaedtowned=False, + oproject=None, + student_version=False, + use_ppe=False, + technology_file=None, +): + """Provides the EDB application interface. + + This module inherits all objects that belong to EDB. + + Parameters + ---------- + edbpath : str, optional + Full path to the ``aedb`` folder. The variable can also contain + the path to a layout to import. Allowed formats are BRD, + XML (IPC2581), GDS, and DXF. The default is ``None``. + For GDS import, the Ansys control file (also XML) should have the same + name as the GDS file. Only the file extension differs. + cellname : str, optional + Name of the cell to select. The default is ``None``. + isreadonly : bool, optional + Whether to open EBD in read-only mode when it is + owned by HFSS 3D Layout. The default is ``False``. + edbversion : str, optional + Version of EDB to use. The default is ``"2021.2"``. + isaedtowned : bool, optional + Whether to launch EDB from HFSS 3D Layout. The + default is ``False``. + oproject : optional + Reference to the AEDT project object. + student_version : bool, optional + Whether to open the AEDT student version. The default is ``False.`` + technology_file : str, optional + Full path to technology file to be converted to xml before importing or xml. Supported by GDS format only. + + Returns + ------- + :class:`pyedb.dotnet.edb.Edb`, :class:`pyedb.grpc.edb.Edb` + + Examples + -------- + Create an ``Edb`` object and a new EDB cell. + + >>> from pyedb import Edb + >>> app = Edb() + + Add a new variable named "s1" to the ``Edb`` instance. + + >>> app['s1'] = "0.25 mm" + >>> app['s1'].tofloat + >>> 0.00025 + >>> app['s1'].tostring + >>> "0.25mm" + + or add a new parameter with description: + + >>> app['s2'] = ["20um", "Spacing between traces"] + >>> app['s2'].value + >>> 1.9999999999999998e-05 + >>> app['s2'].description + >>> 'Spacing between traces' + + + Create an ``Edb`` object and open the specified project. + + >>> app = Edb("myfile.aedb") + + Create an ``Edb`` object from GDS and control files. + The XML control file resides in the same directory as the GDS file: (myfile.xml). + + >>> app = Edb("/path/to/file/myfile.gds") + + """ + + # Use EDB legacy (default choice) + if bool(os.getenv("PYEDB_USE_DOTNET", "1")): + from pyedb.dotnet.edb import Edb as app + + return app( + edbpath=edbpath, + cellname=cellname, + isreadonly=isreadonly, + edbversion=edbversion, + isaedtowned=isaedtowned, + oproject=oproject, + student_version=student_version, + use_ppe=use_ppe, + technology_file=technology_file, + ) + # TODO: Use EDB gRPC + else: + raise Exception("not implemented yet.") + + +def Siwave( + specified_version=None, +): + """Siwave Class.""" + from pyedb.siwave import Siwave as app + + return app( + specified_version=specified_version, + ) diff --git a/pyaedt/emit.py b/pyaedt/emit.py index f67e403be6e..86eab9f352d 100644 --- a/pyaedt/emit.py +++ b/pyaedt/emit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import import warnings @@ -17,19 +41,19 @@ class Emit(Design, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active setup is used or the latest installed version is used. @@ -38,7 +62,7 @@ class Emit(Design, object): Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -58,7 +82,11 @@ class Emit(Design, object): If the machine is `"localhost"`, the server starts if it is not present. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -69,7 +97,7 @@ class Emit(Design, object): Typically, it is desirable to specify a project name, design name, and other parameters. - >>> aedtapp = Emit(projectname, designame, specified_version=232) + >>> aedtapp = Emit(projectname, designame, version=232) Once an ``Emit`` instance is initialized, you can edit the schematic: @@ -99,19 +127,26 @@ class Emit(Design, object): >>> print("Worst-case sensitivity for Rx '{}' is {}dB.".format(domain.rx_radio_name, val)) """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): self.__emit_api_enabled = False self.results = None @@ -123,17 +158,18 @@ def __init__( Design.__init__( self, "EMIT", - projectname, - designname, + project, + design, solution_type, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine=machine, port=port, aedt_process_id=aedt_process_id, + remove_lock=remove_lock, ) self._modeler = ModelerEmit(self) self._couplings = CouplingsEmit(self) diff --git a/pyaedt/emit_core/Couplings.py b/pyaedt/emit_core/Couplings.py index 918ad5f8874..2eee0ec58e4 100644 --- a/pyaedt/emit_core/Couplings.py +++ b/pyaedt/emit_core/Couplings.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `CouplingsEmit`. This module provides for interacting with EMIT Analysis and Results windows. diff --git a/pyaedt/emit_core/__init__.py b/pyaedt/emit_core/__init__.py index 1a7b6de9744..1f9ca8efd46 100644 --- a/pyaedt/emit_core/__init__.py +++ b/pyaedt/emit_core/__init__.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import imp from importlib import import_module import os diff --git a/pyaedt/emit_core/emit_constants.py b/pyaedt/emit_core/emit_constants.py index 90364082825..9c09566b676 100644 --- a/pyaedt/emit_core/emit_constants.py +++ b/pyaedt/emit_core/emit_constants.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ Enums from the ``EmitApiPython`` module are defined as ``None`` until this module initializes. This allows IDE auto-complete to find them and ``emit_constants`` to import before the diff --git a/pyaedt/emit_core/results/__init__.py b/pyaedt/emit_core/results/__init__.py index 8b137891791..9c4476773da 100644 --- a/pyaedt/emit_core/results/__init__.py +++ b/pyaedt/emit_core/results/__init__.py @@ -1 +1,23 @@ - +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/emit_core/results/results.py b/pyaedt/emit_core/results/results.py index 5cc9d46b2f2..19b634523bf 100644 --- a/pyaedt/emit_core/results/results.py +++ b/pyaedt/emit_core/results/results.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import warnings from pyaedt import emit_core diff --git a/pyaedt/emit_core/results/revision.py b/pyaedt/emit_core/results/revision.py index 86973012ac4..ce94aceb32d 100644 --- a/pyaedt/emit_core/results/revision.py +++ b/pyaedt/emit_core/results/revision.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import warnings from pyaedt.emit_core.emit_constants import EmiCategoryFilter diff --git a/pyaedt/generic/DataHandlers.py b/pyaedt/generic/DataHandlers.py index 5312aa61439..19db10aac28 100644 --- a/pyaedt/generic/DataHandlers.py +++ b/pyaedt/generic/DataHandlers.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict from decimal import Decimal import math @@ -596,7 +619,7 @@ def from_rkm_to_aedt(code): setup = os.getenv('setup') with Desktop() as d: - maxwell_2d = Maxwell2d(designname=design_name, name=setup) + maxwell_2d = Maxwell2d(design=design_name, name=setup) maxwell_2d.setup_ctrlprog(keep_modifications=True ) d.logger.info("Successfully updated project definitions") maxwell_2d.save_project() diff --git a/pyaedt/generic/LoadAEDTFile.py b/pyaedt/generic/LoadAEDTFile.py index b679456cb04..785f3307ada 100644 --- a/pyaedt/generic/LoadAEDTFile.py +++ b/pyaedt/generic/LoadAEDTFile.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os.path import re diff --git a/pyaedt/generic/__init__.py b/pyaedt/generic/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/generic/__init__.py +++ b/pyaedt/generic/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/generic/clr_module.py b/pyaedt/generic/clr_module.py index 7564603c433..c331515755b 100644 --- a/pyaedt/generic/clr_module.py +++ b/pyaedt/generic/clr_module.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import pkgutil import sys diff --git a/pyaedt/generic/com_parameters.py b/pyaedt/generic/com_parameters.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/generic/com_parameters.py +++ b/pyaedt/generic/com_parameters.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/generic/compliance.py b/pyaedt/generic/compliance.py index 9f24c0012b1..27c702c74f5 100644 --- a/pyaedt/generic/compliance.py +++ b/pyaedt/generic/compliance.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os.path from pathlib import Path import time diff --git a/pyaedt/generic/configurations.py b/pyaedt/generic/configurations.py index 1fed6282028..351d0aa67cd 100644 --- a/pyaedt/generic/configurations.py +++ b/pyaedt/generic/configurations.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict import copy from datetime import datetime @@ -6,16 +30,14 @@ import tempfile import pyaedt -from pyaedt import Icepak from pyaedt import __version__ -from pyaedt import generate_unique_folder_name -from pyaedt import get_pyaedt_app -from pyaedt import is_ironpython from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.DataHandlers import _arg2dict from pyaedt.generic.LoadAEDTFile import load_keyword_in_aedt_file from pyaedt.generic.general_methods import GrpcApiError +from pyaedt.generic.general_methods import generate_unique_folder_name from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.general_methods import read_configuration_file @@ -1863,6 +1885,8 @@ def import_config(self, config_file, *args): @pyaedt_function_handler def _get_duplicate_names(self): # Copy project to get dictionary + from pyaedt.icepak import Icepak + directory = os.path.join( self._app.toolkit_directory, self._app.design_name, @@ -1870,7 +1894,7 @@ def _get_duplicate_names(self): ) os.makedirs(directory) tempproj_name = os.path.join(directory, "temp_proj.aedt") - tempproj = Icepak(tempproj_name, specified_version=self._app._aedt_version) + tempproj = Icepak(tempproj_name, version=self._app._aedt_version) empty_design = tempproj.design_list[0] self._app.modeler.refresh() self._app.modeler.delete( @@ -2088,6 +2112,8 @@ def apply_operations_to_native_components(obj, operation_dict, native_dict): # ]["DefnLink"]["Project"] not in [self._app.project_file or "This Project*"]: prj = list(set(self._app.project_list) - prj_list)[0] design = nc_dict["NativeComponentDefinitionProvider"]["DefnLink"]["Design"] + from pyaedt.generic.design_types import get_pyaedt_app + app = get_pyaedt_app(prj, design) app.oproject.Close() user_defined_component = UserDefinedComponent( diff --git a/pyaedt/generic/constants.py b/pyaedt/generic/constants.py index 854916e1640..33bcb86eda6 100644 --- a/pyaedt/generic/constants.py +++ b/pyaedt/generic/constants.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math import warnings diff --git a/pyaedt/generic/design_types.py b/pyaedt/generic/design_types.py index d63284d4b15..e54feb076b8 100644 --- a/pyaedt/generic/design_types.py +++ b/pyaedt/generic/design_types.py @@ -1,1557 +1,58 @@ -import re -import sys -import time - -from pyaedt import is_linux -from pyaedt.generic.settings import settings - - -# lazy imports -def Circuit( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Circuit Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. - This parameter is ignored when Script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to run AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. This parameter is ignored when - a script is launched within AEDT. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - This parameter is ignored when Script is launched within AEDT. - machine : str, optional - Machine name to which connect the oDesktop Session. Works only in 2022 R2 - or later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If a machine is `"localhost"`, the - server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or - later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.circuit.Circuit` - - Examples - -------- - Create an instance of Circuit and connect to an existing HFSS - design or create a new HFSS design if one does not exist. - - >>> from pyaedt import Circuit - >>> aedtapp = Circuit() - - Create an instance of Circuit and link to a project named - ``"projectname"``. If this project does not exist, create one with - this name. - - >>> aedtapp = Circuit(projectname) - - Create an instance of Circuit and link to a design named - ``"designname"`` in a project named ``"projectname"``. - - >>> aedtapp = Circuit(projectname,designame) - - Create an instance of Circuit and open the specified project, - which is ``"myfie.aedt"``. - - >>> aedtapp = Circuit("myfile.aedt") - - Create an instance of Circuit using the 2023 R2 version and - open the specified project, which is ``"myfile.aedt"``. - - >>> aedtapp = Circuit(specified_version=2023.2, projectname="myfile.aedt") - - Create an instance of Circuit using the 2023 R2 student version and open - the specified project, which is named ``"myfile.aedt"``. - - >>> hfss = Circuit(specified_version="2023.2", projectname="myfile.aedt", student_version=True) - - """ - from pyaedt.circuit import Circuit as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Hfss( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Return an instance of the Hfss Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. - This parameter is ignored when a script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to run AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. This parameter is ignored when - a script is launched within AEDT. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is - ``False``. This parameter is ignored when a script is launched - within AEDT. - machine : str, optional - Machine name to connect the oDesktop session to. This parameter works only on - 2022 R2 or later. The remote Server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, the server - starts if it is not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.hfss.Hfss` - - Examples - -------- - Create an instance of HFSS and connect to an existing HFSS - design or create a new HFSS design if one does not exist. - - >>> from pyaedt import Hfss - >>> hfss = Hfss() - PyAEDT INFO: No project is defined... - PyAEDT INFO: Active design is set to... - - - Create an instance of HFSS and link to a project named - ``HfssProject``. If this project does not exist, create one with - this name. - - >>> hfss = Hfss("HfssProject") - PyAEDT INFO: Project HfssProject has been created. - PyAEDT INFO: No design is present. Inserting a new design. - PyAEDT INFO: Added design ... - - - Create an instance of HFSS and link to a design named - ``HfssDesign1`` in a project named ``HfssProject``. - - >>> hfss = Hfss("HfssProject","HfssDesign1") - PyAEDT INFO: Added design 'HfssDesign1' of type HFSS. - - - Create an instance of HFSS and open the specified project, - which is named ``"myfile.aedt"``. - - >>> hfss = Hfss("myfile.aedt") - PyAEDT INFO: Project myfile has been created. - PyAEDT INFO: No design is present. Inserting a new design. - PyAEDT INFO: Added design... - - - Create an instance of HFSS using the 2023 R2 release and open - the specified project, which is named ``"myfile2.aedt"``. - - >>> hfss = Hfss(specified_version=232, projectname="myfile2.aedt") - PyAEDT INFO: Project myfile2 has been created. - PyAEDT INFO: No design is present. Inserting a new design. - PyAEDT INFO: Added design... - - - Create an instance of HFSS using the 2023 R2 student version and open - the specified project, which is named ``"myfile3.aedt"``. - - >>> hfss = Hfss(specified_version="2023.2", projectname="myfile3.aedt", student_version=True) - PyAEDT INFO: Project myfile3 has been created. - PyAEDT INFO: No design is present. Inserting a new design. - PyAEDT INFO: Added design... - - """ - from pyaedt.hfss import Hfss as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Icepak( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Icepak Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. - This parameter is ignored when Script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non-graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - This parameter is ignored when a script is launched within AEDT. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - If the machine is `"localhost"`, the server also starts if not present. - port : int, optional - Port number of which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.icepak.Icepak` - - Examples - -------- - - Create an instance of Icepak and connect to an existing Icepak - design or create a new Icepak design if one does not exist. - - >>> from pyaedt import Icepak - >>> icepak = Icepak() - PyAEDT INFO: No project is defined. Project ... - PyAEDT INFO: Active design is set to ... - - Create an instance of Icepak and link to a project named - ``IcepakProject``. If this project does not exist, create one with - this name. - - >>> icepak = Icepak("IcepakProject") - PyAEDT INFO: Project ... - PyAEDT INFO: Added design ... - - Create an instance of Icepak and link to a design named - ``IcepakDesign1`` in a project named ``IcepakProject``. - - >>> icepak = Icepak("IcepakProject", "IcepakDesign1") - PyAEDT INFO: Added design 'IcepakDesign1' of type Icepak. - - Create an instance of Icepak and open the specified project, - which is ``myipk.aedt``. - - >>> icepak = Icepak("myipk.aedt") - PyAEDT INFO: Project myipk has been created. - PyAEDT INFO: No design is present. Inserting a new design. - PyAEDT INFO: Added design ... - - Create an instance of Icepak using the 2023 R2 release and - open the specified project, which is ``myipk2.aedt``. - - >>> icepak = Icepak(specified_version=2023.2, projectname="myipk2.aedt") - PyAEDT INFO: Project... - PyAEDT INFO: No design is present. Inserting a new design. - PyAEDT INFO: Added design... - """ - from pyaedt.icepak import Icepak as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Emit( - projectname=None, - designname=None, - solution_type=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Emit Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which case - an attempt is made to get an active project. If no projects are - present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in which case - an attempt is made to get an active design. If no designs are - present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is ``None``, in which - case the default type is applied. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active setup is used or the latest installed version is - used. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to start the AEDT student version. The default is ``False``. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a server. This parameter works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - The default is ``0``. - machine : str, optional - Machine name that the Desktop session is to connect to. This - parameter works only in 2022 R2 and later. The remote server must be - up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - If the machine is `"localhost"`, the server starts if it is not present. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.emit.Emit` - - Examples - -------- - Create an ``Emit`` instance. You can also choose to define parameters for this instance here. - - >>> from pyaedt import Emit - >>> aedtapp = Emit() - - Typically, it is desirable to specify a project name, design name, and other parameters. - - >>> aedtapp = Emit(projectname, designame, specified_version=232) - - Once an ``Emit`` instance is initialized, you can edit the schematic: - - >>> rad1 = aedtapp.modeler.components.create_component("Bluetooth") - >>> ant1 = aedtapp.modeler.components.create_component("Antenna") - >>> if rad1 and ant1: - >>> ant1.move_and_connect_to(rad1) - - Once the schematic is generated, the ``Emit`` object can be analyzed to generate - a revision. Each revision is added as an element of the ``Emit`` object member's - revisions_list. - - >>> aedtapp.analyze() - - A revision within PyAEDT is analogous to a revision in AEDT. An interaction domain must - be defined and then used as the input to the run command used on that revision. - - >>> domain = aedtapp.interaction_domain() - >>> domain.rx_radio_name = "UE - HandHeld" - >>> interaction = aedtapp.revisions_list[0].run(domain) - - The output of the run command is an ``interaction`` object. This object summarizes the interaction data - that is defined in the interaction domain. - - >>> instance = interaction.worst_instance(ResultType.SENSITIVITY) - >>> val = instance.value(ResultType.SENSITIVITY) - >>> print("Worst-case sensitivity for Rx '{}' is {}dB.".format(domain.rx_radio_name, val)) - """ - from pyaedt.emit import Emit as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Hfss3dLayout( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, - ic_mode=None, -): - """Hfss3dLayout Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open or the path to the ``aedb`` folder or - ``edb.def`` file. The default is ``None``, in which case an - attempt is made to get an active project. If no projects are present, - an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False```, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - If the machine is `"localhost"`. the server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - ic_mode : bool, optional - Whether to set the design to IC mode or not. The default is ``None``, which means to retain - the existing setting. - - Returns - ------- - :class:`pyaedt.hfss3dlayout.Hfss3dLayout` - - Examples - -------- - Create an ``Hfss3dLayout`` object and connect to an existing HFSS - design or create a new HFSS design if one does not exist. - - >>> from pyaedt import Hfss3dLayout - >>> aedtapp = Hfss3dLayout() - - Create an ``Hfss3dLayout`` object and link to a project named - ``projectname``. If this project does not exist, create one with - this name. - - >>> aedtapp = Hfss3dLayout(projectname) - - Create an ``Hfss3dLayout`` object and link to a design named - ``designname`` in a project named ``projectname``. - - >>> aedtapp = Hfss3dLayout(projectname,designame) - - Create an ``Hfss3dLayout`` object and open the specified project. - - >>> aedtapp = Hfss3dLayout("myfile.aedt") - - Create an AEDT 2023 R1 object and then create a - ``Hfss3dLayout`` object and open the specified project. - - >>> aedtapp = Hfss3dLayout(specified_version="2023.1", projectname="myfile.aedt") - - Create an instance of ``Hfss3dLayout`` from an ``Edb`` - - >>> import pyaedt - >>> edb_path = "/path/to/edbfile.aedb" - >>> edb = pyaedt.Edb(edb_path, edbversion=231) - >>> edb.stackup.import_stackup("stackup.xml") # Import stackup. Manipulate edb, ... - >>> edb.save_edb() - >>> edb.close_edb() - >>> aedtapp = pyaedt.Hfss3dLayout(specified_version=231, projectname=edb_path) - """ - from pyaedt.hfss3dlayout import Hfss3dLayout as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ic_mode=ic_mode, - ) - - -def Maxwell2d( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Maxwell2d Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. - This parameter is ignored when a script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. This parameter is ignored when - a script is launched within AEDT. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - This parameter is ignored when a script is launched within AEDT. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 - or later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, - the server also starts if not present. - port : int, optional - Port number of which to start the oDesktop communication on an already existing - server. This parameter is ignored when creating a new server. It works only in 2022 - R2 or later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.maxwell.Maxwell2d`""" - from pyaedt.maxwell import Maxwell2d as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Maxwell3d( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Maxwell3d Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. This - parameter is ignored when a script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical - mode. This parameter is ignored when a script is launched within - AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. This parameter is ignored - when a script is launched within AEDT. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is - ``False``. This parameter is ignored when a script is launched - within AEDT. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 - or later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, the - server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when a new server is created. It works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.maxwell.Maxwell3d` - - Examples - -------- - Create an instance of Maxwell 3D and open the specified - project, which is named ``mymaxwell.aedt``. - - >>> from pyaedt import Maxwell3d - >>> aedtapp = Maxwell3d("mymaxwell.aedt") - PyAEDT INFO: Added design ... - - Create an instance of Maxwell 3D using the 2023 R2 release and open - the specified project, which is named ``mymaxwell2.aedt``. - - >>> aedtapp = Maxwell3d(specified_version="2023.2", projectname="mymaxwell2.aedt") - PyAEDT INFO: Added design ... - """ - from pyaedt.maxwell import Maxwell3d as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def MaxwellCircuit( - projectname=None, - designname=None, - solution_type=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """MaxwellCircuit Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``. If ``None``, - the active setup is used or the latest installed version is - used. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non-graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 - and later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, the server - is also started if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or - later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.maxwellcircuit.MaxwellCircuit`""" - from pyaedt.maxwellcircuit import MaxwellCircuit as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Mechanical( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Mechanical Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. - This parameter is ignored when a script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in the non-graphical mode. The default - is ``False``, in which case AEDT is launched in the graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. This parameter is ignored when - a script is launched within AEDT. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - This parameter is ignored when a script is launched within AEDT. - machine : str, optional - Machine name to connect the oDesktop session to. Works only in 2022R2 and - later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, - the server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or - later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.mechanical.Mechanical` - - Examples - -------- - Create an instance of Mechanical and connect to an existing - HFSS design or create a new HFSS design if one does not exist. - - >>> from pyaedt import Mechanical - >>> aedtapp = Mechanical() - - Create an instance of Mechanical and link to a project named - ``"projectname"``. If this project does not exist, create one with - this name. - - >>> aedtapp = Mechanical(projectname) - - Create an instance of Mechanical and link to a design named - ``"designname"`` in a project named ``"projectname"``. - - >>> aedtapp = Mechanical(projectname,designame) - - Create an instance of Mechanical and open the specified - project, which is named ``"myfile.aedt"``. - - >>> aedtapp = Mechanical("myfile.aedt") - - Create a ``Desktop on 2023 R2`` object and then create an - ``Mechanical`` object and open the specified project, which is - named ``"myfile.aedt"``. - - >>> aedtapp = Mechanical(specified_version=23.2, projectname="myfile.aedt") - """ - from pyaedt.mechanical import Mechanical as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Q2d( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Q2D Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. This - parameter is ignored when a script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. This parameter is ignored - when a script is launched within AEDT. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. This parameter is - ignored when a script is launched within AEDT. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 - and later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, - the server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.q3d.Q2d`""" - from pyaedt.q3d import Q2d as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Q3d( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Q3D Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or nothing - is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active version or latest installed version is used. - This parameter is ignored when Script is launched within AEDT. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. This parameter is ignored when - a script is launched within AEDT. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - This parameter is ignored when a script is launched within AEDT. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in - 2022 R2 and later. The remote server must be up and running with the - command `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, - the server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already - existing server. This parameter is ignored when a new server is created. - It works only in 2022 R2 and later. The remote server must be up and - running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.q3d.Q3d`""" - from pyaedt.q3d import Q3d as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Rmxprt( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Rmxprt Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case - the active setup is used or the latest installed version is - used. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 or - later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, the - server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or later. - The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.rmxprt.Rmxprt`""" - from pyaedt.rmxprt import Rmxprt as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def TwinBuilder( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """TwinBuilder Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which - case the active setup or latest installed version is - used. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 - or later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, - the server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or later. - The remote server must be up and running with command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.twinbuilder.TwinBuilder`""" - from pyaedt.twinbuilder import TwinBuilder as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. -def Simplorer( - projectname=None, - designname=None, - solution_type=None, - setup_name=None, - specified_version=None, - non_graphical=False, - new_desktop_session=False, - close_on_exit=False, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Simplorer Class. - - Parameters - ---------- - projectname : str, optional - Name of the project to select or the full path to the project - or AEDTZ archive to open. The default is ``None``, in which - case an attempt is made to get an active project. If no - projects are present, an empty project is created. - designname : str, optional - Name of the design to select. The default is ``None``, in - which case an attempt is made to get an active design. If no - designs are present, an empty design is created. - solution_type : str, optional - Solution type to apply to the design. The default is - ``None``, in which case the default type is applied. - setup_name : str, optional - Name of the setup to use as the nominal. The default is - ``None``, in which case the active setup is used or - nothing is used. - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which - case the active setup or latest installed version is - used. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the - machine. The default is ``False``. - close_on_exit : bool, optional - Whether to release AEDT on exit. The default is ``False``. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False``. - machine : str, optional - Machine name to connect the oDesktop session to. This works only in 2022 R2 - or later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, - the server also starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on an already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 or later. - The remote server must be up and running with command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.twinbuilder.TwinBuilder`""" - from pyaedt.twinbuilder import TwinBuilder as app - - return app( - projectname=projectname, - designname=designname, - solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) - - -def Desktop( - specified_version=None, - non_graphical=False, - new_desktop_session=True, - close_on_exit=True, - student_version=False, - machine="", - port=0, - aedt_process_id=None, -): - """Desktop Class. - Parameters - ---------- - specified_version : str, int, float, optional - Version of AEDT to use. The default is ``None``, in which case the - active setup or latest installed version is used. - Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non_graphical : bool, optional - Whether to launch AEDT in non-graphical mode. The default - is ``False``, in which case AEDT is launched in graphical mode. - This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional - Whether to launch an instance of AEDT in a new thread, even if - another instance of the ``specified_version`` is active on the machine. - The default is ``True``. - close_on_exit : bool, optional - Whether to close AEDT on exit. The default is ``True``. - This option is used only when Desktop is used in a context manager (``with`` statement). - If Desktop is used outside a context manager, see the ``release_desktop`` arguments. - student_version : bool, optional - Whether to open the AEDT student version. The default is - ``False``. - machine : str, optional - Machine name to connect the oDesktop session to. This parameter works only in 2022 R2 - and later. The remote server must be up and running with the command - `"ansysedt.exe -grpcsrv portnum"`. If the machine is `"localhost"`, the server also - starts if not present. - port : int, optional - Port number on which to start the oDesktop communication on the already existing server. - This parameter is ignored when creating a new server. It works only in 2022 R2 and - later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. - aedt_process_id : int, optional - Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. - - Returns - ------- - :class:`pyaedt.desktop.Desktop` - - Examples - -------- - Launch AEDT 2023 R1 in non-graphical mode and initialize HFSS. - - >>> import pyaedt - >>> desktop = pyaedt.Desktop(specified_version="2023.2", non_graphical=True) - PyAEDT INFO: pyaedt v... - PyAEDT INFO: Python version ... - >>> hfss = pyaedt.Hfss(designname="HFSSDesign1") - PyAEDT INFO: Project... - PyAEDT INFO: Added design 'HFSSDesign1' of type HFSS. +import re +import sys +import time - Launch AEDT 2023 R2 in graphical mode and initialize HFSS. +from pyaedt.circuit import Circuit +from pyaedt.desktop import Desktop - >>> desktop = Desktop(232) - PyAEDT INFO: pyaedt v... - PyAEDT INFO: Python version ... - >>> hfss = pyaedt.Hfss(designname="HFSSDesign1") - PyAEDT INFO: No project is defined. Project... - """ - from pyaedt.desktop import Desktop as app +Emit = None +if not ("IronPython" in sys.version or ".NETFramework" in sys.version): # pragma: no cover + from pyaedt.emit import Emit +from pyaedt.generic.general_methods import is_linux +from pyaedt.generic.settings import settings +from pyaedt.hfss3dlayout import Hfss3dLayout +from pyaedt.hfss import Hfss +from pyaedt.icepak import Icepak +from pyaedt.maxwell import Maxwell2d +from pyaedt.maxwell import Maxwell3d +from pyaedt.maxwellcircuit import MaxwellCircuit +from pyaedt.mechanical import Mechanical +from pyaedt.q3d import Q2d +from pyaedt.q3d import Q3d +from pyaedt.rmxprt import Rmxprt +from pyaedt.twinbuilder import TwinBuilder - return app( - specified_version=specified_version, - non_graphical=non_graphical, - new_desktop_session=new_desktop_session, - close_on_exit=close_on_exit, - student_version=student_version, - machine=machine, - port=port, - aedt_process_id=aedt_process_id, - ) +Simplorer = TwinBuilder def launch_desktop( - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, machine="", @@ -1562,14 +63,14 @@ def launch_desktop( Parameters ---------- - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active setup or latest installed version is used. non_graphical : bool, optional Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -1589,7 +90,7 @@ def launch_desktop( later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. Returns ------- @@ -1604,7 +105,7 @@ def launch_desktop( >>> desktop = pyaedt.launch_desktop("2022.2", non_graphical=True) PyAEDT INFO: pyaedt v... PyAEDT INFO: Python version ... - >>> hfss = pyaedt.Hfss(designname="HFSSDesign1") + >>> hfss = pyaedt.Hfss(design="HFSSDesign1") PyAEDT INFO: Project... PyAEDT INFO: Added design 'HFSSDesign1' of type HFSS. @@ -1613,13 +114,13 @@ def launch_desktop( >>> desktop = Desktop("2021.2") PyAEDT INFO: pyaedt v... PyAEDT INFO: Python version ... - >>> hfss = pyaedt.Hfss(designname="HFSSDesign1") + >>> hfss = pyaedt.Hfss(design="HFSSDesign1") PyAEDT INFO: No project is defined. Project... """ d = Desktop( - specified_version=specified_version, + version=version, non_graphical=non_graphical, - new_desktop_session=new_desktop_session, + new_desktop=new_desktop, close_on_exit=close_on_exit, student_version=student_version, machine=machine, @@ -1629,110 +130,6 @@ def launch_desktop( return d -def Edb( - edbpath=None, - cellname=None, - isreadonly=False, - edbversion=None, - isaedtowned=False, - oproject=None, - student_version=False, - use_ppe=False, - technology_file=None, -): - """Provides the EDB application interface. - - This module inherits all objects that belong to EDB. - - Parameters - ---------- - edbpath : str, int, float optional - Full path to the ``aedb`` folder. The variable can also contain - the path to a layout to import. Allowed formats are BRD, - XML (IPC2581), GDS, and DXF. The default is ``None``. - For GDS import, the Ansys control file (also XML) should have the same - name as the GDS file. Only the file extension differs. - cellname : str, optional - Name of the cell to select. The default is ``None``. - isreadonly : bool, optional - Whether to open EBD in read-only mode when it is - owned by HFSS 3D Layout. The default is ``False``. - edbversion : str, optional - Version of EDB to use. The default is ``"2021.2"``. - isaedtowned : bool, optional - Whether to launch EDB from HFSS 3D Layout. The - default is ``False``. - oproject : optional - Reference to the AEDT project object. - student_version : bool, optional - Whether to open the AEDT student version. The default is ``False.`` - technology_file : str, optional - Full path to technology file to be converted to xml before importing or xml. Supported by GDS format only. - - Returns - ------- - :class:`pyaedt.edb.Edb` - - Examples - -------- - Create an ``Edb`` object and a new EDB cell. - - >>> from pyaedt import Edb - >>> app = Edb() - - Add a new variable named "s1" to the ``Edb`` instance. - - >>> app['s1'] = "0.25 mm" - >>> app['s1'].tofloat - >>> 0.00025 - >>> app['s1'].tostring - >>> "0.25mm" - - or add a new parameter with description: - - >>> app['s2'] = ["20um", "Spacing between traces"] - >>> app['s2'].value - >>> 1.9999999999999998e-05 - >>> app['s2'].description - >>> 'Spacing between traces' - - - Create an ``Edb`` object and open the specified project. - - >>> app = Edb("myfile.aedb") - - Create an ``Edb`` object from GDS and control files. - The XML control file resides in the same directory as the GDS file: (myfile.xml). - - >>> app = Edb("/path/to/file/myfile.gds") - - """ - from pyedb import Edb as app - - return app( - edbpath=edbpath, - cellname=cellname, - isreadonly=isreadonly, - edbversion=edbversion, - isaedtowned=isaedtowned, - oproject=oproject, - student_version=student_version, - use_ppe=use_ppe, - technology_file=technology_file, - ) - - -def Siwave( - specified_version=None, -): - """Siwave Class.""" - from pyedb.siwave import Siwave as app - - return app( - specified_version=specified_version, - ) - - app_map = { "Maxwell 2D": Maxwell2d, "Maxwell 3D": Maxwell3d, @@ -1747,9 +144,6 @@ def Siwave( "Rmxprt": Rmxprt, "HFSS 3D Layout Design": Hfss3dLayout, "EMIT": Emit, - "EDB": Edb, - "Desktop": Desktop, - "Siwave": Siwave, } @@ -1821,5 +215,5 @@ def get_pyaedt_app(project_name=None, design_name=None, desktop=None): if design_type in list(app_map.keys()): version = odesktop.GetVersion().split(".") v = ".".join([version[0], version[1]]) - return app_map[design_type](project_name, design_name, specified_version=v, aedt_process_id=process_id) + return app_map[design_type](project_name, design_name, version=v, aedt_process_id=process_id) return None diff --git a/pyaedt/generic/desktop_sessions.py b/pyaedt/generic/desktop_sessions.py index 87032cbae18..d348a47d551 100644 --- a/pyaedt/generic/desktop_sessions.py +++ b/pyaedt/generic/desktop_sessions.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # This contains the Desktops database. # When AEDT will support multiple desktops, it will be filled with additional properties and methods diff --git a/pyaedt/generic/filesystem.py b/pyaedt/generic/filesystem.py index 694351b7a6d..6b68f969a5e 100644 --- a/pyaedt/generic/filesystem.py +++ b/pyaedt/generic/filesystem.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import random import shutil diff --git a/pyaedt/generic/general_methods.py b/pyaedt/generic/general_methods.py index 035e193da09..444238aa5fc 100644 --- a/pyaedt/generic/general_methods.py +++ b/pyaedt/generic/general_methods.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import import ast @@ -196,6 +219,8 @@ def raise_exception_or_return_false(e): for v in list(_desktop_sessions.values())[:]: v.release_desktop(v.launched_by_pyaedt, v.launched_by_pyaedt) raise e + elif "__init__" in str(e): # pragma: no cover + return else: return False diff --git a/pyaedt/generic/grpc_plugin_dll_class.py b/pyaedt/generic/grpc_plugin_dll_class.py index 5e7d7233646..450b38483c8 100644 --- a/pyaedt/generic/grpc_plugin_dll_class.py +++ b/pyaedt/generic/grpc_plugin_dll_class.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import CFUNCTYPE from ctypes import PyDLL from ctypes import c_bool diff --git a/pyaedt/generic/ibis_reader.py b/pyaedt/generic/ibis_reader.py index bbc4bc29698..25bd8078a4d 100644 --- a/pyaedt/generic/ibis_reader.py +++ b/pyaedt/generic/ibis_reader.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json import os import re diff --git a/pyaedt/generic/near_field_import.py b/pyaedt/generic/near_field_import.py index 34c403a2455..fa27440a399 100644 --- a/pyaedt/generic/near_field_import.py +++ b/pyaedt/generic/near_field_import.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import csv import os import re diff --git a/pyaedt/generic/pdf.py b/pyaedt/generic/pdf.py index e9d7fb9b2c2..64cc29b29bb 100644 --- a/pyaedt/generic/pdf.py +++ b/pyaedt/generic/pdf.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from dataclasses import dataclass from dataclasses import field import json diff --git a/pyaedt/generic/plot.py b/pyaedt/generic/plot.py index a2ed87de43e..b24531281c2 100644 --- a/pyaedt/generic/plot.py +++ b/pyaedt/generic/plot.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import ast from collections import defaultdict import csv @@ -8,11 +32,11 @@ import time import warnings -from pyaedt import pyaedt_function_handler from pyaedt.generic.constants import AEDT_UNITS from pyaedt.generic.constants import CSS4_COLORS from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file +from pyaedt.generic.general_methods import pyaedt_function_handler if not is_ironpython: try: diff --git a/pyaedt/generic/python_optimizers.py b/pyaedt/generic/python_optimizers.py index 2d0bf18df25..57ac916e7cc 100644 --- a/pyaedt/generic/python_optimizers.py +++ b/pyaedt/generic/python_optimizers.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import sys import threading import warnings diff --git a/pyaedt/generic/report_file_parser.py b/pyaedt/generic/report_file_parser.py index 55c2467e560..1a45b3cd21b 100644 --- a/pyaedt/generic/report_file_parser.py +++ b/pyaedt/generic/report_file_parser.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.generic.LoadAEDTFile import load_keyword_in_aedt_file from pyaedt.generic.constants import SI_UNITS from pyaedt.generic.constants import unit_system diff --git a/pyaedt/generic/settings.py b/pyaedt/generic/settings.py index 40e962b3a8b..7c23d27251a 100644 --- a/pyaedt/generic/settings.py +++ b/pyaedt/generic/settings.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import time @@ -73,7 +97,7 @@ def __init__(self): self._retry_n_times_time_interval = 0.1 self._wait_for_license = False self.__lazy_load = True - self.__objects_lazy_load = False + self.__objects_lazy_load = True @property def release_on_exception(self): diff --git a/pyaedt/generic/spisim.py b/pyaedt/generic/spisim.py index df5f1910880..5203dfdb230 100644 --- a/pyaedt/generic/spisim.py +++ b/pyaedt/generic/spisim.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # coding=utf-8 from collections import OrderedDict import os @@ -9,13 +33,13 @@ from numpy import float64 from numpy import zeros -from pyaedt import generate_unique_folder_name from pyaedt import generate_unique_name -from pyaedt import is_linux -from pyaedt import pyaedt_function_handler -from pyaedt import settings from pyaedt.generic.general_methods import env_value +from pyaedt.generic.general_methods import generate_unique_folder_name from pyaedt.generic.general_methods import open_file +from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.settings import is_linux +from pyaedt.generic.settings import settings from pyaedt.misc import current_version from pyaedt.misc.spisim_com_configuration_files.com_parameters import COMParametersVer3p4 diff --git a/pyaedt/generic/touchstone_parser.py b/pyaedt/generic/touchstone_parser.py index e70e07fc381..bed51504ac1 100644 --- a/pyaedt/generic/touchstone_parser.py +++ b/pyaedt/generic/touchstone_parser.py @@ -1,10 +1,34 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from copy import copy import itertools import os import re import subprocess -from pyaedt import is_ironpython +from pyaedt.generic.general_methods import is_ironpython from pyaedt.misc.misc import installed_versions if not is_ironpython: diff --git a/pyaedt/hfss.py b/pyaedt/hfss.py index c56b0e3d2a7..0ea28f8cd15 100644 --- a/pyaedt/hfss.py +++ b/pyaedt/hfss.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains these classes: ``Hfss`` and ``BoundaryType``.""" from __future__ import absolute_import # noreorder @@ -40,12 +64,12 @@ class Hfss(FieldAnalysis3D, ScatteringMethods): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. @@ -61,11 +85,11 @@ class Hfss(FieldAnalysis3D, ScatteringMethods): - "Transient" - "Eigenmode" - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when a script is launched within AEDT. @@ -74,7 +98,7 @@ class Hfss(FieldAnalysis3D, ScatteringMethods): Whether to run AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. This parameter is ignored when @@ -96,7 +120,11 @@ class Hfss(FieldAnalysis3D, ScatteringMethods): The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -138,7 +166,7 @@ class Hfss(FieldAnalysis3D, ScatteringMethods): Create an instance of HFSS using the 2023 R2 release and open the specified project, which is named ``"myfile2.aedt"``. - >>> hfss = Hfss(specified_version=232, projectname="myfile2.aedt") + >>> hfss = Hfss(version=232, project="myfile2.aedt") PyAEDT INFO: Project myfile2 has been created. PyAEDT INFO: No design is present. Inserting a new design. PyAEDT INFO: Added design... @@ -147,7 +175,7 @@ class Hfss(FieldAnalysis3D, ScatteringMethods): Create an instance of HFSS using the 2023 R2 student version and open the specified project, which is named ``"myfile3.aedt"``. - >>> hfss = Hfss(specified_version="2023.2", projectname="myfile3.aedt", student_version=True) + >>> hfss = Hfss(version="2023.2", project="myfile3.aedt", student_version=True) PyAEDT INFO: Project myfile3 has been created. PyAEDT INFO: No design is present. Inserting a new design. PyAEDT INFO: Added design... @@ -162,36 +190,44 @@ class Hfss(FieldAnalysis3D, ScatteringMethods): # except Exception: # return "HFSS Module" + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): FieldAnalysis3D.__init__( self, "HFSS", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) ScatteringMethods.__init__(self, self) self._field_setups = [] @@ -1173,10 +1209,10 @@ def create_sbr_linked_antenna( >>> from pyaedt import Hfss >>> target_project = "my/path/to/targetProject.aedt" >>> source_project = "my/path/to/sourceProject.aedt" - >>> target = Hfss(projectname=target_project, solution_type="SBR+", - ... specified_version="2021.2", new_desktop_session=False) # doctest: +SKIP - >>> source = Hfss(projectname=source_project, designname="feeder", - ... specified_version="2021.2", new_desktop_session=False) # doctest: +SKIP + >>> target = Hfss(project=target_project, solution_type="SBR+", + ... version="2021.2", new_desktop=False) # doctest: +SKIP + >>> source = Hfss(project=source_project, design="feeder", + ... version="2021.2", new_desktop=False) # doctest: +SKIP >>> target.create_sbr_linked_antenna(source,target_cs="feederPosition",field_type="farfield") # doctest: +SKIP """ diff --git a/pyaedt/hfss3dlayout.py b/pyaedt/hfss3dlayout.py index 8bc9b0abf6c..cf0d9026a31 100644 --- a/pyaedt/hfss3dlayout.py +++ b/pyaedt/hfss3dlayout.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains the ``Hfss3dLayout`` class.""" from __future__ import absolute_import # noreorder @@ -8,10 +32,10 @@ import os import re -from pyaedt import is_ironpython from pyaedt.application.Analysis3DLayout import FieldAnalysis3DLayout from pyaedt.application.analysis_hf import ScatteringMethods from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import parse_excitation_file from pyaedt.generic.general_methods import pyaedt_function_handler @@ -29,32 +53,32 @@ class Hfss3dLayout(FieldAnalysis3DLayout, ScatteringMethods): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open or the path to the ``aedb`` folder or ``edb.def`` file. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. non_graphical : bool, optional Whether to launch AEDT in non-graphical mode. The default - is ``False```, in which case AEDT is launched in graphical mode. + is ``True```, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -72,10 +96,14 @@ class Hfss3dLayout(FieldAnalysis3DLayout, ScatteringMethods): The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. ic_mode : bool, optional Whether to set the design to IC mode or not. The default is ``None``, which means to retain the existing setting. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -103,7 +131,7 @@ class Hfss3dLayout(FieldAnalysis3DLayout, ScatteringMethods): Create an AEDT 2023 R1 object and then create a ``Hfss3dLayout`` object and open the specified project. - >>> aedtapp = Hfss3dLayout(specified_version="2023.1", projectname="myfile.aedt") + >>> aedtapp = Hfss3dLayout(version="2023.1", project="myfile.aedt") Create an instance of ``Hfss3dLayout`` from an ``Edb`` @@ -113,42 +141,50 @@ class Hfss3dLayout(FieldAnalysis3DLayout, ScatteringMethods): >>> edb.stackup.import_stackup("stackup.xml") # Import stackup. Manipulate edb, ... >>> edb.save_edb() >>> edb.close_edb() - >>> aedtapp = pyaedt.Hfss3dLayout(specified_version=231, projectname=edb_path) + >>> aedtapp = pyaedt.Hfss3dLayout(version=231, project=edb_path) """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, ic_mode=None, + remove_lock=False, ): FieldAnalysis3DLayout.__init__( self, "HFSS 3D Layout Design", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, ic_mode, + remove_lock=remove_lock, ) ScatteringMethods.__init__(self, self) @@ -710,7 +746,7 @@ def import_edb(self, input_folder): self._close_edb() project_name = self.desktop_class.active_project().GetName() design_name = self.desktop_class.active_design(self.desktop_class.active_project()).GetName().split(";")[-1] - self.__init__(projectname=project_name, designname=design_name) + self.__init__(project=project_name, design=design_name) return True @pyaedt_function_handler(outputdir="output_dir") diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index ecfdd0a1668..20bb74aa947 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains the ``Icepak`` class.""" from __future__ import absolute_import # noreorder @@ -9,7 +33,6 @@ import warnings import pyaedt -from pyaedt import is_linux from pyaedt.application.Analysis3D import FieldAnalysis3D from pyaedt.application.Design import DesignSettingsManipulation from pyaedt.generic.DataHandlers import _arg2dict @@ -20,6 +43,7 @@ from pyaedt.generic.general_methods import generate_unique_name from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.settings import is_linux from pyaedt.generic.settings import settings from pyaedt.modeler.cad.components_3d import UserDefinedComponent from pyaedt.modeler.cad.elements3d import FacePrimitive @@ -49,32 +73,32 @@ class Icepak(FieldAnalysis3D): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when Script is launched within AEDT. Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non-graphical : bool, optional + non_graphical : bool, optional Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -93,7 +117,11 @@ class Icepak(FieldAnalysis3D): The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -131,42 +159,50 @@ class Icepak(FieldAnalysis3D): Create an instance of Icepak using the 2023 R2 release and open the specified project, which is ``myipk2.aedt``. - >>> icepak = Icepak(specified_version=2023.2, projectname="myipk2.aedt") + >>> icepak = Icepak(version=2023.2, project="myipk2.aedt") PyAEDT INFO: Project... PyAEDT INFO: No design is present. Inserting a new design. PyAEDT INFO: Added design... """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): FieldAnalysis3D.__init__( self, "Icepak", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self._monitor = Monitor(self) self._configurations = ConfigurationsIcepak(self) @@ -4551,7 +4587,7 @@ def get_fans_operating_point(self, export_file=None, setup_name=None, time_step= export_file : str, optional Name of the file in which the fans' operating point is saved. The default is ``None``, in which case the filename is automatically generated. - setup_name : str, optional + setup : str, optional Setup name from which to determine the fans' operating point. The default is ``None``, in which case the first available setup is used. time_step : str, optional diff --git a/pyaedt/maxwell.py b/pyaedt/maxwell.py index 0d5ead781d7..1b9b658c687 100644 --- a/pyaedt/maxwell.py +++ b/pyaedt/maxwell.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains these Maxwell classes: ``Maxwell``, ``Maxwell2d``, and ``Maxwell3d``.""" from __future__ import absolute_import # noreorder @@ -8,7 +32,6 @@ import re import time -from pyaedt import settings from pyaedt.application.Analysis3D import FieldAnalysis3D from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.constants import SOLUTIONS @@ -18,6 +41,7 @@ from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.general_methods import read_configuration_file from pyaedt.generic.general_methods import write_configuration_file +from pyaedt.generic.settings import settings from pyaedt.modeler.geometry_operators import GeometryOperators from pyaedt.modules.Boundary import BoundaryObject from pyaedt.modules.Boundary import MaxwellParameters @@ -281,7 +305,7 @@ def assign_matrix( Set matrix in a Maxwell magnetostatic analysis. >>> from pyaedt import Maxwell2d - >>> m2d = Maxwell2d(solution_type="MagnetostaticXY",specified_version="2022.1",close_on_exit=True) + >>> m2d = Maxwell2d(solution_type="MagnetostaticXY",version="2022.1",close_on_exit=True) >>> coil1 = m2d.modeler.create_rectangle([0, 1.5, 0], [8, 3], is_covered=True, name="Coil_1") >>> coil2 = m2d.modeler.create_rectangle([8.5, 1.5, 0], [8, 3], is_covered=True, name="Coil_2") >>> coil3 = m2d.modeler.create_rectangle([16, 1.5, 0], [8, 3], is_covered=True, name="Coil_3") @@ -2046,23 +2070,23 @@ class Maxwell3d(Maxwell, FieldAnalysis3D, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when a script is launched within AEDT. @@ -2072,7 +2096,7 @@ class Maxwell3d(Maxwell, FieldAnalysis3D, object): is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. This parameter is ignored @@ -2094,7 +2118,11 @@ class Maxwell3d(Maxwell, FieldAnalysis3D, object): The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -2108,7 +2136,7 @@ class Maxwell3d(Maxwell, FieldAnalysis3D, object): Create an instance of Maxwell 3D using the 2024 R1 release and open the specified project, which is named ``mymaxwell2.aedt``. - >>> m3d = Maxwell3d(specified_version="2024.1", projectname="mymaxwell2.aedt") + >>> m3d = Maxwell3d(version="2024.1", project="mymaxwell2.aedt") PyAEDT INFO: Added design ... """ @@ -2118,20 +2146,27 @@ def dim(self): """Dimensions.""" return "3D" + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): """ Initialize the ``Maxwell`` class. @@ -2140,18 +2175,19 @@ def __init__( FieldAnalysis3D.__init__( self, "Maxwell 3D", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) Maxwell.__init__(self) @@ -2800,23 +2836,23 @@ class Maxwell2d(Maxwell, FieldAnalysis3D, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when a script is launched within AEDT. @@ -2825,7 +2861,7 @@ class Maxwell2d(Maxwell, FieldAnalysis3D, object): Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. This parameter is ignored when @@ -2846,7 +2882,11 @@ class Maxwell2d(Maxwell, FieldAnalysis3D, object): R2 or later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -2885,37 +2925,45 @@ def geometry_mode(self): >>> oDesign.GetGeometryMode""" return self.odesign.GetGeometryMode() + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): self.is3d = False FieldAnalysis3D.__init__( self, "Maxwell 2D", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) Maxwell.__init__(self) diff --git a/pyaedt/maxwellcircuit.py b/pyaedt/maxwellcircuit.py index cc191e7cea3..f2a0faa1a85 100644 --- a/pyaedt/maxwellcircuit.py +++ b/pyaedt/maxwellcircuit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains the ``MaxwellCircuit`` class.""" from __future__ import absolute_import # noreorder @@ -15,25 +39,25 @@ class MaxwellCircuit(AnalysisMaxwellCircuit, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``. If ``None``, the active setup is used or the latest installed version is used. Examples of input values are ``232``, ``23.2``,``2023.2``,``"2023.2"``. - non-graphical : bool, optional + non_graphical : bool, optional Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -52,7 +76,11 @@ class MaxwellCircuit(AnalysisMaxwellCircuit, object): later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -80,34 +108,42 @@ class MaxwellCircuit(AnalysisMaxwellCircuit, object): >>> app = MaxwellCircuit("myfile.aedt") """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): """Constructor.""" AnalysisMaxwellCircuit.__init__( self, "Maxwell Circuit", - projectname, - designname, - specified_version, + project, + design, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) def _init_from_design(self, *args, **kwargs): diff --git a/pyaedt/mechanical.py b/pyaedt/mechanical.py index 7bd52e6e314..32230036327 100644 --- a/pyaedt/mechanical.py +++ b/pyaedt/mechanical.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains the ``Mechanical`` class.""" from __future__ import absolute_import # noreorder @@ -16,23 +40,23 @@ class Mechanical(FieldAnalysis3D, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when a script is launched within AEDT. @@ -41,7 +65,7 @@ class Mechanical(FieldAnalysis3D, object): Whether to launch AEDT in the non-graphical mode. The default is ``False``, in which case AEDT is launched in the graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. This parameter is ignored when @@ -62,7 +86,11 @@ class Mechanical(FieldAnalysis3D, object): later. The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -92,40 +120,48 @@ class Mechanical(FieldAnalysis3D, object): ``Mechanical`` object and open the specified project, which is named ``"myfile.aedt"``. - >>> aedtapp = Mechanical(specified_version=23.2, projectname="myfile.aedt") + >>> aedtapp = Mechanical(version=23.2, project="myfile.aedt") """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): FieldAnalysis3D.__init__( self, "Mechanical", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) def _init_from_design(self, *args, **kwargs): diff --git a/pyaedt/misc/__init__.py b/pyaedt/misc/__init__.py index 0a5470b6bf7..5cbb8146ac5 100644 --- a/pyaedt/misc/__init__.py +++ b/pyaedt/misc/__init__.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.misc.misc import current_student_version from pyaedt.misc.misc import current_version from pyaedt.misc.misc import installed_versions diff --git a/pyaedt/misc/create_remote_dir.py b/pyaedt/misc/create_remote_dir.py index 61750cebc7a..2996053836f 100644 --- a/pyaedt/misc/create_remote_dir.py +++ b/pyaedt/misc/create_remote_dir.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import sys diff --git a/pyaedt/misc/misc.py b/pyaedt/misc/misc.py index e3668e7865c..d57e8d86f6d 100644 --- a/pyaedt/misc/misc.py +++ b/pyaedt/misc/misc.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Miscellaneous Methods for PyAEDT.""" import os diff --git a/pyaedt/misc/spisim_com_configuration_files/__init__.py b/pyaedt/misc/spisim_com_configuration_files/__init__.py index c23e620fcaf..addb0938ec4 100644 --- a/pyaedt/misc/spisim_com_configuration_files/__init__.py +++ b/pyaedt/misc/spisim_com_configuration_files/__init__.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pathlib import Path workdir = Path(__file__).parent diff --git a/pyaedt/misc/spisim_com_configuration_files/com_parameters.py b/pyaedt/misc/spisim_com_configuration_files/com_parameters.py index 7aaeddda5c7..1bec9c5c696 100644 --- a/pyaedt/misc/spisim_com_configuration_files/com_parameters.py +++ b/pyaedt/misc/spisim_com_configuration_files/com_parameters.py @@ -1,9 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from enum import Enum import json from pathlib import Path -from pyaedt import pyaedt_function_handler -from pyaedt import settings +from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.settings import settings from pyaedt.misc.spisim_com_configuration_files.com_settings_mapping import spimsim_matlab_keywords_mapping logger = settings.logger diff --git a/pyaedt/misc/spisim_com_configuration_files/com_settings_mapping.py b/pyaedt/misc/spisim_com_configuration_files/com_settings_mapping.py index 942f327492c..7c30eac24ca 100644 --- a/pyaedt/misc/spisim_com_configuration_files/com_settings_mapping.py +++ b/pyaedt/misc/spisim_com_configuration_files/com_settings_mapping.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + spimsim_matlab_keywords_mapping = { # Matlab keyword -> SPIsim keyword # OP_IO_CTRL diff --git a/pyaedt/modeler/__init__.py b/pyaedt/modeler/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/modeler/__init__.py +++ b/pyaedt/modeler/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/modeler/advanced_cad/__init__.py b/pyaedt/modeler/advanced_cad/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/modeler/advanced_cad/__init__.py +++ b/pyaedt/modeler/advanced_cad/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/modeler/advanced_cad/actors.py b/pyaedt/modeler/advanced_cad/actors.py index 3c2ed987849..811be43a412 100644 --- a/pyaedt/modeler/advanced_cad/actors.py +++ b/pyaedt/modeler/advanced_cad/actors.py @@ -1,4 +1,28 @@ -from pyaedt import pyaedt_function_handler +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.general_methods import read_json from pyaedt.modeler.advanced_cad.multiparts import Actor from pyaedt.modeler.advanced_cad.multiparts import MultiPartComponent diff --git a/pyaedt/modeler/advanced_cad/multiparts.py b/pyaedt/modeler/advanced_cad/multiparts.py index eeff6d0f9fe..f57bde5199b 100644 --- a/pyaedt/modeler/advanced_cad/multiparts.py +++ b/pyaedt/modeler/advanced_cad/multiparts.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from pyaedt.generic.filesystem import get_json_files diff --git a/pyaedt/modeler/advanced_cad/oms.py b/pyaedt/modeler/advanced_cad/oms.py index 9f230692036..f496b0b56b2 100644 --- a/pyaedt/modeler/advanced_cad/oms.py +++ b/pyaedt/modeler/advanced_cad/oms.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import warnings diff --git a/pyaedt/modeler/advanced_cad/parts.py b/pyaedt/modeler/advanced_cad/parts.py index 87f5cbf0dd5..1d5809dd46a 100644 --- a/pyaedt/modeler/advanced_cad/parts.py +++ b/pyaedt/modeler/advanced_cad/parts.py @@ -1,6 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os -from pyaedt import pyaedt_function_handler +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.geometry_operators import GeometryOperators diff --git a/pyaedt/modeler/advanced_cad/stackup_3d.py b/pyaedt/modeler/advanced_cad/stackup_3d.py index b9e9f37ac8e..84ad110bd08 100644 --- a/pyaedt/modeler/advanced_cad/stackup_3d.py +++ b/pyaedt/modeler/advanced_cad/stackup_3d.py @@ -1,7 +1,31 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict import os -from pyaedt import is_ironpython +from pyaedt.generic.general_methods import is_ironpython if not is_ironpython: try: @@ -806,7 +830,7 @@ def add_trace( >>> from pyaedt import Hfss >>> from pyaedt.modeler.stackup_3d import Stackup3D - >>> hfss = Hfss(new_desktop_session=True) + >>> hfss = Hfss(new_desktop=True) >>> my_stackup = Stackup3D(hfss, 2.5e9) >>> gnd = my_stackup.add_ground_layer("gnd") >>> my_stackup.add_dielectric_layer("diel1", thickness=1.5, material="Duroid (tm)") @@ -1232,7 +1256,7 @@ class Stackup3D(object): >>> from pyaedt import Hfss >>> from pyaedt.modeler.stackup_3d import Stackup3D - >>> hfss = Hfss(new_desktop_session=True) + >>> hfss = Hfss(new_desktop=True) >>> my_stackup = Stackup3D(hfss, 2.5e9) """ @@ -2637,7 +2661,7 @@ class Trace(CommonObject, object): -------- >>> from pyaedt import Hfss >>> from pyaedt.modeler.stackup_3d import Stackup3D - >>> hfss = Hfss(new_desktop_session=True) + >>> hfss = Hfss(new_desktop=True) >>> my_stackup = Stackup3D(hfss, 2.5e9) >>> gnd = my_stackup.add_ground_layer("gnd") >>> my_stackup.add_dielectric_layer("diel1", thickness=1.5, material="Duroid (tm)") @@ -3220,7 +3244,7 @@ def create_lumped_port(self, reference_layer, opposite_side=False, port_name=Non -------- >>> from pyaedt import Hfss >>> from pyaedt.modeler.stackup_3d import Stackup3D - >>> hfss = Hfss(new_desktop_session=True) + >>> hfss = Hfss(new_desktop=True) >>> my_stackup = Stackup3D(hfss, 2.5e9) >>> gnd = my_stackup.add_ground_layer("gnd") >>> my_stackup.add_dielectric_layer("diel1", thickness=1.5, material="Duroid (tm)") @@ -3296,7 +3320,7 @@ class Polygon(CommonObject, object): >>> from pyaedt import Hfss >>> from pyaedt.modeler.stackup_3d import Stackup3D - >>> hfss = Hfss(new_desktop_session=True) + >>> hfss = Hfss(new_desktop=True) >>> my_stackup = Stackup3D(hfss, 2.5e9) >>> gnd = my_stackup.add_ground_layer("gnd", thickness=None) >>> my_stackup.add_dielectric_layer("diel1", thickness=1.5, material="Duroid (tm)") diff --git a/pyaedt/modeler/cad/Modeler.py b/pyaedt/modeler/cad/Modeler.py index be58a4ab7c6..848a2325642 100644 --- a/pyaedt/modeler/cad/Modeler.py +++ b/pyaedt/modeler/cad/Modeler.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `BaseCoordinateSystem`, `FaceCoordinateSystem`, `CoordinateSystem`, `Modeler`, `Position`, and `SweepOptions`. diff --git a/pyaedt/modeler/cad/Primitives.py b/pyaedt/modeler/cad/Primitives.py index b79e0a6ed09..fd37186e489 100644 --- a/pyaedt/modeler/cad/Primitives.py +++ b/pyaedt/modeler/cad/Primitives.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these Primitives classes: `Polyline` and `Primitives`. """ @@ -6670,7 +6694,7 @@ def create_polyline( >>> from pyaedt.modeler.cad.polylines import PolylineSegment >>> from pyaedt import Desktop >>> from pyaedt import Maxwell3d - >>> desktop=Desktop(specified_version="2021.2", new_desktop_session=False) + >>> desktop=Desktop(version="2021.2", new_desktop=False) >>> aedtapp = Maxwell3d() >>> aedtapp.modeler.model_units = "mm" >>> modeler = aedtapp.modeler diff --git a/pyaedt/modeler/cad/Primitives2D.py b/pyaedt/modeler/cad/Primitives2D.py index bec2cae27d6..c2157373ce2 100644 --- a/pyaedt/modeler/cad/Primitives2D.py +++ b/pyaedt/modeler/cad/Primitives2D.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.cad.Primitives import GeometryModeler diff --git a/pyaedt/modeler/cad/Primitives3D.py b/pyaedt/modeler/cad/Primitives3D.py index 9ab467f86b0..59378eddad0 100644 --- a/pyaedt/modeler/cad/Primitives3D.py +++ b/pyaedt/modeler/cad/Primitives3D.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import copy import json from math import asin @@ -1526,7 +1550,7 @@ def insert_3d_component( cs.ref_cs = coordinate_system if aux_dict.get("monitors", None): temp_proj_name = generate_unique_project_name() - ipkapp_temp = Icepak(projectname=os.path.join(self._app.toolkit_directory, temp_proj_name)) + ipkapp_temp = Icepak(project=os.path.join(self._app.toolkit_directory, temp_proj_name)) ipkapp_temp.delete_design(ipkapp_temp.design_name) self._app.oproject.CopyDesign(self._app.design_name) ipkapp_temp.oproject.Paste() diff --git a/pyaedt/modeler/cad/__init__.py b/pyaedt/modeler/cad/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/modeler/cad/__init__.py +++ b/pyaedt/modeler/cad/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/modeler/cad/component_array.py b/pyaedt/modeler/cad/component_array.py index b0da2e6bd38..f175115721d 100644 --- a/pyaedt/modeler/cad/component_array.py +++ b/pyaedt/modeler/cad/component_array.py @@ -1,12 +1,36 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import from collections import OrderedDict import os import re -from pyaedt import pyaedt_function_handler from pyaedt.generic.constants import AEDT_UNITS from pyaedt.generic.general_methods import _uname +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.general_methods import read_csv @@ -25,7 +49,7 @@ class ComponentArray(object): Basic usage demonstrated with an HFSS design with an existing array: >>> from pyaedt import Hfss - >>> aedtapp = Hfss(projectname="Array.aedt") + >>> aedtapp = Hfss(project="Array.aedt") >>> array_names = aedtapp.component_array_names[0] >>> array = aedtapp.component_array[array_names[0]] """ @@ -386,7 +410,7 @@ def parse_array_info_from_csv(self, input_file): # pragma: no cover Examples -------- >>> from pyaedt import Hfss - >>> aedtapp = Hfss(projectname="Array.aedt") + >>> aedtapp = Hfss(project="Array.aedt") >>> array_names = aedtapp.component_array_names[0] >>> array = aedtapp.component_array[array_names[0]] >>> array_csv = array.export_array_info() diff --git a/pyaedt/modeler/cad/components_3d.py b/pyaedt/modeler/cad/components_3d.py index 1ed2f3feced..8595dfb1686 100644 --- a/pyaedt/modeler/cad/components_3d.py +++ b/pyaedt/modeler/cad/components_3d.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import from collections import OrderedDict @@ -6,10 +30,10 @@ import re import warnings -from pyaedt import Edb -from pyaedt import pyaedt_function_handler +from pyaedt.edb import Edb from pyaedt.generic.desktop_sessions import _edb_sessions from pyaedt.generic.general_methods import _uname +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.cad.elements3d import BinaryTreeNode from pyaedt.modeler.cad.elements3d import _dict2arg diff --git a/pyaedt/modeler/cad/elements3d.py b/pyaedt/modeler/cad/elements3d.py index ea55690aa8a..c609c3855f5 100644 --- a/pyaedt/modeler/cad/elements3d.py +++ b/pyaedt/modeler/cad/elements3d.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import from collections import OrderedDict @@ -1116,7 +1140,6 @@ def coordinate_system(self, new_coordinate_system): coordinate_system = ["NAME:Orientation", "Value:=", new_coordinate_system] self._change_property(coordinate_system) self._point_coordinate_system = new_coordinate_system - return True @pyaedt_function_handler() def delete(self): diff --git a/pyaedt/modeler/cad/object3d.py b/pyaedt/modeler/cad/object3d.py index 423a30436b7..26029d9089d 100644 --- a/pyaedt/modeler/cad/object3d.py +++ b/pyaedt/modeler/cad/object3d.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `Components3DLayout`,`CircuitComponent', `EdgePrimitive`, `EdgeTypePrimitive`, `FacePrimitive`, `Geometries3DLayout`, diff --git a/pyaedt/modeler/cad/polylines.py b/pyaedt/modeler/cad/polylines.py index 3df25284627..c6c23443f13 100644 --- a/pyaedt/modeler/cad/polylines.py +++ b/pyaedt/modeler/cad/polylines.py @@ -1,13 +1,37 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import import math import warnings -from pyaedt import pyaedt_function_handler from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.constants import PLANE from pyaedt.generic.constants import unit_converter from pyaedt.generic.general_methods import _dim_arg +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.cad.object3d import Object3d from pyaedt.modeler.geometry_operators import GeometryOperators diff --git a/pyaedt/modeler/calculators.py b/pyaedt/modeler/calculators.py index 5e802073ac8..621baaa23ab 100644 --- a/pyaedt/modeler/calculators.py +++ b/pyaedt/modeler/calculators.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math from pyaedt import constants diff --git a/pyaedt/modeler/circuits/PrimitivesCircuit.py b/pyaedt/modeler/circuits/PrimitivesCircuit.py index 87dc0caf6c1..216352c3f1f 100644 --- a/pyaedt/modeler/circuits/PrimitivesCircuit.py +++ b/pyaedt/modeler/circuits/PrimitivesCircuit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math import os import random diff --git a/pyaedt/modeler/circuits/PrimitivesEmit.py b/pyaedt/modeler/circuits/PrimitivesEmit.py index 34f65476fce..89063faae70 100644 --- a/pyaedt/modeler/circuits/PrimitivesEmit.py +++ b/pyaedt/modeler/circuits/PrimitivesEmit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import defaultdict from pyaedt.emit_core import emit_constants as emit_consts @@ -764,7 +788,7 @@ def set_band_start_frequency(self, band_node, band_start_freq, units=""): Examples -------- >>> from pyaedt import Emit - >>> aedtapp = Emit(new_desktop_session=False) + >>> aedtapp = Emit(new_desktop=False) >>> radio = aedtapp.modeler.components.create_component("New Radio") >>> band = radio.bands()[0] >>> start_freq = 10 @@ -810,7 +834,7 @@ def set_band_stop_frequency(self, band_node, band_stop_freq, units=""): Examples -------- >>> from pyaedt import Emit - >>> aedtapp = Emit(new_desktop_session=False) + >>> aedtapp = Emit(new_desktop=False) >>> radio = aedtapp.modeler.components.create_component("New Radio") >>> band = radio.bands()[0] >>> stop_freq = 10 diff --git a/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py b/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py index b01717f0d6a..9fedbb602de 100644 --- a/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py +++ b/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.circuits.PrimitivesCircuit import CircuitComponents diff --git a/pyaedt/modeler/circuits/PrimitivesNexxim.py b/pyaedt/modeler/circuits/PrimitivesNexxim.py index a4e81202ac9..7804ad7b7c5 100644 --- a/pyaedt/modeler/circuits/PrimitivesNexxim.py +++ b/pyaedt/modeler/circuits/PrimitivesNexxim.py @@ -1,11 +1,33 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import random import re import time import warnings -from pyaedt import settings from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.LoadAEDTFile import load_keyword_in_aedt_file from pyaedt.generic.constants import AEDT_UNITS @@ -13,6 +35,7 @@ from pyaedt.generic.general_methods import is_linux from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.settings import settings from pyaedt.modeler.circuits.PrimitivesCircuit import CircuitComponents from pyaedt.modeler.circuits.PrimitivesCircuit import ComponentCatalog from pyaedt.modeler.circuits.object3dcircuit import CircuitComponent @@ -1957,7 +1980,7 @@ def create_component_from_spicemodel( Examples -------- >>> from pyaedt import Circuit - >>> cir = Circuit(specified_version="2023.2") + >>> cir = Circuit(version="2023.2") >>> model = os.path.join("Your path", "test.lib") >>> cir.modeler.schematic.create_component_from_spicemodel(input_file=model,model="GRM1234",symbol="nexx_cap") >>> cir.release_desktop(False, False) diff --git a/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py b/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py index 1a76aa0b9f8..499538aaf40 100644 --- a/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py +++ b/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.circuits.PrimitivesCircuit import CircuitComponents from pyaedt.modeler.circuits.PrimitivesCircuit import ComponentCatalog diff --git a/pyaedt/modeler/circuits/__init__.py b/pyaedt/modeler/circuits/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/modeler/circuits/__init__.py +++ b/pyaedt/modeler/circuits/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/modeler/circuits/object3dcircuit.py b/pyaedt/modeler/circuits/object3dcircuit.py index a6d8dcd3d56..ac3bb1c2888 100644 --- a/pyaedt/modeler/circuits/object3dcircuit.py +++ b/pyaedt/modeler/circuits/object3dcircuit.py @@ -1,15 +1,38 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import from collections import OrderedDict import math import time -from pyaedt import pyaedt_function_handler from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.constants import AEDT_UNITS from pyaedt.generic.general_methods import _arg2dict from pyaedt.generic.general_methods import _dim_arg +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.cad.elements3d import _dict2arg from pyaedt.modeler.geometry_operators import GeometryOperators as go diff --git a/pyaedt/modeler/geometry_operators.py b/pyaedt/modeler/geometry_operators.py index c75edc3be01..00aded2db2b 100644 --- a/pyaedt/modeler/geometry_operators.py +++ b/pyaedt/modeler/geometry_operators.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math import re import sys diff --git a/pyaedt/modeler/modeler2d.py b/pyaedt/modeler/modeler2d.py index 7698682ad46..009787dd312 100644 --- a/pyaedt/modeler/modeler2d.py +++ b/pyaedt/modeler/modeler2d.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import math from warnings import warn diff --git a/pyaedt/modeler/modeler3d.py b/pyaedt/modeler/modeler3d.py index 7327df909a0..791e8ae0c1a 100644 --- a/pyaedt/modeler/modeler3d.py +++ b/pyaedt/modeler/modeler3d.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import # noreorder import copy diff --git a/pyaedt/modeler/modelerpcb.py b/pyaedt/modeler/modelerpcb.py index 4e17524d6c6..aab82cc68a3 100644 --- a/pyaedt/modeler/modelerpcb.py +++ b/pyaedt/modeler/modelerpcb.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import re from warnings import warn @@ -402,7 +426,7 @@ def colinear_heal(self, assignment, tolerance=0.1): Examples -------- >>> from pyaedt import Hfss3dLayout - >>> h3d=Hfss3dLayout(specified_version="2021.2") + >>> h3d=Hfss3dLayout(version="2021.2") >>> h3d.modeler.layers.add_layer("TOP") >>> l1=h3d.modeler.create_line("TOP",[[0,0],[100,0]],0.5) >>> l2=h3d.modeler.create_line("TOP",[[100,0],[120,-35]],0.5) @@ -457,7 +481,7 @@ def expand(self, assignment, size=1, expand_type="ROUND", replace_original=False Examples -------- >>> from pyaedt import Hfss3dLayout - >>> h3d=Hfss3dLayout(specified_version="2021.2") + >>> h3d=Hfss3dLayout(version="2021.2") >>> h3d.modeler.layers.add_layer("TOP") >>> h3d.modeler.create_rectangle("TOP", [20,20],[50,50], name="rect_1") >>> h3d.modeler.create_line("TOP",[[25,25],[40,40]]) diff --git a/pyaedt/modeler/pcb/Primitives3DLayout.py b/pyaedt/modeler/pcb/Primitives3DLayout.py index a457a33684d..3744497f4cb 100644 --- a/pyaedt/modeler/pcb/Primitives3DLayout.py +++ b/pyaedt/modeler/pcb/Primitives3DLayout.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os # import sys diff --git a/pyaedt/modeler/pcb/__init__.py b/pyaedt/modeler/pcb/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/modeler/pcb/__init__.py +++ b/pyaedt/modeler/pcb/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/modeler/pcb/object3dlayout.py b/pyaedt/modeler/pcb/object3dlayout.py index 1b72f043312..e1f860676b0 100644 --- a/pyaedt/modeler/pcb/object3dlayout.py +++ b/pyaedt/modeler/pcb/object3dlayout.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module provides methods and data structures for managing all properties of objects (points, lines, sheeets, and solids) within the AEDT 3D Layout Modeler. @@ -9,9 +32,9 @@ import math import re -from pyaedt import pyaedt_function_handler from pyaedt.generic.constants import unit_converter from pyaedt.generic.general_methods import _dim_arg +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.modeler.geometry_operators import GeometryOperators diff --git a/pyaedt/modeler/schematic.py b/pyaedt/modeler/schematic.py index c6be0544f93..3d3689e18b0 100644 --- a/pyaedt/modeler/schematic.py +++ b/pyaedt/modeler/schematic.py @@ -1,12 +1,35 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import random import re import time -from pyaedt import settings from pyaedt.generic.constants import AEDT_UNITS from pyaedt.generic.general_methods import is_linux from pyaedt.generic.general_methods import pyaedt_function_handler +from pyaedt.generic.settings import settings from pyaedt.modeler.cad.Modeler import Modeler from pyaedt.modeler.circuits.PrimitivesEmit import EmitComponent from pyaedt.modeler.circuits.PrimitivesEmit import EmitComponents diff --git a/pyaedt/modules/AdvancedPostProcessing.py b/pyaedt/modules/AdvancedPostProcessing.py index 42271806f50..e496c69a65c 100644 --- a/pyaedt/modules/AdvancedPostProcessing.py +++ b/pyaedt/modules/AdvancedPostProcessing.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains the `PostProcessor` class. @@ -12,11 +36,11 @@ import warnings from pyaedt import generate_unique_name -from pyaedt import settings from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.plot import ModelPlotter +from pyaedt.generic.settings import settings from pyaedt.modules.PostProcessor import FieldSummary from pyaedt.modules.PostProcessor import PostProcessor as Post from pyaedt.modules.PostProcessor import TOTAL_QUANTITIES diff --git a/pyaedt/modules/Boundary.py b/pyaedt/modules/Boundary.py index 121c59c2f5c..5c73f681e11 100644 --- a/pyaedt/modules/Boundary.py +++ b/pyaedt/modules/Boundary.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: ``BoundaryCommon`` and ``BoundaryObject``. """ @@ -7,7 +31,6 @@ import copy import re -from pyaedt import Hfss3dLayout from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.DataHandlers import _dict2arg from pyaedt.generic.DataHandlers import random_string @@ -628,12 +651,12 @@ def set_parts(self, parts_choice, simplify_parts=False, surface_material="Steel- @pyaedt_function_handler() def identify_extent_poly(self): + from pyaedt import Hfss3dLayout + prj = self.props["NativeComponentDefinitionProvider"]["DefnLink"]["Project"] if prj == "This Project*": prj = self._app.project_name - layout = Hfss3dLayout( - projectname=prj, designname=self.props["NativeComponentDefinitionProvider"]["DefnLink"]["Design"] - ) + layout = Hfss3dLayout(project=prj, design=self.props["NativeComponentDefinitionProvider"]["DefnLink"]["Design"]) layer = [o for o in layout.modeler.stackup.drawing_layers if o.type == "outline"][0] outlines = [p for p in layout.modeler.polygons.values() if p.placement_layer == layer.name] if len(outlines) > 1: diff --git a/pyaedt/modules/CableModeling.py b/pyaedt/modules/CableModeling.py index ed7fe2a10fd..59e1a0f1664 100644 --- a/pyaedt/modules/CableModeling.py +++ b/pyaedt/modules/CableModeling.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import itertools import json import os diff --git a/pyaedt/modules/CircuitTemplates.py b/pyaedt/modules/CircuitTemplates.py index 57859343f3b..7560bd30952 100644 --- a/pyaedt/modules/CircuitTemplates.py +++ b/pyaedt/modules/CircuitTemplates.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Power Sinusoidal PowerSinusoidal = [ "NAME:Name", diff --git a/pyaedt/modules/DesignXPloration.py b/pyaedt/modules/DesignXPloration.py index 5472a4fd424..ad144d1fb6b 100644 --- a/pyaedt/modules/DesignXPloration.py +++ b/pyaedt/modules/DesignXPloration.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict import copy import csv diff --git a/pyaedt/modules/LayerStackup.py b/pyaedt/modules/LayerStackup.py index 244caa484d4..646ef9c3b84 100644 --- a/pyaedt/modules/LayerStackup.py +++ b/pyaedt/modules/LayerStackup.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `Layer` and `Layers`. diff --git a/pyaedt/modules/Material.py b/pyaedt/modules/Material.py index ccbc1d25bd5..7214ce71392 100644 --- a/pyaedt/modules/Material.py +++ b/pyaedt/modules/Material.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these data classes for creating a material library: @@ -603,7 +627,7 @@ def add_thermal_modifier_free_form(self, formula, index=0): -------- >>> from pyaedt import Hfss - >>> hfss = Hfss(specified_version="2021.2") + >>> hfss = Hfss(version="2021.2") >>> mat1 = hfss.materials.add_material("new_copper2") >>> mat1.add_thermal_modifier_free_form("if(Temp > 1000cel, 1, if(Temp < -273.15cel, 1, 1))") """ @@ -636,7 +660,7 @@ def add_thermal_modifier_dataset(self, dataset, index=0): -------- >>> from pyaedt import Hfss - >>> hfss = Hfss(specified_version="2021.2") + >>> hfss = Hfss(version="2021.2") >>> mat1 = hfss.materials.add_material("new_copper2") >>> mat1.add_thermal_modifier_dataset("$ds1") """ @@ -693,7 +717,7 @@ def add_thermal_modifier_closed_form( -------- >>> from pyaedt import Hfss - >>> hfss = Hfss(specified_version="2021.2") + >>> hfss = Hfss(version="2021.2") >>> mat1 = hfss.materials.add_material("new_copper2") >>> mat1.permittivity.add_thermal_modifier_closed_form(c1 = 1e-3) """ @@ -852,7 +876,7 @@ def _set_non_linear(self, x_unit=None, y_unit=None): Examples -------- >>> from pyaedt import Hfss - >>> hfss = Hfss(specified_version="2023.2") + >>> hfss = Hfss(version="2023.2") >>> B_value = [0.0, 0.1, 0.3, 0.4, 0.48, 0.55, 0.6, 0.61, 0.65] >>> H_value = [0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3500.0, 5000.0, 10000.0] >>> mat = hfss.materials.add_material("newMat") @@ -1050,7 +1074,7 @@ def add_spatial_modifier_free_form(self, formula, index=0): -------- >>> from pyaedt import Hfss - >>> hfss = Hfss(specified_version="2021.2") + >>> hfss = Hfss(version="2021.2") >>> mat1 = hfss.materials.add_material("new_copper2") >>> mat1.add_spatial_modifier_free_form("if(X > 1mm, 1, if(X < 1mm, 2, 1))") """ @@ -1083,7 +1107,7 @@ def add_spatial_modifier_dataset(self, dataset, index=0): -------- >>> from pyaedt import Hfss - >>> hfss = Hfss(specified_version="2021.2") + >>> hfss = Hfss(version="2021.2") >>> mat1 = hfss.materials.add_material("new_copper2") >>> mat1.add_spatial_modifier_dataset("$ds1") """ @@ -1384,7 +1408,7 @@ def material_appearance(self): Create a material with color ``[0, 153, 153]`` (darker cyan) and transparency ``0.5``. >>> from pyaedt import Hfss - >>> hfss = Hfss(specified_version="2021.2") + >>> hfss = Hfss(version="2021.2") >>> mat1 = hfss.materials.add_material("new_material") >>> appearance_props = mat1.material_appearance >>> mat1.material_appearance = [0, 153, 153, 0.5] diff --git a/pyaedt/modules/MaterialLib.py b/pyaedt/modules/MaterialLib.py index 05d98cce5d3..8b17ba6140f 100644 --- a/pyaedt/modules/MaterialLib.py +++ b/pyaedt/modules/MaterialLib.py @@ -1,4 +1,27 @@ # -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains the `Materials` class. """ @@ -12,10 +35,10 @@ import sys import warnings -from pyaedt import is_ironpython from pyaedt.generic.DataHandlers import _arg2dict from pyaedt.generic.LoadAEDTFile import load_entire_aedt_file from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.general_methods import read_json diff --git a/pyaedt/modules/Mesh.py b/pyaedt/modules/Mesh.py index 588f7c015a2..006ca95d078 100644 --- a/pyaedt/modules/Mesh.py +++ b/pyaedt/modules/Mesh.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains the `Mesh` class. """ diff --git a/pyaedt/modules/Mesh3DLayout.py b/pyaedt/modules/Mesh3DLayout.py index 67b845d223d..f006a3f1c07 100644 --- a/pyaedt/modules/Mesh3DLayout.py +++ b/pyaedt/modules/Mesh3DLayout.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `Mesh` and `Mesh3DOperation`. diff --git a/pyaedt/modules/MeshIcepak.py b/pyaedt/modules/MeshIcepak.py index 6eab77ed091..3a497b1cab1 100644 --- a/pyaedt/modules/MeshIcepak.py +++ b/pyaedt/modules/MeshIcepak.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from abc import abstractmethod from collections import OrderedDict import warnings diff --git a/pyaedt/modules/OptimetricsTemplates.py b/pyaedt/modules/OptimetricsTemplates.py index c9b976a16dc..efa3dc5d1a1 100644 --- a/pyaedt/modules/OptimetricsTemplates.py +++ b/pyaedt/modules/OptimetricsTemplates.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict defaultparametricSetup = OrderedDict( diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index 2f30d5cf8a2..e4e2ea7afd3 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `FieldPlot`, `PostProcessor`, and `SolutionData`. @@ -17,12 +41,12 @@ import string import tempfile -from pyaedt import is_ironpython from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.DataHandlers import _dict_items_to_list_items from pyaedt.generic.constants import unit_converter from pyaedt.generic.general_methods import check_and_download_file from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.general_methods import read_configuration_file diff --git a/pyaedt/modules/SetupTemplates.py b/pyaedt/modules/SetupTemplates.py index b55424bb77f..7142009842c 100644 --- a/pyaedt/modules/SetupTemplates.py +++ b/pyaedt/modules/SetupTemplates.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from __future__ import absolute_import from collections import OrderedDict diff --git a/pyaedt/modules/SolveSetup.py b/pyaedt/modules/SolveSetup.py index 283463d352e..cd5e82c728d 100644 --- a/pyaedt/modules/SolveSetup.py +++ b/pyaedt/modules/SolveSetup.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ This module contains these classes: `Setup`, `Setup3DLayout`, and `SetupCircuit`. @@ -101,7 +125,7 @@ def analyze( that support automatic settings. solve_in_batch : bool, optional Whether to solve the project in batch or not. - If ``True`` the project will be saved, closed, solved and repened. + If ``True`` the project will be saved, closed, and solved. machine : str, optional Name of the machine if remote. The default is ``"localhost"``. run_in_thread : bool, optional @@ -221,6 +245,20 @@ def name(self, name): self._name = name self.props["Name"] = name + @pyaedt_function_handler() + def get_profile(self): + """Solution profile. + + Returns + ------- + dict of :class:pyaedt.modeler.cad.elements3d.BinaryTree when solved setups exist, + ``None`` when no solved setups or no compatible application exists. + """ + profile = self._app.get_profile(self.name) + if not isinstance(profile, dict) or not profile: + profile = None + return profile + @pyaedt_function_handler(sweep_name="sweep") def get_solution_data( self, @@ -1907,7 +1945,7 @@ def _get_net_names(self, app, file_fullname): lay.name: lay.lower_elevation + lay.thickness / 2 for lay in list(self.p_app.modeler.edb.stackup.signal_layers.values()) } - aedtapp = app(projectname=file_fullname) + aedtapp = app(project=file_fullname) units = aedtapp.modeler.model_units aedt_units = AEDT_UNITS["Length"][units] self._convert_edb_to_aedt_units(input_dict=primitives_3d_pts_per_nets, output_unit=aedt_units) diff --git a/pyaedt/modules/SolveSweeps.py b/pyaedt/modules/SolveSweeps.py index 6d1e1f0e60e..358fd340a0e 100644 --- a/pyaedt/modules/SolveSweeps.py +++ b/pyaedt/modules/SolveSweeps.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict import copy from difflib import SequenceMatcher @@ -6,10 +30,10 @@ import sys import warnings -from pyaedt import pyaedt_function_handler from pyaedt.generic.DataHandlers import _dict2arg from pyaedt.generic.LoadAEDTFile import load_entire_aedt_file from pyaedt.generic.constants import unit_converter +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.settings import settings from pyaedt.modules.SetupTemplates import Sweep3DLayout from pyaedt.modules.SetupTemplates import SweepHfss3D @@ -75,8 +99,8 @@ class SweepHFSS(object): Examples -------- - >>> hfss = Hfss(specified_version=version, projectname=proj, designname=gtemDesign, solution_type=solutiontype, - name=name, new_desktop_session=False, close_on_exit=False) + >>> hfss = Hfss(version=version, project=proj, design=gtemDesign, solution_type=solutiontype, + name=name, new_desktop=False, close_on_exit=False) >>> hfss_setup = hfss.setups[0] >>> hfss_sweep = SweepHFSS(hfss_setup, 'Sweep', sweep_type ='Interpolating', props=None) diff --git a/pyaedt/modules/__init__.py b/pyaedt/modules/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/modules/__init__.py +++ b/pyaedt/modules/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/modules/fields_calculator.py b/pyaedt/modules/fields_calculator.py index eb272242e68..63e9f281d45 100644 --- a/pyaedt/modules/fields_calculator.py +++ b/pyaedt/modules/fields_calculator.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/modules/monitor_icepak.py b/pyaedt/modules/monitor_icepak.py index 4e3438d5b0d..aa6b933696b 100644 --- a/pyaedt/modules/monitor_icepak.py +++ b/pyaedt/modules/monitor_icepak.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import re from pyaedt.generic.DataHandlers import _dict2arg diff --git a/pyaedt/modules/report_templates.py b/pyaedt/modules/report_templates.py index 17d20478ab6..e002d13394a 100644 --- a/pyaedt/modules/report_templates.py +++ b/pyaedt/modules/report_templates.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict import copy import os diff --git a/pyaedt/modules/solutions.py b/pyaedt/modules/solutions.py index 88a78e70439..0c3bd44babf 100644 --- a/pyaedt/modules/solutions.py +++ b/pyaedt/modules/solutions.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import OrderedDict import itertools import json @@ -8,8 +32,6 @@ import sys import time -from pyaedt import is_ironpython -from pyaedt import pyaedt_function_handler from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.constants import AEDT_UNITS from pyaedt.generic.constants import CSS4_COLORS @@ -19,7 +41,9 @@ from pyaedt.generic.general_methods import check_and_download_file from pyaedt.generic.general_methods import check_and_download_folder from pyaedt.generic.general_methods import conversion_function +from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import open_file +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.general_methods import write_csv from pyaedt.generic.plot import get_structured_mesh from pyaedt.generic.plot import is_notebook @@ -1530,7 +1554,7 @@ class FfdSolutionData(object): >>> import pyaedt >>> from pyaedt.modules.solutions import FfdSolutionData - >>> app = pyaedt.Hfss(specified_version="2023.2", designname="Antenna") + >>> app = pyaedt.Hfss(version="2023.2", design="Antenna") >>> setup_name = "Setup1 : LastAdaptive" >>> frequencies = [77e9] >>> sphere = "3D" @@ -2005,7 +2029,7 @@ def plot_farfield_contour( Examples -------- >>> import pyaedt - >>> app = pyaedt.Hfss(specified_version="2024.1", designname="Antenna") + >>> app = pyaedt.Hfss(version="2024.1", design="Antenna") >>> setup_name = "Setup1 : LastAdaptive" >>> frequencies = [77e9] >>> sphere = "3D" @@ -2144,7 +2168,7 @@ def plot_2d_cut( Examples -------- >>> import pyaedt - >>> app = pyaedt.Hfss(specified_version="2023.2", designname="Antenna") + >>> app = pyaedt.Hfss(version="2023.2", design="Antenna") >>> setup_name = "Setup1 : LastAdaptive" >>> frequencies = [77e9] >>> sphere = "3D" @@ -2285,7 +2309,7 @@ def polar_plot_3d( Examples -------- >>> import pyaedt - >>> app = pyaedt.Hfss(specified_version="2023.2", designname="Antenna") + >>> app = pyaedt.Hfss(version="2023.2", design="Antenna") >>> setup_name = "Setup1 : LastAdaptive" >>> frequencies = [77e9] >>> sphere = "3D" @@ -2390,7 +2414,7 @@ def polar_plot_3d_pyvista( Examples -------- >>> import pyaedt - >>> app = pyaedt.Hfss(specified_version="2023.2", designname="Antenna") + >>> app = pyaedt.Hfss(version="2023.2", design="Antenna") >>> setup_name = "Setup1 : LastAdaptive" >>> frequencies = [77e9] >>> sphere = "3D" @@ -2908,7 +2932,7 @@ class FfdSolutionDataExporter(FfdSolutionData): Examples -------- >>> import pyaedt - >>> app = pyaedt.Hfss(specified_version="2023.2", designname="Antenna") + >>> app = pyaedt.Hfss(version="2023.2", design="Antenna") >>> setup_name = "Setup1 : LastAdaptive" >>> frequencies = [77e9] >>> sphere = "3D" diff --git a/pyaedt/q3d.py b/pyaedt/q3d.py index 633c54e0b0f..decf206c7c7 100644 --- a/pyaedt/q3d.py +++ b/pyaedt/q3d.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains these classes: ``Q2d``, ``Q3d``, and ``QExtractor`.""" from __future__ import absolute_import # noreorder @@ -7,12 +31,12 @@ import re import warnings -from pyaedt import is_ironpython from pyaedt.application.Analysis3D import FieldAnalysis3D from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.constants import MATRIXOPERATIONSQ2D from pyaedt.generic.constants import MATRIXOPERATIONSQ3D from pyaedt.generic.general_methods import generate_unique_name +from pyaedt.generic.general_methods import is_ironpython from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.settings import settings from pyaedt.modeler.geometry_operators import GeometryOperators as go @@ -50,34 +74,36 @@ def design_file(self): def __init__( self, Q3DType, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, setup_name=None, - specified_version=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): FieldAnalysis3D.__init__( self, Q3DType, - projectname, - designname, + project, + design, solution_type, setup_name, - specified_version, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self.matrices = [] for el in list(self.omatrix.ListReduceMatrixes()): @@ -1204,23 +1230,23 @@ class Q3d(QExtractor, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when Script is launched within AEDT. @@ -1229,7 +1255,7 @@ class Q3d(QExtractor, object): Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. This parameter is ignored when @@ -1251,7 +1277,11 @@ class Q3d(QExtractor, object): running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -1263,36 +1293,44 @@ class Q3d(QExtractor, object): """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): QExtractor.__init__( self, "Q3D Extractor", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self.MATRIXOPERATIONS = MATRIXOPERATIONSQ3D() @@ -2041,23 +2079,23 @@ class Q2d(QExtractor, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. This parameter is ignored when a script is launched within AEDT. @@ -2066,7 +2104,7 @@ class Q2d(QExtractor, object): Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. This parameter is ignored @@ -2087,7 +2125,11 @@ class Q2d(QExtractor, object): The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -2115,36 +2157,44 @@ def dim(self): """Dimension.""" return self.modeler.dimension + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): QExtractor.__init__( self, "2D Extractor", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) self.MATRIXOPERATIONS = MATRIXOPERATIONSQ2D() diff --git a/pyaedt/rmxprt.py b/pyaedt/rmxprt.py index 3ed62c4855b..d3ea23f0e6b 100644 --- a/pyaedt/rmxprt.py +++ b/pyaedt/rmxprt.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains these classes: ``RMXprtModule`` and ``Rmxprt``.""" from __future__ import absolute_import # noreorder @@ -125,12 +149,12 @@ class Rmxprt(FieldAnalysisRMxprt): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. @@ -139,11 +163,11 @@ class Rmxprt(FieldAnalysisRMxprt): ``None``, in which case the default type is applied. model_units : str, optional Model units. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active setup is used or the latest installed version is used. @@ -152,7 +176,7 @@ class Rmxprt(FieldAnalysisRMxprt): Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -171,7 +195,11 @@ class Rmxprt(FieldAnalysisRMxprt): The remote server must be up and running with the command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -198,37 +226,45 @@ class Rmxprt(FieldAnalysisRMxprt): >>> app = Rmxprt("myfile.aedt") """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, model_units=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): FieldAnalysisRMxprt.__init__( self, "RMxprtSolution", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) if not model_units or model_units == "mm": model_units = "mm" diff --git a/pyaedt/rpc/rpyc_services.py b/pyaedt/rpc/rpyc_services.py index 015fc8c6154..94281beef02 100644 --- a/pyaedt/rpc/rpyc_services.py +++ b/pyaedt/rpc/rpyc_services.py @@ -11,8 +11,8 @@ from pyaedt import generate_unique_name from pyaedt.generic.general_methods import env_path -from pyaedt import is_ironpython -from pyaedt import is_linux +from pyaedt.generic.general_methods import is_ironpython +from pyaedt.generic.settings import is_linux from pyaedt import is_windows if is_linux and is_ironpython: @@ -336,34 +336,34 @@ def exposed_edb( def exposed_hfss( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Hfss session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -376,13 +376,13 @@ def exposed_hfss( """ self._beta() aedtapp = Hfss( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -391,34 +391,34 @@ def exposed_hfss( def exposed_hfss3dlayout( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Hfss3dLayout session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -431,13 +431,13 @@ def exposed_hfss3dlayout( """ self._beta() aedtapp = Hfss3dLayout( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -446,34 +446,34 @@ def exposed_hfss3dlayout( def exposed_maxwell3d( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Maxwell3d session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -486,13 +486,13 @@ def exposed_maxwell3d( """ self._beta() aedtapp = Maxwell3d( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -501,34 +501,34 @@ def exposed_maxwell3d( def exposed_maxwell2d( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Maxwell32 session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -541,13 +541,13 @@ def exposed_maxwell2d( """ self._beta() aedtapp = Maxwell2d( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -556,34 +556,34 @@ def exposed_maxwell2d( def exposed_icepak( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Icepak session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -596,13 +596,13 @@ def exposed_icepak( """ self._beta() aedtapp = Icepak( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -611,34 +611,34 @@ def exposed_icepak( def exposed_circuit( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Circuit session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -651,13 +651,13 @@ def exposed_circuit( """ self._beta() aedtapp = Circuit( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -666,34 +666,34 @@ def exposed_circuit( def exposed_mechanical( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Mechanical session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -706,13 +706,13 @@ def exposed_mechanical( """ self._beta() aedtapp = Mechanical( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -721,34 +721,34 @@ def exposed_mechanical( def exposed_q3d( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Q3d session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -761,13 +761,13 @@ def exposed_q3d( """ self._beta() aedtapp = Q3d( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) @@ -776,34 +776,34 @@ def exposed_q3d( def exposed_q2d( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=True, ): """Starts a new Q2d session. Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active version or latest installed version is used. non_graphical : bool, optional @@ -816,13 +816,13 @@ def exposed_q2d( """ self._beta() aedtapp = Q2d( - projectname=projectname, - designname=designname, + project=project, + design=design, solution_type=solution_type, - setup_name=setup_name, - specified_version=specified_version, + setup=setup, + version=version, non_graphical=non_graphical, - new_desktop_session=True, + new_desktop=True, close_on_exit=True, student_version=False, ) diff --git a/pyaedt/sbrplus/__init__.py b/pyaedt/sbrplus/__init__.py index e69de29bb2d..9c4476773da 100644 --- a/pyaedt/sbrplus/__init__.py +++ b/pyaedt/sbrplus/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pyaedt/sbrplus/hdm_parser.py b/pyaedt/sbrplus/hdm_parser.py index 444ea9b7054..56fbaeedffe 100644 --- a/pyaedt/sbrplus/hdm_parser.py +++ b/pyaedt/sbrplus/hdm_parser.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import struct import warnings diff --git a/pyaedt/sbrplus/hdm_utils.py b/pyaedt/sbrplus/hdm_utils.py index 2a2934486af..3de0ba527c5 100644 --- a/pyaedt/sbrplus/hdm_utils.py +++ b/pyaedt/sbrplus/hdm_utils.py @@ -1,3 +1,28 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + def sort_bundle(bundle, monoPW_attrib="sweep_angle_index"): """ In-place sorting utility for hdm ray exports. diff --git a/pyaedt/sbrplus/plot.py b/pyaedt/sbrplus/plot.py index 9fae5a4b4c3..87675122497 100644 --- a/pyaedt/sbrplus/plot.py +++ b/pyaedt/sbrplus/plot.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from collections import defaultdict import math import os @@ -6,8 +30,8 @@ import numpy as np import pyvista as pv -from pyaedt import pyaedt_function_handler from pyaedt.generic.constants import AEDT_UNITS +from pyaedt.generic.general_methods import pyaedt_function_handler from pyaedt.generic.plot import CommonPlotter from pyaedt.generic.plot import ObjClass diff --git a/pyaedt/twinbuilder.py b/pyaedt/twinbuilder.py index 05e7a3930f9..f7c915da558 100644 --- a/pyaedt/twinbuilder.py +++ b/pyaedt/twinbuilder.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """This module contains the ``TwinBuilder`` class.""" from __future__ import absolute_import # noreorder @@ -19,23 +43,23 @@ class TwinBuilder(AnalysisTwinBuilder, object): Parameters ---------- - projectname : str, optional + project : str, optional Name of the project to select or the full path to the project or AEDTZ archive to open. The default is ``None``, in which case an attempt is made to get an active project. If no projects are present, an empty project is created. - designname : str, optional + design : str, optional Name of the design to select. The default is ``None``, in which case an attempt is made to get an active design. If no designs are present, an empty design is created. solution_type : str, optional Solution type to apply to the design. The default is ``None``, in which case the default type is applied. - setup_name : str, optional + setup : str, optional Name of the setup to use as the nominal. The default is ``None``, in which case the active setup is used or nothing is used. - specified_version : str, int, float, optional + version : str, int, float, optional Version of AEDT to use. The default is ``None``, in which case the active setup or latest installed version is used. @@ -44,7 +68,7 @@ class TwinBuilder(AnalysisTwinBuilder, object): Whether to launch AEDT in non-graphical mode. The default is ``False``, in which case AEDT is launched in graphical mode. This parameter is ignored when a script is launched within AEDT. - new_desktop_session : bool, optional + new_desktop : bool, optional Whether to launch an instance of AEDT in a new thread, even if another instance of the ``specified_version`` is active on the machine. The default is ``False``. @@ -63,7 +87,11 @@ class TwinBuilder(AnalysisTwinBuilder, object): The remote server must be up and running with command `"ansysedt.exe -grpcsrv portnum"`. aedt_process_id : int, optional Process ID for the instance of AEDT to point PyAEDT at. The default is - ``None``. This parameter is only used when ``new_desktop_session = False``. + ``None``. This parameter is only used when ``new_desktop = False``. + remove_lock : bool, optional + Whether to remove lock to project before opening it or not. + The default is ``False``, which means to not unlock + the existing project if needed and raise an exception. Examples -------- @@ -91,37 +119,45 @@ class TwinBuilder(AnalysisTwinBuilder, object): >>> app = TwinBuilder("myfile.aedt") """ + @pyaedt_function_handler( + designname="design", + projectname="project", + specified_version="version", + setup_name="setup", + ) def __init__( self, - projectname=None, - designname=None, + project=None, + design=None, solution_type=None, - setup_name=None, - specified_version=None, + setup=None, + version=None, non_graphical=False, - new_desktop_session=False, + new_desktop=False, close_on_exit=False, student_version=False, machine="", port=0, aedt_process_id=None, + remove_lock=False, ): """Constructor.""" AnalysisTwinBuilder.__init__( self, "Twin Builder", - projectname, - designname, + project, + design, solution_type, - setup_name, - specified_version, + setup, + version, non_graphical, - new_desktop_session, + new_desktop, close_on_exit, student_version, machine, port, aedt_process_id, + remove_lock=remove_lock, ) def _init_from_design(self, *args, **kwargs): diff --git a/pyaedt/workflows/__init__.py b/pyaedt/workflows/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/__init__.py +++ b/pyaedt/workflows/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/circuit/__init__.py b/pyaedt/workflows/circuit/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/circuit/__init__.py +++ b/pyaedt/workflows/circuit/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/customize_automation_tab.py b/pyaedt/workflows/customize_automation_tab.py index c3309d2ae98..9cc9f384d3d 100644 --- a/pyaedt/workflows/customize_automation_tab.py +++ b/pyaedt/workflows/customize_automation_tab.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -36,8 +37,8 @@ from defusedxml.ElementTree import ParseError from defusedxml.minidom import parseString -from pyaedt import is_linux from pyaedt.generic.general_methods import read_toml +from pyaedt.generic.settings import is_linux import pyaedt.workflows import pyaedt.workflows.templates diff --git a/pyaedt/workflows/emit/__init__.py b/pyaedt/workflows/emit/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/emit/__init__.py +++ b/pyaedt/workflows/emit/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/hfss/__init__.py b/pyaedt/workflows/hfss/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/hfss/__init__.py +++ b/pyaedt/workflows/hfss/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/hfss/push_excitation_from_file.py b/pyaedt/workflows/hfss/push_excitation_from_file.py index 3dbe6147de8..9cf8644f884 100644 --- a/pyaedt/workflows/hfss/push_excitation_from_file.py +++ b/pyaedt/workflows/hfss/push_excitation_from_file.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -52,8 +53,8 @@ def frontend(): # pragma: no cover # Get ports app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, @@ -153,8 +154,8 @@ def main(extension_args): file_path = extension_args["file_path"] app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, diff --git a/pyaedt/workflows/hfss3dlayout/__init__.py b/pyaedt/workflows/hfss3dlayout/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/hfss3dlayout/__init__.py +++ b/pyaedt/workflows/hfss3dlayout/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/hfss3dlayout/export_to_3d.py b/pyaedt/workflows/hfss3dlayout/export_to_3d.py index 95ed78e5f3c..7e8d4ee9bb5 100644 --- a/pyaedt/workflows/hfss3dlayout/export_to_3d.py +++ b/pyaedt/workflows/hfss3dlayout/export_to_3d.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -100,8 +101,8 @@ def main(extension_args): choice = extension_args["choice"] app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, @@ -119,7 +120,7 @@ def main(extension_args): app.release_desktop(False, False) raise Exception("Hfss 3D Layout project is needed.") - h3d = pyaedt.Hfss3dLayout(projectname=project_name, designname=design_name) + h3d = pyaedt.Hfss3dLayout(project=project_name, design=design_name) setup = h3d.create_setup() suffix = suffixes[choice] @@ -133,14 +134,14 @@ def main(extension_args): h3d.save_project() if choice == "Export to Q3D": - _ = pyaedt.Q3d(projectname=h3d.project_file[:-5] + f"_{suffix}.aedt") + _ = pyaedt.Q3d(project=h3d.project_file[:-5] + f"_{suffix}.aedt") else: - aedtapp = pyaedt.Hfss(projectname=h3d.project_file[:-5] + f"_{suffix}.aedt") + aedtapp = pyaedt.Hfss(project=h3d.project_file[:-5] + f"_{suffix}.aedt") aedtapp2 = None if choice == "Export to Maxwell 3D": - aedtapp2 = pyaedt.Maxwell3d(projectname=aedtapp.project_name) + aedtapp2 = pyaedt.Maxwell3d(project=aedtapp.project_name) elif choice == "Export to Icepak": - aedtapp2 = pyaedt.Icepak(projectname=aedtapp.project_name) + aedtapp2 = pyaedt.Icepak(project=aedtapp.project_name) if aedtapp2: aedtapp2.copy_solid_bodies_from(aedtapp, no_vacuum=False, no_pec=False, include_sheets=True) aedtapp2.delete_design(aedtapp.design_name) diff --git a/pyaedt/workflows/icepak/__init__.py b/pyaedt/workflows/icepak/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/icepak/__init__.py +++ b/pyaedt/workflows/icepak/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/installer/__init__.py b/pyaedt/workflows/installer/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/installer/__init__.py +++ b/pyaedt/workflows/installer/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/installer/console_setup.py b/pyaedt/workflows/installer/console_setup.py index b32f3273fa1..0ea19672ce0 100644 --- a/pyaedt/workflows/installer/console_setup.py +++ b/pyaedt/workflows/installer/console_setup.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ Launches an interactive shell with an instance of HFSS @@ -64,18 +88,18 @@ def release(d): error = False if port: desktop = Desktop( - specified_version=version, + version=version, port=port, - new_desktop_session=False, + new_desktop=False, non_graphical=False, close_on_exit=False, student_version=student_version, ) elif is_windows: desktop = Desktop( - specified_version=version, + version=version, aedt_process_id=aedt_process_id, - new_desktop_session=False, + new_desktop=False, non_graphical=False, close_on_exit=False, student_version=student_version, diff --git a/pyaedt/workflows/installer/extension_manager.py b/pyaedt/workflows/installer/extension_manager.py index d58ec8e1a64..2821c84c08d 100644 --- a/pyaedt/workflows/installer/extension_manager.py +++ b/pyaedt/workflows/installer/extension_manager.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -240,9 +241,9 @@ def button_is_clicked( name = toolkit_name.get() desktop = Desktop( - specified_version=version, + version=version, port=port, - new_desktop_session=False, + new_desktop=False, non_graphical=False, close_on_exit=False, student_version=student_version, diff --git a/pyaedt/workflows/installer/pyaedt_installer.py b/pyaedt/workflows/installer/pyaedt_installer.py index 8d7a5ef0d63..29959a4b6c1 100644 --- a/pyaedt/workflows/installer/pyaedt_installer.py +++ b/pyaedt/workflows/installer/pyaedt_installer.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/maxwell2d/__init__.py b/pyaedt/workflows/maxwell2d/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/maxwell2d/__init__.py +++ b/pyaedt/workflows/maxwell2d/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/maxwell3d/__init__.py b/pyaedt/workflows/maxwell3d/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/maxwell3d/__init__.py +++ b/pyaedt/workflows/maxwell3d/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/mechanical/__init__.py b/pyaedt/workflows/mechanical/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/mechanical/__init__.py +++ b/pyaedt/workflows/mechanical/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/misc.py b/pyaedt/workflows/misc.py index 687620ba188..89ba7b998a6 100644 --- a/pyaedt/workflows/misc.py +++ b/pyaedt/workflows/misc.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/project/__init__.py b/pyaedt/workflows/project/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/project/__init__.py +++ b/pyaedt/workflows/project/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/project/advanced_fields_calculator.py b/pyaedt/workflows/project/advanced_fields_calculator.py index 02b59a2c260..e60709d2746 100644 --- a/pyaedt/workflows/project/advanced_fields_calculator.py +++ b/pyaedt/workflows/project/advanced_fields_calculator.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -53,7 +54,7 @@ def frontend(): # pragma: no cover # Get ports app = pyaedt.Desktop( - new_desktop_session=False, + new_desktop=False, specified_version=version, port=port, aedt_process_id=aedt_process_id, @@ -182,8 +183,8 @@ def main(extension_args): assignment_selection = extension_args["assignment"] app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, diff --git a/pyaedt/workflows/project/configure_edb.py b/pyaedt/workflows/project/configure_edb.py index 7349ea5460c..1934e746b3d 100644 --- a/pyaedt/workflows/project/configure_edb.py +++ b/pyaedt/workflows/project/configure_edb.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/project/create_report.py b/pyaedt/workflows/project/create_report.py index ed8fe38d95c..a2b7e1a1e42 100644 --- a/pyaedt/workflows/project/create_report.py +++ b/pyaedt/workflows/project/create_report.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,8 +45,8 @@ def main(extension_args): app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, diff --git a/pyaedt/workflows/project/import_nastran.py b/pyaedt/workflows/project/import_nastran.py index 3e42e116447..9bfc0968727 100644 --- a/pyaedt/workflows/project/import_nastran.py +++ b/pyaedt/workflows/project/import_nastran.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -161,8 +162,8 @@ def main(extension_args): if os.path.exists(file_path): app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, @@ -190,8 +191,8 @@ def main(extension_args): app.logger.info("Geometry imported correctly.") else: app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, diff --git a/pyaedt/workflows/q2d/__init__.py b/pyaedt/workflows/q2d/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/q2d/__init__.py +++ b/pyaedt/workflows/q2d/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/q3d/__init__.py b/pyaedt/workflows/q3d/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/q3d/__init__.py +++ b/pyaedt/workflows/q3d/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/templates/__init__.py b/pyaedt/workflows/templates/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/templates/__init__.py +++ b/pyaedt/workflows/templates/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/templates/extension_template.py b/pyaedt/workflows/templates/extension_template.py index 81beff8b5ae..7cfb4586fbf 100644 --- a/pyaedt/workflows/templates/extension_template.py +++ b/pyaedt/workflows/templates/extension_template.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -42,8 +43,8 @@ def main(extension_args): app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, diff --git a/pyaedt/workflows/templates/pyaedt_utils.py b/pyaedt/workflows/templates/pyaedt_utils.py index 7e26a366cf0..108b8f7941f 100644 --- a/pyaedt/workflows/templates/pyaedt_utils.py +++ b/pyaedt/workflows/templates/pyaedt_utils.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/twinbuilder/__init__.py b/pyaedt/workflows/twinbuilder/__init__.py index 3bc3c8e5b19..f10103137e9 100644 --- a/pyaedt/workflows/twinbuilder/__init__.py +++ b/pyaedt/workflows/twinbuilder/__init__.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/pyaedt/workflows/twinbuilder/convert_to_circuit.py b/pyaedt/workflows/twinbuilder/convert_to_circuit.py index 1a1aa2e9b51..2a7e2c6d255 100644 --- a/pyaedt/workflows/twinbuilder/convert_to_circuit.py +++ b/pyaedt/workflows/twinbuilder/convert_to_circuit.py @@ -1,6 +1,7 @@ -# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT +# -*- coding: utf-8 -*- # +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,8 +26,8 @@ import sys import pyaedt -from pyaedt import is_linux from pyaedt.generic.general_methods import read_toml +from pyaedt.generic.settings import is_linux import pyaedt.workflows from pyaedt.workflows.misc import get_aedt_version from pyaedt.workflows.misc import get_arguments @@ -47,8 +48,8 @@ def main(extension_args): app = pyaedt.Desktop( - new_desktop_session=False, - specified_version=version, + new_desktop=False, + version=version, port=port, aedt_process_id=aedt_process_id, student_version=is_student, @@ -67,14 +68,14 @@ def main(extension_args): if active_design.GetDesignType() in ["Twin Builder"]: design_name = active_design.GetName().split(";")[1] - tb = pyaedt.TwinBuilder(designname=design_name, projectname=project_name) + tb = pyaedt.TwinBuilder(design=design_name, project=project_name) else: # pragma: no cover app.logger.error("An active TwinBuilder Design is needed.") sys.exit() catalog = read_toml(os.path.join(pyaedt.__path__[0], "misc", "tb_nexxim_mapping.toml")) scale = catalog["General"]["scale"] - cir = pyaedt.Circuit(designname=tb.design_name + "_Translated") + cir = pyaedt.Circuit(design=tb.design_name + "_Translated") from pyaedt.generic.constants import unit_converter