Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
- N/A

## [26.0.5]

### Added
- N/A

### Changed
- `MeshGenerator.cad_mesh_grading_factor` now accepts `float` values in range 0.0 to 1.0 instead of enum/integer-coded options

### Deprecated
- N/A

### Removed
- `GradingFactor` enum - incorrectly restricted the API to discrete values when the COM API accepts continuous float values from 0.0 to 1.0

### Fixed
- Fixed `MeshGenerator.cad_mesh_grading_factor` to properly accept float/double values matching the COM API signature instead of restricting to enum values

### Security
- N/A

## [26.0.4]

### Added
Expand Down
4 changes: 0 additions & 4 deletions docs/source/components/enums/grading_factor.rst

This file was deleted.

1 change: 0 additions & 1 deletion src/moldflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
from .common import DuplicateOption
from .common import EdgeDisplayOptions
from .common import EntityType
from .common import GradingFactor
from .common import GeomType
from .common import ImportUnitIndex
from .common import ImportUnits
Expand Down
9 changes: 0 additions & 9 deletions src/moldflow/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,6 @@ class TriClassification(Enum):
PRESERVE_ALL = 2


class GradingFactor(Enum):
"""
Enum for GradingFactor
"""

SLOW = 0
FAST = 1


class GeomType(Enum):
"""
Enum for GeomType
Expand Down
8 changes: 4 additions & 4 deletions src/moldflow/mesh_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
NurbsAlgorithm,
CoolType,
TriClassification,
GradingFactor,
GeomType,
Mesher3DType,
CADContactMesh,
Expand Down Expand Up @@ -732,15 +731,16 @@ def cad_mesh_grading_factor(self) -> float:
return self.mesh_generator.CadMeshGradingFactor

@cad_mesh_grading_factor.setter
def cad_mesh_grading_factor(self, value: GradingFactor | int) -> None:
def cad_mesh_grading_factor(self, value: float) -> None:
"""
Set the CAD mesh grading factor option.
"""
process_log(
__name__, LogMessage.PROPERTY_SET, locals(), name="cad_mesh_grading_factor", value=value
)
value = get_enum_value(value, GradingFactor)
self.mesh_generator.CadMeshGradingFactor = value
check_type(value, (int, float))
check_range(value, 0, 1, True, True)
self.mesh_generator.CadMeshGradingFactor = float(value)

@property
def cad_mesh_minimum_curvature_percentage(self) -> float:
Expand Down
22 changes: 7 additions & 15 deletions tests/api/unit_tests/test_unit_mesh_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
NurbsAlgorithm,
CoolType,
TriClassification,
GradingFactor,
Mesher3DType,
CADContactMesh,
)
Expand Down Expand Up @@ -134,8 +133,9 @@ def test_functions_no_args(
("cad_auto_size_scale", "CadAutoSizeScale", 50, (int, float)),
("cad_sliver_remove", "CadSliverRemove", True, bool),
("cad_sliver_remove", "CadSliverRemove", False, bool),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 0, int),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 1, int),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 0.0, (int, float)),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 0.5, (int, float)),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 1.0, (int, float)),
(
"cad_mesh_minimum_curvature_percentage",
"CadMeshMinimumCurvaturePercentage",
Expand Down Expand Up @@ -312,8 +312,9 @@ def test_get_properties(
("cad_auto_size_scale", "CadAutoSizeScale", 50, (int, float)),
("cad_sliver_remove", "CadSliverRemove", True, bool),
("cad_sliver_remove", "CadSliverRemove", False, bool),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 0, int),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 1, int),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 0.0, (int, float)),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 0.5, (int, float)),
("cad_mesh_grading_factor", "CadMeshGradingFactor", 1.0, (int, float)),
(
"cad_mesh_minimum_curvature_percentage",
"CadMeshMinimumCurvaturePercentage",
Expand Down Expand Up @@ -450,7 +451,7 @@ def test_set_properties(
+ [("use_auto_size", x) for x in ["abc", -1, 1.0, 1, 1.5, None]]
+ [("cad_auto_size_scale", x) for x in ["abc", True, None]]
+ [("cad_sliver_remove", x) for x in ["abc", -1, 1.0, 1, 1.5, None]]
+ [("cad_mesh_grading_factor", x) for x in ["abc", True, 1.5, None]]
+ [("cad_mesh_grading_factor", x) for x in ["abc", True, None]]
+ [("cad_mesh_minimum_curvature_percentage", x) for x in ["abc", True, None]]
+ [("use_fallbacks", x) for x in ["abc", -1, 1.0, 1, 1.5, None]]
+ [("max_edge_length_in_thickness_direction", x) for x in ["abc", True, None]]
Expand Down Expand Up @@ -505,7 +506,6 @@ def test_set_properties_invalid_value(
"property_name, invalid_value",
[("nurbs_mesher", x) for x in [-1, 10, 5]]
+ [("cad_contact_mesh_type", x) for x in ["abc", "Something"]]
+ [("cad_mesh_grading_factor", x) for x in [-1, 10, 5]]
+ [("source_geom_type", x) for x in ["Hello", "abc"]]
+ [("cool_type", x) for x in [-1, 10, 5]]
+ [("tri_classification_opt", x) for x in [-1, 10, 5]],
Expand Down Expand Up @@ -552,14 +552,6 @@ def test_gel_false(self, mock_mesh_generator, mock_object):
("tri_classification_opt", "TriClassificationOpt", x.value, x.value, int)
for x in TriClassification
]
+ [
("cad_mesh_grading_factor", "CadMeshGradingFactor", x, x.value, int)
for x in GradingFactor
]
+ [
("cad_mesh_grading_factor", "CadMeshGradingFactor", x.value, x.value, int)
for x in GradingFactor
]
+ [("mesher_3d", "Mesher3D", x, x.value, str) for x in Mesher3DType]
+ [("mesher_3d", "Mesher3D", x.value, x.value, str) for x in Mesher3DType]
+ [("source_geom_type", "SourceGeomType", x, x.value, str) for x in GeomType]
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"major": "26",
"minor": "0",
"patch": "4"
"patch": "5"
}