Skip to content

[FIX] VTK export appends .vtk#79

Open
sankalps0549 wants to merge 2 commits intomainfrom
vtk-export-bug
Open

[FIX] VTK export appends .vtk#79
sankalps0549 wants to merge 2 commits intomainfrom
vtk-export-bug

Conversation

@sankalps0549
Copy link
Copy Markdown
Collaborator

Cherry Picked commit from release branch to merge to main as well.

Description

PlotManager.export_to_vtk() was routing the export path through check_file_extension(), which treats the target like a single file and appends .vtk when the path does not already end with that extension. VTK export writes a directory of files (same behavior as in Synergy), so callers ended up with a folder named Something.vtk instead of Something, breaking scripts and macros that rely on the exact path they pass in.

This change validates the path as a folder-style export root: type-check the string, ensure parent directories exist (same idea as for file exports), and pass the path through to ExportToVTK without appending an extension. Logic is centralized in helper.py (check_folder_path / shared parent-dir helper) so plot_manager stays a thin wrapper.

Fixes: #77

Type of change

  • Bug fix (non-breaking change which fixes an issue)

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 added a note to CHANGELOG.md describing my changes
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Testing

  • python run.py test tests/core/test_helper.py — covers check_folder_path (return value unchanged, parent directories created when the path has a parent, no directories created for bare names when cwd is an empty temp dir, invalid types).
  • python run.py test tests/api/unit_tests/test_unit_plot_manager.pyExportToVTK / export_to_vtk parametrized cases including a folder name without a .vtk suffix so the COM wrapper is invoked with the exact path passed in.

sankalps0549 and others added 2 commits April 22, 2026 16:39
* Introducing check_folder_path helper function for vtk export

* Localise folder path message

* copilot review fixes

* Updating helper function name
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes VTK export path handling so PlotManager.export_to_vtk() treats the target as a folder export root (no .vtk suffix auto-appended), aligning behavior with Synergy and preventing path mismatches that break scripts/macros.

Changes:

  • Added prepare_folder_path() (and shared parent-dir creation helper) to validate folder-style export paths without modifying them.
  • Updated PlotManager.export_to_vtk() to use prepare_folder_path() instead of check_file_extension().
  • Added/updated unit tests, logging message enum, translations, and changelog entry for the fix.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/core/test_helper.py Adds tests for parent-dir creation and prepare_folder_path() behavior (including trailing separators and invalid types).
tests/api/unit_tests/test_unit_plot_manager.py Extends PlotManager unit tests to ensure ExportToVTK receives the exact folder path passed in (no suffix appended).
src/moldflow/plot_manager.py Switches VTK export path validation from file-extension logic to folder-path preparation.
src/moldflow/helper.py Introduces _create_required_parent_directories() and prepare_folder_path(); refactors check_file_extension() to reuse shared logic.
src/moldflow/common.py Adds a new LogMessage.CHECK_FOLDER_PATH entry for folder-path validation logging.
src/moldflow/locale/en-US/LC_MESSAGES/locale.en-US.po Adds translation string for “Checking folder path {folder_path}”.
src/moldflow/locale/de-DE/LC_MESSAGES/locale.de-DE.po Adds translation string for the new folder-path log message.
src/moldflow/locale/es-ES/LC_MESSAGES/locale.es-ES.po Adds translation string for the new folder-path log message.
src/moldflow/locale/fr-FR/LC_MESSAGES/locale.fr-FR.po Adds translation string for the new folder-path log message.
src/moldflow/locale/it-IT/LC_MESSAGES/locale.it-IT.po Adds translation string for the new folder-path log message.
src/moldflow/locale/ja-JP/LC_MESSAGES/locale.ja-JP.po Adds translation string for the new folder-path log message.
src/moldflow/locale/ko-KR/LC_MESSAGES/locale.ko-KR.po Adds translation string for the new folder-path log message.
src/moldflow/locale/pt-PT/LC_MESSAGES/locale.pt-PT.po Adds translation string for the new folder-path log message.
src/moldflow/locale/zh-CN/LC_MESSAGES/locale.zh-CN.po Adds translation string for the new folder-path log message.
src/moldflow/locale/zh-TW/LC_MESSAGES/locale.zh-TW.po Adds translation string for the new folder-path log message.
CHANGELOG.md Documents the VTK export folder-path fix under v27.0.1 and updates release links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sankalps0549 sankalps0549 marked this pull request as ready for review April 22, 2026 12:04
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] VTK export appends ".vtk" to folder path breaking macros

3 participants