Skip to content

Conversation

@PProfizi
Copy link
Contributor

Closes #1532

@PProfizi PProfizi added the enhancement New feature or request label Apr 24, 2024
@PProfizi PProfizi added this to the v0.12.1 milestone Apr 24, 2024
@PProfizi PProfizi self-assigned this Apr 24, 2024
@PProfizi PProfizi merged commit 8a44c9c into master Apr 26, 2024
@PProfizi PProfizi deleted the feat/plotter_parallel_projection branch April 26, 2024 09:35
Copy link

@ZanePC ZanePC left a comment

Choose a reason for hiding this comment

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

Thank you, it's working!

@ZanePC
Copy link

ZanePC commented May 3, 2024

Sorry, it's me again. A new problem has arisen. In the same camera perspective (cpos), the field of view in parallel views is much smaller than that in perspective views, so the zoom option in pyvista. plot() is needed to adjust the field of view. Although that can be manually adjusted in interactive mode (interactive=True), it is impossible to adjust each image when saving screenshots in batch mode. I tried to modify the source code of dpf, but failed.

@PProfizi
Copy link
Contributor Author

PProfizi commented May 3, 2024

Sorry, it's me again. A new problem has arisen. In the same camera perspective (cpos), the field of view in parallel views is much smaller than that in perspective views, so the zoom option in pyvista. plot() is needed to adjust the field of view. Although that can be manually adjusted in interactive mode (interactive=True), it is impossible to adjust each image when saving screenshots in batch mode. I tried to modify the source code of dpf, but failed.

Hello @ZanePC, are you referring to this functionality? https://docs.pyvista.org/version/stable/api/plotting/_autosummary/pyvista.plotter.zoom_camera

@ZanePC
Copy link

ZanePC commented May 3, 2024

Thanks to your prompt, I succeeded! I have added code in the following two places in dpf/core/plotter.py, hoping to add it to future versions (if this is the most elegant way to implement it).

Code 1
image

Code 2
image

@PProfizi
Copy link
Contributor Author

PProfizi commented May 3, 2024

@ZanePC thanks for that, I'll make a PR proposing these changes if that's OK with you. I'll also update the plotting examples and the docstrings.

@ZanePC
Copy link

ZanePC commented May 4, 2024

Sure, I'm glad I could offer you this little bit of help. Thank you very much for your excellent work!

@ZanePC
Copy link

ZanePC commented May 5, 2024

Hi PProfizi, I'm here to provide feedback again. I'm sorry I didn't finish all the related issues at once. The new issue is that when using the DpfPlotter class for plotting, "parallel_projection=True" will fail. So I moved the code you wrote to the vicinity of the "zoom" code mentioned last time, and the modified code is as follows:

Code 1
image

Code 2
image

Code 3
image

It should be noted that the code snippet for "parallel_projection" must come before "zoom", otherwise "zoom" will not work

After my testing, "parallel_projection" and "zoom" can all work in the following three plotting methods:

  1. Class Model, function metadata.meshed_region.plot();
  2. Class DpfPlotter, function show_figure();
  3. Class Plotter, function plot_contour().

@ZanePC
Copy link

ZanePC commented Feb 19, 2025

@ZanePC thanks for that, I'll make a PR proposing these changes if that's OK with you. I'll also update the plotting examples and the docstrings.

Hello PProfizi (@PProfizi),

In the new version of dpf, although parallel view can now be activated, "zoom" functionality is still not available. The code modifications I mentioned earlier can resolve this issue (link attached). I hope these changes can be incorporated into the next version. Thank you very much!

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please add option for parallel views

4 participants