diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index 42ed095620e..edae3bcad21 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,27 @@ 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 generates a field plot in HFSS and uses PyVista +# to plot the field in Jupyter. + +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 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The following command saves the project to a file and closes 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: