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
36 changes: 26 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Initial public release
- Python API wrapper for Moldflow Synergy
- Comprehensive test suite
- Documentation with examples
- CI/CD pipeline for automated testing and publishing
- N/A

### Changed
- N/A
Expand All @@ -29,13 +25,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
- N/A

## [26.0.0] - 2025-XX-XX
## [26.0.1] - 2025-09-12

### Added
- N/A

### Changed
- N/A

### Deprecated
- N/A

### Removed
- N/A

### Fixed
- Fix return types for `from_list` functions in data classes
- Fix color band range options to 1 to 256

### Security
- N/A

## [26.0.0] - 2025-09-01

### Added
- Initial version aligned with Moldflow Synergy 2026
- Basic API functionality
- Windows support
- Initial version aligned with Moldflow Synergy 2026.0.1
- Python 3.10-3.13 compatibility

[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.0...HEAD
[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.1...HEAD
[26.0.1]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.1
[26.0.0]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.0
2 changes: 1 addition & 1 deletion src/moldflow/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os

# Constants for color bands
COLOR_BAND_RANGE = tuple(list(range(2, 65)) + [256])
COLOR_BAND_RANGE = tuple(range(1, 257))

# Localization constants
DEFAULT_THREE_LETTER_CODE = "enu"
Expand Down
7 changes: 5 additions & 2 deletions src/moldflow/double_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,23 @@ def to_list(self) -> list[float]:
vb_array = self.double_array.ToVBSArray()
return list(vb_array)

def from_list(self, values: list[float]) -> None:
def from_list(self, values: list[float]) -> int:
"""
Convert a list of floats to a double array.

Args:
values (list[float]): The list of floats to convert.

Returns:
int: The number of elements added to the array.
"""
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="from_list")

check_type(values, (list, tuple))
for value in values:
check_type(value, (int, float))

self.double_array.FromVBSArray(list(values))
return self.double_array.FromVBSArray(list(values))

@property
def size(self) -> int:
Expand Down
7 changes: 5 additions & 2 deletions src/moldflow/integer_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,23 @@ def to_list(self) -> list[int]:
vb_array = self.integer_array.ToVBSArray()
return list(vb_array)

def from_list(self, values: list[int]) -> None:
def from_list(self, values: list[int]) -> int:
"""
Convert a list of integers to an integer array.

Args:
values (list[int]): The list of integers to convert.

Returns:
int: The number of elements added to the array.
"""
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="from_list")

check_type(values, (list, tuple))
for value in values:
check_type(value, int)

self.integer_array.FromVBSArray(list(values))
return self.integer_array.FromVBSArray(list(values))

@property
def size(self) -> int:
Expand Down
15 changes: 6 additions & 9 deletions src/moldflow/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,11 @@ def extended_color(self, value: bool) -> None:
@property
def color_bands(self) -> int:
"""
The number of color bands or smooth coloring.
- values between 2 through 64: banded coloring with this number of colors
- 256: smooth coloring
The number of color bands.
- values between 1 through 256: banded coloring with this number of colors


:getter: Get the number of color bands or smooth coloring.
:setter: Set the number of color bands or smooth coloring.
:getter: Get the number of color bands.
:setter: Set the number of color bands.
:type: int
"""
process_log(__name__, LogMessage.PROPERTY_GET, locals(), name="color_bands")
Expand All @@ -471,9 +469,8 @@ def color_bands(self) -> int:
@color_bands.setter
def color_bands(self, value: int) -> None:
"""
The number of color bands or smooth coloring.
- values between 2 through 64: banded coloring with this number of colors
- 256: smooth coloring
The number of color bands.
- values between 1 through 256: banded coloring with this number of colors

Args:
value (int): number of color bands or smooth coloring to set.
Expand Down
8 changes: 5 additions & 3 deletions src/moldflow/string_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,29 @@ def add_string(self, value: str) -> None:
def to_list(self) -> list[str]:
"""
Convert the string array to a list of strings.

Returns:
list[str]: The list of strings.
"""
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="to_list")
return _mf_array_to_list(self)

def from_list(self, values: list[str]) -> None:
def from_list(self, values: list[str]) -> int:
"""
Convert a list of strings to a string array.

Args:
values (list[str]): The list of strings to convert.

Returns:
int: The number of elements added to the array.
"""
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="from_list")
check_type(values, (list, tuple))

for value in values:
check_type(value, str)

self.string_array.FromVBSArray(list(values))
return self.string_array.FromVBSArray(list(values))

@property
def size(self) -> int:
Expand Down
6 changes: 5 additions & 1 deletion tests/api/unit_tests/test_unit_double_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ def test_to_list(self, mock_double_array, mock_object, values):
# pylint: disable=R0801
def test_from_list(self, mock_double_array, mock_object, values):
"""Test the from_list method of the DoubleArray class."""
mock_double_array.from_list(values)
mock_object.FromVBSArray.return_value = len(values)
result = mock_double_array.from_list(values)

assert isinstance(result, int)
assert result == len(values)
mock_object.FromVBSArray.assert_called_once_with(list(values))

@pytest.mark.parametrize("invalid_values", INVALID_MOCK_WITH_NONE)
Expand Down
5 changes: 4 additions & 1 deletion tests/api/unit_tests/test_unit_integer_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ def test_to_list(self, mock_integer_array, mock_object, values):
# pylint: disable=R0801
def test_from_list(self, mock_integer_array, mock_object, values):
"""Test the from_list method of the IntegerArray class."""
mock_integer_array.from_list(values)
mock_object.FromVBSArray.return_value = len(values)
result = mock_integer_array.from_list(values)

assert isinstance(result, int)
assert result == len(values)
mock_object.FromVBSArray.assert_called_once_with(list(values))

@pytest.mark.parametrize("invalid_values", INVALID_MOCK_WITH_NONE)
Expand Down
2 changes: 1 addition & 1 deletion tests/api/unit_tests/test_unit_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def test_invalid_properties(
@pytest.mark.parametrize(
"pascal_name, property_name, value",
[("SetMeshFill", "mesh_fill", x) for x in [-1.0, 2.0, 3.0]]
+ [("SetColorBands", "color_bands", x) for x in [1, 65, 128]]
+ [("SetColorBands", "color_bands", x) for x in [-1, 0, 257, 300]]
+ [("SetHistogramNumberOfBars", "histogram_number_of_bars", x) for x in [-1, -2, -3, -4]],
)
# pylint: disable-next=R0913, R0917
Expand Down
5 changes: 4 additions & 1 deletion tests/api/unit_tests/test_unit_string_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ def test_to_list(self, mock_string_array, mock_object, size, values):
# pylint: disable=R0801
def test_from_list(self, mock_string_array, mock_object, values):
"""Test the from_list method of the StringArray class."""
mock_string_array.from_list(values)
mock_object.FromVBSArray.return_value = len(values)
result = mock_string_array.from_list(values)

assert isinstance(result, int)
assert result == len(values)
mock_object.FromVBSArray.assert_called_once()

@pytest.mark.parametrize("invalid_values", INVALID_MOCK_WITH_NONE)
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": "0"
"patch": "1"
}