Skip to content

Add plotting floors#423

Merged
akaszynski merged 21 commits intomasterfrom
floors
Apr 3, 2020
Merged

Add plotting floors#423
akaszynski merged 21 commits intomasterfrom
floors

Conversation

@banesullivan
Copy link
Copy Markdown
Member

This adds a helper method to add a floor/wall at the boundary of the rendering scene

import pyvista as pv
from pyvista import examples

mesh = examples.download_dragon()

p = pv.Plotter()
p.add_mesh(mesh)
p.add_floor('-y')
p.add_floor('-z')
p.show()

download

@banesullivan banesullivan changed the title Plotting floors 🚧 Plotting floors Nov 24, 2019
@akaszynski akaszynski marked this pull request as ready for review December 8, 2019 21:07
@akaszynski
Copy link
Copy Markdown
Member

Weird that my example caused it to fail since I only modified the examples. Potentially due to a change in master?

@GuillaumeFavelier
Copy link
Copy Markdown
Contributor

GuillaumeFavelier commented Dec 18, 2019

I noticed that it's possible to add multiple floors with add_floor() but you can only remove the last one with remove_floor()

@banesullivan
Copy link
Copy Markdown
Member Author

I noticed that it's possible to add multiple floors with add_floor() but you can only remove the last one with remove_floor()

Indeed - this still needs to be worked out

@GuillaumeFavelier GuillaumeFavelier added the feature-request Please add this cool feature! label Dec 24, 2019
@GuillaumeFavelier
Copy link
Copy Markdown
Contributor

GuillaumeFavelier commented Jan 27, 2020

I noticed that it's possible to add multiple floors with add_floor() but you can only remove the last one with remove_floor()

With more thoughts, I think it depends on the API for it. What would be best?

  • one call to remove_floor() for each call to add_floor()
  • one call to remove_floor(all=True) or remove_floors() to remove everything

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2020

Codecov Report

Merging #423 into master will decrease coverage by 0.15%.
The diff coverage is 62.50%.

@@            Coverage Diff             @@
##           master     #423      +/-   ##
==========================================
- Coverage   84.50%   84.35%   -0.16%     
==========================================
  Files          34       34              
  Lines        9264     9344      +80     
==========================================
+ Hits         7829     7882      +53     
- Misses       1435     1462      +27     

@akaszynski
Copy link
Copy Markdown
Member

I noticed that it's possible to add multiple floors with add_floor() but you can only remove the last one with remove_floor()

With more thoughts, I think it depends on the API for it. What would be best?

  • one call to remove_floor() for each call to add_floor()
  • one call to remove_floor(all=True) or remove_floors() to remove everything

I went ahead and implemented remove_floors as it's the cleanest API, and there's not a good way to track which floor is removed. Full example is:

import pyvista as pv
from pyvista import examples

mesh = examples.download_dragon()

p = pv.Plotter()
p.add_mesh(mesh)
p.add_floor('-y')
p.add_floor('-z')
p.remove_floors()
p.show()

Which will just plot the dragon.

@akaszynski akaszynski changed the title 🚧 Plotting floors Add plotting floors Apr 2, 2020
Copy link
Copy Markdown
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

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

I'm happy with this PR and @banesullivan's commits, but I'd like someone to review my changes (remove_floors, wrapping the renderer method). @banesullivan, I'll leave it up to you to merge this as it's your PR.

@akaszynski akaszynski merged commit 2c93ace into master Apr 3, 2020
@akaszynski akaszynski mentioned this pull request Apr 7, 2020
@akaszynski akaszynski deleted the floors branch April 9, 2020 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-request Please add this cool feature!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants