aconz2 / Fusion360Exporter

Export (and sync) all of your Fusion360 projects and documents in various formats
The Unlicense
201 stars 17 forks source link

Output folder structure and file naming changes #21

Open loglow opened 1 month ago

loglow commented 1 month ago

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:

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.