Skip to content

Cherrypick PR #47: Fix cad_mesh_grading_factor to accept float values and remove GradingFactor enum - #53

Merged
sankalps0549 merged 2 commits into
mainfrom
copilot/cherrypick-pr-47-changes
Dec 12, 2025
Merged

sankalps0549 merged 2 commits into
mainfrom
copilot/cherrypick-pr-47-changes

Conversation

Copilot AI commented Dec 12, 2025 •

Copy link
Copy Markdown
Contributor

Description

Cherrypicks changes from PR #47 (merged to release/26) into main. The cad_mesh_grading_factor property incorrectly used a GradingFactor enum restricting values to SLOW=0 and FAST=1. The underlying COM API accepts double from 0.0 to 1.0 for continuous mesh transition control.

Changes:

  • Removed GradingFactor enum from common.py and __init__.py
  • Updated cad_mesh_grading_factor setter to accept float with range validation [0, 1]
  • Updated tests to use float values (0.0, 0.5, 1.0) instead of enum
  • Deleted grading_factor.rst documentation
  • Updated CHANGELOG.md with breaking change

Before:

from moldflow import MeshGenerator, GradingFactor

mesh_gen.cad_mesh_grading_factor = GradingFactor.SLOW  # Only 0 or 1

After:

from moldflow import MeshGenerator

mesh_gen.cad_mesh_grading_factor = 0.0   # slow transition
mesh_gen.cad_mesh_grading_factor = 0.5   # medium transition
mesh_gen.cad_mesh_grading_factor = 1.0   # fast transition

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the style guidelines of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • I have added a note to CHANGELOG.md describing my changes
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Testing

Tests validate float range and type checking:

# Valid float values in range [0, 1]
@pytest.mark.parametrize("value", [0.0, 0.5, 1.0])
def test_cad_mesh_grading_factor_valid(mock_mesh_generator, value):
    mock_mesh_generator.cad_mesh_grading_factor = value
    assert mock_mesh_generator.cad_mesh_grading_factor == value

# Invalid types
@pytest.mark.parametrize("value", ["abc", True, None])
def test_cad_mesh_grading_factor_invalid_type(mock_mesh_generator, value):
    with pytest.raises(TypeError):
        mock_mesh_generator.cad_mesh_grading_factor = value

Additional Notes

Breaking Change: Code using GradingFactor.SLOW or GradingFactor.FAST must update to 0.0 or 1.0. Enum imports will fail.

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] Cherrypick changes from PR #47 into the main branch</issue_title>
<issue_description>Describe the bug
The fix in #47 for release/26 needs to brought into the main branch.

Additional context
Add any other context about the problem here.
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… and remove GradingFactor enum

Co-authored-by: osinjoku <49887472+osinjoku@users.noreply.github.com>
Copilot AI changed the title [WIP] Cherrypick changes from PR #47 into main branch Cherrypick PR #47: Fix cad_mesh_grading_factor to accept float values and remove GradingFactor enum Dec 12, 2025
Copilot AI requested a review from osinjoku December 12, 2025 06:10
@osinjoku
osinjoku marked this pull request as ready for review December 12, 2025 06:17
@sankalps0549
sankalps0549 merged commit 613a61f into main Dec 12, 2025
21 checks passed
@sankalps0549
sankalps0549 deleted the copilot/cherrypick-pr-47-changes branch December 12, 2025 07:50
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.

[BUG] Cherrypick changes from PR #47 into the main branch

3 participants