From 19b211d12aae2b87e463d78a6a7664879c4225a2 Mon Sep 17 00:00:00 2001 From: anur7 Date: Wed, 9 Oct 2024 17:08:44 +0200 Subject: [PATCH 1/4] new method to add notes on design plus unit test to test it --- _unittest/test_01_Design.py | 4 ++++ src/ansys/aedt/core/application/design.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/_unittest/test_01_Design.py b/_unittest/test_01_Design.py index 529647d8c72..da1262e0a5e 100644 --- a/_unittest/test_01_Design.py +++ b/_unittest/test_01_Design.py @@ -498,3 +498,7 @@ def test_42_save_project_with_file_name(self): assert not os.path.exists(new_parent_dir) self.aedtapp.save_project(file_name=new_project) assert os.path.isfile(new_project) + + def test_43_edit_notes(self): + assert self.aedtapp.edit_notes("this a test") + assert not self.aedtapp.edit_notes(1) diff --git a/src/ansys/aedt/core/application/design.py b/src/ansys/aedt/core/application/design.py index 87aea886a94..42614cd3f9a 100644 --- a/src/ansys/aedt/core/application/design.py +++ b/src/ansys/aedt/core/application/design.py @@ -4203,6 +4203,26 @@ def set_temporary_directory(self, path): self.odesktop.SetTempDirectory(path) return True + @pyaedt_function_handler() + def edit_notes(self, text): + """Edit notes. + + Parameters + ---------- + text : str + Notes to be inserted. + + Returns + ------- + bool + ``True`` when successful, ``False`` when failed. + """ + if not isinstance(text, str): + self.logger.error("Text is not valid.") + return False + self.odesign.EditNotes(text) + return True + class DesignSettings: """Get design settings for the current AEDT app. From a76d62aca63fd815f90aad9c71986e32d208cd28 Mon Sep 17 00:00:00 2001 From: Abdun Nur <146203416+anur7@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:43:09 +0200 Subject: [PATCH 2/4] Update src/ansys/aedt/core/application/design.py Co-authored-by: gmalinve <103059376+gmalinve@users.noreply.github.com> --- src/ansys/aedt/core/application/design.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/aedt/core/application/design.py b/src/ansys/aedt/core/application/design.py index 42614cd3f9a..fc48170fca9 100644 --- a/src/ansys/aedt/core/application/design.py +++ b/src/ansys/aedt/core/application/design.py @@ -4210,7 +4210,7 @@ def edit_notes(self, text): Parameters ---------- text : str - Notes to be inserted. + Text to be added in the design notes. Returns ------- From 429337ea375fc43daee3e48d39a5ca015f3ec07f Mon Sep 17 00:00:00 2001 From: Abdun Nur <146203416+anur7@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:45:18 +0200 Subject: [PATCH 3/4] Update src/ansys/aedt/core/application/design.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --- src/ansys/aedt/core/application/design.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/aedt/core/application/design.py b/src/ansys/aedt/core/application/design.py index fc48170fca9..da3854fe5fe 100644 --- a/src/ansys/aedt/core/application/design.py +++ b/src/ansys/aedt/core/application/design.py @@ -4218,7 +4218,7 @@ def edit_notes(self, text): ``True`` when successful, ``False`` when failed. """ if not isinstance(text, str): - self.logger.error("Text is not valid.") + self.logger.error("Input type of edit_notes is not valid.") return False self.odesign.EditNotes(text) return True From 617e727a39ed066ef553ab7a1b3670ee04a0f542 Mon Sep 17 00:00:00 2001 From: anur7 Date: Thu, 10 Oct 2024 15:04:35 +0200 Subject: [PATCH 4/4] documentation: added description of the method, reference and example --- src/ansys/aedt/core/application/design.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ansys/aedt/core/application/design.py b/src/ansys/aedt/core/application/design.py index da3854fe5fe..4a39dd017b9 100644 --- a/src/ansys/aedt/core/application/design.py +++ b/src/ansys/aedt/core/application/design.py @@ -4207,6 +4207,8 @@ def set_temporary_directory(self, path): def edit_notes(self, text): """Edit notes. + Notes are used to document aspects of designs only. + Parameters ---------- text : str @@ -4216,6 +4218,18 @@ def edit_notes(self, text): ------- bool ``True`` when successful, ``False`` when failed. + + References + ---------- + + >>> oDesign.EditNotes() + + Examples + -------- + + >>> from ansys.aedt.core import Maxwell3d + >>> m3d = Maxwell3d() + >>> m3d.edit_notes("This is an example.") """ if not isinstance(text, str): self.logger.error("Input type of edit_notes is not valid.")