Skip to content

Enhancement/plot class #718

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

Merged
merged 50 commits into from
Jan 17, 2022
Merged

Enhancement/plot class #718

merged 50 commits into from
Jan 17, 2022

Conversation

maxcapodi78
Copy link
Collaborator

No description provided.

@akaszynski
Copy link
Contributor

akaszynski commented Jan 13, 2022

We need to add the ability to return the pyvista.Plotter instance when running:
https://github.com/pyansys/pyaedt/blob/1fde412f5591d2528a8d514da8b1e8d67fc95901/pyaedt/modules/AdvancedPostProcessing.py#L622

Recommend changing the function signature to:

 def plot(self, export_image_path=None, return_plotter=False, show=True): 

That way, downstream users can add to the existing pyvista plotter and make their own animations or scenes. Then, in plot_model_obj, provide the ability to return_plotter and then:

pl = hfss.plot.plot_model_obj(return_plotter=True)

##############################
# Add Radar Data to Plotter

radar_sgrid = pyvista.StructuredGrid(x, y, z)

# add individual radar frames
for i in range(100):
    radar_sgrid['radar_%03d' % i] = mydata[i]

pl.add_mesh(radar_sgrid)

# then animate by following this example
# https://docs.pyvista.org/examples/02-plot/gif.html
# 
# Differences:
# - don't plotter.write_frame()
# - don't update_scalars, rather radar_sgrid.active_scalars_name = 'radar_%03d' % frame

Pinging @ushechip


Main point is to provide an interface so we can customize the output from:
https://github.com/pyansys/pyaedt/blob/be9cccd51b8bcc29a487457a5e22d5d329d4db25/pyaedt/modules/AdvancedPostProcessing.py#L1329

Or, export to html with:

pl.export_html('myplot.html')

@maxcapodi78 maxcapodi78 marked this pull request as ready for review January 14, 2022 10:03
Comment on lines +97 to +98
self._color = (0, 0, 0)
self.color = color
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you can only set the protected attribute. Then the color property will return the correct value latter on.

Suggested change
self._color = (0, 0, 0)
self.color = color
self._color = color

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the color setter is handling both a tuple or a string "white". That's why you have to use the setter and not instantiate directly the internal variable

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it.

@maxcapodi78 maxcapodi78 merged commit 1e3d80a into main Jan 17, 2022
@maxcapodi78 maxcapodi78 deleted the Enhancement/PlotClass branch January 17, 2022 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants