Closes #7765: Default IFC file path to relative and auto-convert on blend save#7795
Open
theoryshaw wants to merge 3 commits intov0.8.0from
Open
Closes #7765: Default IFC file path to relative and auto-convert on blend save#7795theoryshaw wants to merge 3 commits intov0.8.0from
theoryshaw wants to merge 3 commits intov0.8.0from
Conversation
…lend save Previously, saving an IFC file stored an absolute path in `bim_props.ifc_file` by default. Users had to manually check "Use Relative Path" each time. This made projects less portable — moving or sharing a project folder broke the stored path, requiring manual relinking. What changed: - `use_relative_project_path` now defaults to `True` in `BIMProjectProperties`, `LoadProject`, `ExportIFC`, and `SelectIfcFile`. Relative paths are opt-out rather than opt-in. - Added a `save_post` handler in `handler.py` (registered in `__init__.py`) that fires whenever the user saves the `.blend` file. If `use_relative_project_path` is enabled and the stored `ifc_file` path is still absolute, it converts it to a path relative to the blend file's directory. `IfcStore.path` is kept absolute internally so file loading continues to work correctly. Generated with the assistance of an AI coding tool.
When use_relative_path is enabled, Path.relative_to() raises ValueError if the IFC file is on a different path than the .blend file. Fall back to the absolute path in that case. Generated with the assistance of an AI coding tool.
bc428ab to
6c231f0
Compare
so IFC files always open in a clean session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, saving an IFC file stored an absolute path in
bim_props.ifc_fileby default. Users had to manually check "Use Relative Path" each time. This made projects less portable — moving or sharing a project folder broke the stored path, requiring manual relinking.What changed:
use_relative_project_pathnow defaults toTrueinBIMProjectProperties,LoadProject,ExportIFC, andSelectIfcFile. Relative paths are opt-out rather than opt-in.Added a
save_posthandler inhandler.py(registered in__init__.py) that fires whenever the user saves the.blendfile. Ifuse_relative_project_pathis enabled and the storedifc_filepath is still absolute, it converts it to a path relative to the blend file's directory.IfcStore.pathis kept absolute internally so file loading continues to work correctly.Generated with the assistance of an AI coding tool.