These changes were made just to suit my personal preferences, but I thought I'd share them anyway:
64a65,67
> def sketch_path(self):
> return Path('/'.join(f'{self.folder}'.rsplit(' ', 1)))
>
185c188
< output_path = ctx.folder / f'{sanitize_filename(sketch.name)}.dxf'
---
> output_path = ctx.sketch_path() / f'{sanitize_filename(sketch.name)}.dxf'
214,215c217,219
< name = f'{sanitized}_v{file.versionNumber}.{format.value}'
< return ctx.folder / name
---
> version = f'v{file.versionNumber}'
> name = f'{sanitized} {version}.{format.value}'
> return ctx.folder / sanitized / version / name
The return Path('/'.join(f'{self.folder}'.rsplit(' ', 1))) line is a little cryptic, but it just looks for the last space in the path and changes it to a / which results in the version number becoming the name of a new sub-folder. For example, the path My Project/My File v5/ becomes My Project/My File/v5/ instead.
All this results in several changes:
Each file gets its own master folder with its base name.
Within this master folder are sub-folders for each version, eg. v1, v2, v3, etc.
Sketch dxf files are placed directly in the version sub-folder they're associated with.
Exported files have a space instead of an underscore before their version number, which is more in line with Fusion 360's default file naming scheme.
I'm not suggesting or advocating that you implement these changes or not. I just prefer this structure, so I suspect that some other folks might as well.
Thanks for writing this very useful export script! It's already saved me hours of manual exporting.
These changes were made just to suit my personal preferences, but I thought I'd share them anyway:
The
return Path('/'.join(f'{self.folder}'.rsplit(' ', 1)))
line is a little cryptic, but it just looks for the last space in the path and changes it to a/
which results in the version number becoming the name of a new sub-folder. For example, the pathMy Project/My File v5/
becomesMy Project/My File/v5/
instead.All this results in several changes:
dxf
files are placed directly in the version sub-folder they're associated with.I'm not suggesting or advocating that you implement these changes or not. I just prefer this structure, so I suspect that some other folks might as well.
Thanks for writing this very useful export script! It's already saved me hours of manual exporting.