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

Add Region class method for Corner Rounding #335

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

JackB-Ansys
Copy link
Collaborator

@JackB-Ansys JackB-Ansys commented Jul 8, 2024

A method for defining automatic corner rounding for regions.
The method finds entities that contain the specified corner coordinate, cuts the entities by a certain distance and draws an arc between the new start/end coordinates.

Example shown for triangular rotor notch example, .mot file for this example attached (in zip):
image
e9_Tri_Rotor_Notch_Rounded.zip
Trapezoidal Duct example with corner rounding also attached (in zip):
Trapezoidal_duct_rounded.zip

Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.57%. Comparing base (ebedc21) to head (af8abc6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #335      +/-   ##
==========================================
- Coverage   87.00%   85.57%   -1.44%     
==========================================
  Files          20       21       +1     
  Lines        2039     2183     +144     
==========================================
+ Hits         1774     1868      +94     
- Misses        265      315      +50     

Copy link
Collaborator

@jgsdavies jgsdavies left a comment

Choose a reason for hiding this comment

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

Spotted some cases that need handling:

  1. Rounding a corner with arc/line intersection doesn't quite seem right:
    image

This is a slightly more complicated case. Happy to also just throw an exception for now if you don't want to implement this. Also need to consider arc/arc intersection.

  1. I think we should check that the intersecting lines have the length the perform the requested rounding. At the moment I can increase the radius as far as I like with no errors
    image

@JackB-Ansys
Copy link
Collaborator Author

Spotted some cases that need handling:

  1. Rounding a corner with arc/line intersection doesn't quite seem right:
    image

This is a slightly more complicated case. Happy to also just throw an exception for now if you don't want to implement this. Also need to consider arc/arc intersection.

  1. I think we should check that the intersecting lines have the length the perform the requested rounding. At the moment I can increase the radius as far as I like with no errors
    image

I think we can avoid these issues with the new commits. Now an exception is thrown if a corner radius is given that would shorten an entity by more than its length

@jgsdavies jgsdavies linked an issue Sep 17, 2024 that may be closed by this pull request
@JackB-Ansys
Copy link
Collaborator Author

I think all the necessary tests should now be there.

Comment on lines +527 to +530
corner_coordinate : ansys.motorcad.core.geometry.Coordinate
Coordinate of the corner to be rounded.
radius : float
Radius by which the corner will be rounded.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
corner_coordinate : ansys.motorcad.core.geometry.Coordinate
Coordinate of the corner to be rounded.
radius : float
Radius by which the corner will be rounded.
corner_coordinate : ansys.motorcad.core.geometry.Coordinate
Coordinate of the corner to round.
radius : float
Radius to round the corner by.

Use present tense rather than future tense verbs.

if radius == 0:
return

# find adjacent entities. There should be 2 entities adjacent to the corner. Going
Copy link
Member

@PipKat PipKat Oct 31, 2024

Choose a reason for hiding this comment

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

When a comment consists of multiple sentences, it is preferable, but not mandatory, to start them all with a capital letter. The same is true if you are using a concluding punctuation mark at the end of a comment that is only a single sentence.

Parameters
----------
corner_coordinates : list of ansys.motorcad.core.geometry.Coordinate
List of coordinates of the corners to be rounded.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
List of coordinates of the corners to be rounded.
List of coordinates of the corners to round.

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.

Add corner rounding functions to Region() class
3 participants