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

Mesh selection #2207

Merged
merged 91 commits into from
Aug 19, 2023
Merged

Mesh selection #2207

merged 91 commits into from
Aug 19, 2023

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Jul 25, 2023

As the title.

This PR should enable mesh interactive picking when using mapdl.%XSEL%("%Y%", "P") where %XSEL% is a selection command such as vsel, or asel. It should work also with esel and lsel but I didn't test it. The commands ksel and nsel were already implemented in another PR (#1123). %Y% is a selection type, meaning S for new selection, R for reselecting, U for unselecting and A for adding.

When issued for example mapdl.vsel("s", "P"), it should show a window:

I rather you do not read much of the following, the window shown should be self-explanatory

image

with the volumes being pickable using the right button.

image

You can change between selecting and unselecting mode pressing the key U.

image

Finally, when closing the window, you should get back an array with the ids of the entities selected:

>>> mapdl.vsel("s", "P")
array([1])

Notes

  • Do we want to pick with the right or left mouse button?
  • I am quite interested in testing all edge cases. For example, the addition case, A.

germa89 and others added 30 commits May 31, 2023 11:54
Fixing tests
Updating slightly some examples
Simplying some stuff
Using pv.PolyData for kps
Speeding up `get_volumes` by smart mapping areas to volumes. We only call once `generate_surface` which is expensive.
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #2207 (ab6c421) into main (e3885fb) will increase coverage by 1.33%.
Report is 95 commits behind head on main.
The diff coverage is 92.47%.

@@            Coverage Diff             @@
##             main    #2207      +/-   ##
==========================================
+ Coverage   86.39%   87.72%   +1.33%     
==========================================
  Files          45       45              
  Lines        7977     8410     +433     
==========================================
+ Hits         6892     7378     +486     
+ Misses       1085     1032      -53     

@germa89 germa89 marked this pull request as ready for review August 16, 2023 11:46
@germa89 germa89 mentioned this pull request Aug 16, 2023
@germa89 germa89 enabled auto-merge (squash) August 16, 2023 12:27
@germa89
Copy link
Collaborator Author

germa89 commented Aug 17, 2023

This PR will need manual testing.

Pinging @clatapie @mikerife @mcMunich @pmaroneh for manual testing.

Example code for testing:

from ansys.mapdl.core import launch_mapdl
import numpy as np

mapdl = launch_mapdl(start_instance=False)
mapdl.clear()
mapdl.prep7()
mapdl.block(0, 1, 0, 1, 0, 1)

mapdl.block(-2, 0, -2, 0, 1, 2)

mapdl.asel("s", "P")
mapdl.vsel("s", "P")
mapdl.lsel("s", "P")  # I didn't test this one.

@germa89 germa89 disabled auto-merge August 17, 2023 10:37
@germa89
Copy link
Collaborator Author

germa89 commented Aug 17, 2023

Updated PR description

@clatapie
Copy link
Contributor

The lsel doesn't seem to work on my side.
When I click on one line, all the lines are selected at once and I can't unselect them one by one as it seems it's considered as one line:

image

>>> mapdl.lsel("s", "P")
array([1])

Apart from that, the other commands run fine on my local installation:

>>> mapdl.asel("s", "P")
array([ 8, 10, 12])

>>> mapdl.vsel("s", "P")
array([2])

@germa89
Copy link
Collaborator Author

germa89 commented Aug 17, 2023

roger

@germa89
Copy link
Collaborator Author

germa89 commented Aug 18, 2023

LSEL is fixed. Please @clatapie check it out again please.

@clatapie
Copy link
Contributor

I confirm: it works fine on my local installation after the latest changes.

image

>>> mapdl.lsel("s", "P")
array([ 1,  6, 11, 12, 23])

Copy link
Contributor

@clatapie clatapie left a comment

Choose a reason for hiding this comment

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

LGTM!

@germa89 germa89 merged commit ab75de2 into main Aug 19, 2023
22 checks passed
@germa89 germa89 deleted the feat/mesh-selection branch August 19, 2023 20:43
@mcMunich
Copy link
Contributor

One suggestion: the nsel works but since it only shows nodes it is hard to determine what exactly is being selected.
ADPL Classic you can pick nodes when viewing elements (eplot then nsel):
image
And the nplot is the right plot obviously for picking nodes but the surfaces help guide the user around the model (ease of use):
image

@germa89
Copy link
Collaborator Author

germa89 commented Aug 23, 2023

I can try to add areas/lines with some sort of transparency... I can look into this.

Did you @mcMunich try using "R", "A", etc?? For instance:

mapdl.lsel("s", vmin=2)
mapdl.lsel("r", "P") # Check there is a line already selected)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE Not ready to be merged yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants