Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved plot of object with a minor bug fix on object transparency. #3755

Merged
merged 4 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions examples/02-HFSS/Waveguide_Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
3 changes: 2 additions & 1 deletion pyaedt/generic/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/modules/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3450,7 +3450,7 @@
if not self._app.modeler[el].display_wireframe:
transp = 0.6
t = self._app.modeler[el].transparency
if t:
if t is not None:

Check warning on line 3453 in pyaedt/modules/PostProcessor.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/PostProcessor.py#L3453

Added line #L3453 was not covered by tests
transp = t
files_exported.append([fname, self._app.modeler[el].color, 1 - transp])
else:
Expand Down
Loading