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

feat: node/element selection commands returning selected ids #3636

Merged
merged 9 commits into from
Jan 8, 2025

Conversation

moe-ad
Copy link
Contributor

@moe-ad moe-ad commented Jan 7, 2025

Description

Currently, commands such as mapdl.nsel() or mapdl.esel() will return a numpy array of selected objects' IDs. This is extremely useful when scripting since the selected IDs can be saved in a variable to be accessed later. Similar commands like mapdl.esln() or mapdl.nsle() do not have this behavior. Instead they return some selection status string from the running mapdl instance.

This PR adds the described functionality to the mapdl.esln() and mapdl.nsle() commands.

Issue linked

This PR will close #3635

Checklist

@moe-ad moe-ad self-assigned this Jan 7, 2025
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@github-actions github-actions bot added the new feature Request or proposal for a new feature label Jan 7, 2025
@moe-ad moe-ad changed the title Feat: Node/Element selection commands returning selected IDs feat: node/element selection commands returning selected ids Jan 7, 2025
@github-actions github-actions bot added examples Publishing PyMAPDL examples documentation Documentation related (improving, adding, etc) labels Jan 7, 2025
@moe-ad
Copy link
Contributor Author

moe-ad commented Jan 7, 2025

Before:
before

After:
after

Looks like that is everything that requires changing. Pinging @germa89 incase there is anything else to take note of.
@clatapie thanks for our discussions on this.

@github-actions github-actions bot removed examples Publishing PyMAPDL examples documentation Documentation related (improving, adding, etc) labels Jan 7, 2025
Copy link
Collaborator

@germa89 germa89 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 a lot for this @moe-ad :). However, for this to be approved, you need to add some unit tests. I'm sure you know the procedure, but in case you have any doubt please check: https://mapdl.docs.pyansys.com/version/stable/getting_started/develop_pymapdl.html#unit-testing

Which you can reach from main documentation page https://mapdl.docs.pyansys.com :

image

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.06%. Comparing base (e83f46c) to head (0a824bb).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3636      +/-   ##
==========================================
- Coverage   87.08%   87.06%   -0.02%     
==========================================
  Files         187      187              
  Lines       14679    14683       +4     
==========================================
+ Hits        12783    12784       +1     
- Misses       1896     1899       +3     

@moe-ad
Copy link
Contributor Author

moe-ad commented Jan 8, 2025

@germa89 , thanks for the guide. I have added the tests.

@moe-ad moe-ad marked this pull request as ready for review January 8, 2025 09:29
@moe-ad moe-ad requested a review from a team as a code owner January 8, 2025 09:29
Copy link
Collaborator

@germa89 germa89 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you a lot @moe-ad ! Feel free to merge!

@moe-ad moe-ad merged commit ce34c76 into main Jan 8, 2025
50 checks passed
@moe-ad moe-ad deleted the feat/selection-commands-returning-ids branch January 8, 2025 11:40
@jorgepiloto
Copy link
Member

Congrats on this, @moe-ad 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Request or proposal for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node/Element selection commands returning selected IDs
4 participants