From ed4c273371ec3469b40772c26af059558ca6269e Mon Sep 17 00:00:00 2001 From: maxcapodi78 Date: Fri, 13 Oct 2023 14:07:46 +0200 Subject: [PATCH 1/4] improved plot of object with a minor bug fix on object transparency. --- examples/02-HFSS/Waveguide_Filter.py | 17 +++++++++++++++-- pyaedt/generic/plot.py | 3 ++- pyaedt/modules/PostProcessor.py | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index 42ed095620e..f3e7e42f148 100644 --- a/examples/02-HFSS/Waveguide_Filter.py +++ b/examples/02-HFSS/Waveguide_Filter.py @@ -199,8 +199,7 @@ def place_iris(zpos, dz, n): ############################################################################### # Generate S-Parameter Plots -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -################################################################################# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~ # The following commands fetch solution data from HFSS for plotting directly # from the Python interpreter. # Caution: The syntax for expressions must be identical to that used @@ -209,7 +208,21 @@ def place_iris(zpos, dz, n): traces_to_plot = hfss.get_traces_for_plot(second_element_filter="P1*") report = hfss.post.create_report(traces_to_plot) # Creates a report in HFSS solution = report.get_solution_data() + plt = solution.plot(solution.expressions) # Matplotlib axes object. +############################################################################### +# Generate E field plot +# ~~~~~~~~~~~~~~~~~~~~~ +# The following command generate a field plot in HFSS and uses pyvista +# to plot the field in Jupyter. + +plot=hfss.post.plot_field("Mag_E",["Global:XZ"], "CutPlane",hfss.nominal_adaptive, intrinsics={"Freq":"9.8GHz", "Phase":"0deg"}) + +############################################################################### +# Save and close the desktop +# ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The following command save the project to file and close the desktop. + hfss.save_project() hfss.release_desktop() diff --git a/pyaedt/generic/plot.py b/pyaedt/generic/plot.py index dfc1b54bcab..d34c27dd99f 100644 --- a/pyaedt/generic/plot.py +++ b/pyaedt/generic/plot.py @@ -1516,6 +1516,7 @@ def plot(self, export_image_path=None): bool """ self.pv = pv.Plotter(notebook=self.is_notebook, off_screen=self.off_screen, window_size=self.windows_size) + self.pv.enable_ssao() self.meshes = None if self.background_image: self.pv.add_background_image(self.background_image) @@ -1582,7 +1583,7 @@ def plot(self, export_image_path=None): if self.show_axes: self.pv.show_axes() - if not self.is_notebook: + if not self.is_notebook and self.show_grid: self.pv.show_grid(color=tuple(axes_color), grid=self.show_grid, fmt="%.3e") if self.bounding_box: self.pv.add_bounding_box(color=tuple(axes_color)) diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index 9cff1b14e91..b6d70f752d3 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -3450,7 +3450,7 @@ def export_model_obj(self, obj_list=None, export_path=None, export_as_single_obj if not self._app.modeler[el].display_wireframe: transp = 0.6 t = self._app.modeler[el].transparency - if t: + if t is not None: transp = t files_exported.append([fname, self._app.modeler[el].color, 1 - transp]) else: From a5c9d5ee299bb508ad938e8cb424ae1d1af6929d Mon Sep 17 00:00:00 2001 From: maxcapodi78 Date: Fri, 13 Oct 2023 14:10:21 +0200 Subject: [PATCH 2/4] improved plot of object with a minor bug fix on object transparency. --- examples/02-HFSS/Waveguide_Filter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index f3e7e42f148..9e89127ec80 100644 --- a/examples/02-HFSS/Waveguide_Filter.py +++ b/examples/02-HFSS/Waveguide_Filter.py @@ -217,7 +217,13 @@ def place_iris(zpos, dz, n): # The following command generate a field plot in HFSS and uses pyvista # to plot the field in Jupyter. -plot=hfss.post.plot_field("Mag_E",["Global:XZ"], "CutPlane",hfss.nominal_adaptive, intrinsics={"Freq":"9.8GHz", "Phase":"0deg"}) +plot=hfss.post.plot_field(quantity="Mag_E", + objects_list=["Global:XZ"], + plot_type="CutPlane", + setup_name=hfss.nominal_adaptive, + intrinsics={"Freq":"9.8GHz", "Phase":"0deg"}, + export_path=hfss.working_directory, + show=False) ############################################################################### # Save and close the desktop From f0ae8d935b782978afdd0d2a86180d6b8edfef59 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro <77293250+maxcapodi78@users.noreply.github.com> Date: Mon, 16 Oct 2023 08:23:45 +0200 Subject: [PATCH 3/4] Update examples/02-HFSS/Waveguide_Filter.py Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- examples/02-HFSS/Waveguide_Filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index 9e89127ec80..97699afa375 100644 --- a/examples/02-HFSS/Waveguide_Filter.py +++ b/examples/02-HFSS/Waveguide_Filter.py @@ -214,7 +214,7 @@ def place_iris(zpos, dz, n): ############################################################################### # Generate E field plot # ~~~~~~~~~~~~~~~~~~~~~ -# The following command generate a field plot in HFSS and uses pyvista +# The following command generates a field plot in HFSS and uses PyVista # to plot the field in Jupyter. plot=hfss.post.plot_field(quantity="Mag_E", From d860fa7284af1db93403caee63e8a4c189365d1f Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro <77293250+maxcapodi78@users.noreply.github.com> Date: Mon, 16 Oct 2023 08:23:50 +0200 Subject: [PATCH 4/4] Update examples/02-HFSS/Waveguide_Filter.py Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- examples/02-HFSS/Waveguide_Filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index 97699afa375..edae3bcad21 100644 --- a/examples/02-HFSS/Waveguide_Filter.py +++ b/examples/02-HFSS/Waveguide_Filter.py @@ -228,7 +228,7 @@ def place_iris(zpos, dz, n): ############################################################################### # Save and close the desktop # ~~~~~~~~~~~~~~~~~~~~~~~~~~ -# The following command save the project to file and close the desktop. +# The following command saves the project to a file and closes the desktop. hfss.save_project() hfss.release_desktop()