From 29dbbaaa2a88db67df572aa94f8f6a577a497e0a Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 04:37:31 +1000 Subject: [PATCH 01/13] fix types and remove non-existing function --- src/moldflow/double_array.py | 4 ++-- src/moldflow/integer_array.py | 4 ++-- src/moldflow/string_array.py | 16 +++------------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/moldflow/double_array.py b/src/moldflow/double_array.py index e2d16c5..2975aa3 100644 --- a/src/moldflow/double_array.py +++ b/src/moldflow/double_array.py @@ -67,7 +67,7 @@ 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. @@ -80,7 +80,7 @@ def from_list(self, values: list[float]) -> None: 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: diff --git a/src/moldflow/integer_array.py b/src/moldflow/integer_array.py index f28221c..85a9ec5 100644 --- a/src/moldflow/integer_array.py +++ b/src/moldflow/integer_array.py @@ -67,7 +67,7 @@ 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. @@ -80,7 +80,7 @@ def from_list(self, values: list[int]) -> None: 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: diff --git a/src/moldflow/string_array.py b/src/moldflow/string_array.py index ca18c30..6d5ec40 100644 --- a/src/moldflow/string_array.py +++ b/src/moldflow/string_array.py @@ -7,7 +7,7 @@ """ from .logger import process_log -from .helper import check_type, _mf_array_to_list +from .helper import check_type from .com_proxy import safe_com, flag_com_method from .common import LogMessage @@ -54,17 +54,7 @@ def add_string(self, value: str) -> None: check_type(value, str) self.string_array.AddString(value) - 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. @@ -77,7 +67,7 @@ def from_list(self, values: list[str]) -> None: 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: From efef775a348519a3e5783ff7b9cbd3fa0fe40f76 Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 04:44:52 +1000 Subject: [PATCH 02/13] fix tests --- .../api/unit_tests/test_unit_string_array.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/api/unit_tests/test_unit_string_array.py b/tests/api/unit_tests/test_unit_string_array.py index 05fe8de..a46191a 100644 --- a/tests/api/unit_tests/test_unit_string_array.py +++ b/tests/api/unit_tests/test_unit_string_array.py @@ -49,25 +49,6 @@ def test_size(self, mock_string_array, mock_object, size): mock_object.Size = size assert mock_string_array.size == size - @pytest.mark.parametrize( - "size, values", - [(3, ["hello", "world", "test"]), (2, ["foo", "bar"]), (1, ["single"]), (0, [])], - ) - # pylint: disable=R0801 - def test_to_list(self, mock_string_array, mock_object, size, values): - """Test the to_list method of the StringArray class.""" - mock_object.Size = size - mock_object.Val.side_effect = lambda i: values[i] if i < len(values) else "" - - result = mock_string_array.to_list() - - assert result == values - assert len(result) == size - if size > 0: - assert mock_object.Val.call_count == size - for i in range(size): - mock_object.Val.assert_any_call(i) - @pytest.mark.parametrize( "values", [ From dff41169f7e4057e9d9ed845ced1b24019b7cd27 Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 18:59:35 +1000 Subject: [PATCH 03/13] fix color band range --- src/moldflow/constants.py | 2 +- src/moldflow/plot.py | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/moldflow/constants.py b/src/moldflow/constants.py index c785166..848e5b4 100644 --- a/src/moldflow/constants.py +++ b/src/moldflow/constants.py @@ -7,7 +7,7 @@ import os # Constants for color bands -COLOR_BAND_RANGE = tuple(list(range(2, 65)) + [256]) +COLOR_BAND_RANGE = tuple(list(range(0, 265))) # Localization constants DEFAULT_THREE_LETTER_CODE = "enu" diff --git a/src/moldflow/plot.py b/src/moldflow/plot.py index 1baeb13..0cdbf24 100644 --- a/src/moldflow/plot.py +++ b/src/moldflow/plot.py @@ -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") @@ -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. From 7c9101544838b333c7689964dc444e64096f2be1 Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 19:06:23 +1000 Subject: [PATCH 04/13] increment patch number --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 38caf99..9e2172b 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { "major": "26", "minor": "0", - "patch": "0" + "patch": "1" } From 9337523fa086db4b8404d1f5d379dcfdd4356f96 Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 19:13:06 +1000 Subject: [PATCH 05/13] fix range and tests --- src/moldflow/constants.py | 2 +- tests/api/unit_tests/test_unit_plot.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/moldflow/constants.py b/src/moldflow/constants.py index 848e5b4..4851f3a 100644 --- a/src/moldflow/constants.py +++ b/src/moldflow/constants.py @@ -7,7 +7,7 @@ import os # Constants for color bands -COLOR_BAND_RANGE = tuple(list(range(0, 265))) +COLOR_BAND_RANGE = tuple(range(1, 257)) # Localization constants DEFAULT_THREE_LETTER_CODE = "enu" diff --git a/tests/api/unit_tests/test_unit_plot.py b/tests/api/unit_tests/test_unit_plot.py index 81870c1..1ffe6c1 100644 --- a/tests/api/unit_tests/test_unit_plot.py +++ b/tests/api/unit_tests/test_unit_plot.py @@ -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 From 69aee905b5c682f492c6031e44a6c63c88c4911d Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 20:37:01 +1000 Subject: [PATCH 06/13] changelog --- CHANGELOG.md | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8cb0c1..724cf3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -29,7 +25,28 @@ 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 clases +- 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 @@ -37,5 +54,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Windows support - 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 From 00b7181b2c07d40b97d87767ac01bb4d9fc6b7ef Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 20:37:14 +1000 Subject: [PATCH 07/13] bring back function --- src/moldflow/string_array.py | 9 +++++++++ .../api/unit_tests/test_unit_string_array.py | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/moldflow/string_array.py b/src/moldflow/string_array.py index 6d5ec40..15f1b73 100644 --- a/src/moldflow/string_array.py +++ b/src/moldflow/string_array.py @@ -54,6 +54,15 @@ def add_string(self, value: str) -> None: check_type(value, str) self.string_array.AddString(value) + 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]) -> int: """ Convert a list of strings to a string array. diff --git a/tests/api/unit_tests/test_unit_string_array.py b/tests/api/unit_tests/test_unit_string_array.py index a46191a..05fe8de 100644 --- a/tests/api/unit_tests/test_unit_string_array.py +++ b/tests/api/unit_tests/test_unit_string_array.py @@ -49,6 +49,25 @@ def test_size(self, mock_string_array, mock_object, size): mock_object.Size = size assert mock_string_array.size == size + @pytest.mark.parametrize( + "size, values", + [(3, ["hello", "world", "test"]), (2, ["foo", "bar"]), (1, ["single"]), (0, [])], + ) + # pylint: disable=R0801 + def test_to_list(self, mock_string_array, mock_object, size, values): + """Test the to_list method of the StringArray class.""" + mock_object.Size = size + mock_object.Val.side_effect = lambda i: values[i] if i < len(values) else "" + + result = mock_string_array.to_list() + + assert result == values + assert len(result) == size + if size > 0: + assert mock_object.Val.call_count == size + for i in range(size): + mock_object.Val.assert_any_call(i) + @pytest.mark.parametrize( "values", [ From 3591764d3f0438ef9c5faf8cca24de63240de81f Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 20:56:32 +1000 Subject: [PATCH 08/13] more tests --- tests/api/unit_tests/test_unit_double_array.py | 6 +++++- tests/api/unit_tests/test_unit_integer_array.py | 5 ++++- tests/api/unit_tests/test_unit_string_array.py | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/api/unit_tests/test_unit_double_array.py b/tests/api/unit_tests/test_unit_double_array.py index d19a2e6..37d913b 100644 --- a/tests/api/unit_tests/test_unit_double_array.py +++ b/tests/api/unit_tests/test_unit_double_array.py @@ -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) diff --git a/tests/api/unit_tests/test_unit_integer_array.py b/tests/api/unit_tests/test_unit_integer_array.py index a6b838a..05a8aa8 100644 --- a/tests/api/unit_tests/test_unit_integer_array.py +++ b/tests/api/unit_tests/test_unit_integer_array.py @@ -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) diff --git a/tests/api/unit_tests/test_unit_string_array.py b/tests/api/unit_tests/test_unit_string_array.py index 05fe8de..fca95fa 100644 --- a/tests/api/unit_tests/test_unit_string_array.py +++ b/tests/api/unit_tests/test_unit_string_array.py @@ -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) From cf5c55eb8304134b24c860cc94a590ca8505db54 Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 21:01:03 +1000 Subject: [PATCH 09/13] missing include --- src/moldflow/string_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/moldflow/string_array.py b/src/moldflow/string_array.py index 15f1b73..3f26a51 100644 --- a/src/moldflow/string_array.py +++ b/src/moldflow/string_array.py @@ -7,7 +7,7 @@ """ from .logger import process_log -from .helper import check_type +from .helper import check_type, _mf_array_to_list from .com_proxy import safe_com, flag_com_method from .common import LogMessage From 9ede9f487ea145a32852d08d78bb705adaf9716e Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 21:44:42 +1000 Subject: [PATCH 10/13] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 724cf3b..83f48da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - N/A ### Fixed -- Fix return types for `from_list` functions in data clases +- Fix return types for `from_list` functions in data classes - Fix color band range options to 1 to 256 ### Security From 7b6bfb63a9875629bded2fd4db9159fca6cb6c96 Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 22:15:11 +1000 Subject: [PATCH 11/13] better docstrings --- src/moldflow/double_array.py | 3 +++ src/moldflow/integer_array.py | 3 +++ src/moldflow/string_array.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/moldflow/double_array.py b/src/moldflow/double_array.py index 2975aa3..ae1b933 100644 --- a/src/moldflow/double_array.py +++ b/src/moldflow/double_array.py @@ -73,6 +73,9 @@ def from_list(self, values: list[float]) -> int: 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") diff --git a/src/moldflow/integer_array.py b/src/moldflow/integer_array.py index 85a9ec5..ab4c4a4 100644 --- a/src/moldflow/integer_array.py +++ b/src/moldflow/integer_array.py @@ -73,6 +73,9 @@ def from_list(self, values: list[int]) -> int: 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") diff --git a/src/moldflow/string_array.py b/src/moldflow/string_array.py index 3f26a51..7604cf8 100644 --- a/src/moldflow/string_array.py +++ b/src/moldflow/string_array.py @@ -69,6 +69,9 @@ def from_list(self, values: list[str]) -> int: 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)) From 130017141e1b7adb514779a95191ff537bbbf30e Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 22:16:19 +1000 Subject: [PATCH 12/13] correctness --- CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83f48da..fcf9136 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,9 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [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.1...HEAD From de23b31b4686939ce36198bcf27ca0d5b6b86955 Mon Sep 17 00:00:00 2001 From: Osi Njoku Date: Fri, 12 Sep 2025 23:00:21 +1000 Subject: [PATCH 13/13] ws --- src/moldflow/double_array.py | 2 +- src/moldflow/string_array.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/moldflow/double_array.py b/src/moldflow/double_array.py index ae1b933..be3cd28 100644 --- a/src/moldflow/double_array.py +++ b/src/moldflow/double_array.py @@ -73,7 +73,7 @@ def from_list(self, values: list[float]) -> int: Args: values (list[float]): The list of floats to convert. - + Returns: int: The number of elements added to the array. """ diff --git a/src/moldflow/string_array.py b/src/moldflow/string_array.py index 7604cf8..dcb953d 100644 --- a/src/moldflow/string_array.py +++ b/src/moldflow/string_array.py @@ -69,7 +69,7 @@ def from_list(self, values: list[str]) -> int: Args: values (list[str]): The list of strings to convert. - + Returns: int: The number of elements added to the array. """