diff --git a/.gitignore b/.gitignore index 216d367..b52d01e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea/ -.__pycache__/ +__pycache__ +.vscode +.mypy_cache diff --git a/Project-Archiver.zip b/Project-Archiver.zip new file mode 100644 index 0000000..d991cb1 Binary files /dev/null and b/Project-Archiver.zip differ diff --git a/Project-Archiver/commands/ExportCommand.py b/Project-Archiver/commands/ExportCommand.py index 2a7a440..f7ce536 100644 --- a/Project-Archiver/commands/ExportCommand.py +++ b/Project-Archiver/commands/ExportCommand.py @@ -6,6 +6,8 @@ # This file is a component of Project-Archiver. ~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import os +import unicodedata +import re import adsk.core import adsk.fusion @@ -47,8 +49,14 @@ def export_folder(root_folder, output_folder, file_types, write_version, name_op except AttributeError as e: ao.ui.messageBox(str(e)) - break - + + except: + pass + + try: + ao.app.activeDocument.close(False) + except: + pass def open_doc(data_file): app = adsk.core.Application.get() @@ -130,10 +138,26 @@ def get_name(write_version, option): else: raise ValueError('Something strange happened') + + output_name = slugify(output_name) return output_name +def slugify(name): + """ + Taken from https://github.com/django/django/blob/master/django/utils/text.py + convert spaces or repeated + dashes to single dashes. Remove characters that aren't alphanumerics, + underscores, or hyphens. Convert to lowercase. Also strip leading and + trailing whitespace, dashes, and underscores. + """ + name = str(name) + name = unicodedata.normalize('NFKD', name).encode('ascii', 'ignore').decode('ascii') + name = re.sub(r'[^\w\s-]', '', name) + return re.sub(r'[-\s]+', '-', name).strip('-_') + + def update_name_inputs(command_inputs, selection): command_inputs.itemById('write_version').isVisible = False diff --git a/Project_Archiver.egg-info/PKG-INFO b/Project_Archiver.egg-info/PKG-INFO deleted file mode 100644 index 2406751..0000000 --- a/Project_Archiver.egg-info/PKG-INFO +++ /dev/null @@ -1,89 +0,0 @@ -Metadata-Version: 1.0 -Name: Project-Archiver -Version: 2.0.1 -Summary: A Project Archiving Utility for Fusion 360 -Home-page: https://github.com/tapnair/Project-Archiver -Author: Patrick Rainsberry -Author-email: patrick.rainsberry@autodesk.com -License: MIT -Description: # Project-Archiver - The archiver script will open all Fusion 360 3D data in a project and export it as STEP to a local location of your choosing. - - [How to install](#How-to-install) - [How to use](#How-to-use) - [For Developers](#For-Developers) - - ---- - - ### How to install - 1. Click the latest link and download the [latest distribution](https://github.com/tapnair/Project-Archiver/blob/master/dist/Project-Archiver.zip) - - *Note you should download from the link above. The regular git downloads won't get the apper submodule* - - 2. Unzip the archive to a permanent location on your computer - - ### Fusion 360 - - 1. Launch Fusion 360. - 2. On the main toolbar click the **Scripts and Addins** button in the **Addins** Pane - - ![](Project-Archiver/resources/scripts-addins_button.png) - - 3. Select the **Addins tab** and click the "add" - - ![](Project-Archiver/resources/scripts-addins.png) - - 4. Browse to the unzipped folder - 5. Select the addin in the list and click run. - 6. Dismiss the Addins dialog. - 7. Click the ProjectArchiver Tab and you should see **Archive** Panel and command. - - ![](Project-Archiver/resources/button.png) - - ---- - - ### How to use - - In the data panel navigate to the project you want to archive. - The add-in will export all Fusion 360 files in the active project. - - ![](Project-Archiver/resources/dialog.png) - - It then allows you to enter a path. Type in a path into the **Output Path** field. - * For OSX this might be: **/Users/*username*/Desktop/Test/** - * For Windows this might be something like **C:\Test** - - Under **Export Types** select the different files types you want to export. You can select multiple types. - - File Name Options allow you to specify the naming convention for output files. - If you select 'Document Name' you can choose whether or not to append the version number to the file name. - - Click **OK**. - - Fusion will open and export each 3D design. Depending on the size of design and bandwidth this can take some time. - Fusion 360 will be busy for the duration of the script running, so it would be advisable to run this on a dedicated machine that you can leav to run for some time. - - ### For Developers - Clone the repo - - Update the apper submodule by browsing to the 'Project-Archiver' sub directory in the unzipped directory and executing: - - git submodule add https://github.com/tapnair/apper - - ## License - Samples are licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details. - - ## Written by - - Written by [Patrick Rainsberry](https://twitter.com/prrainsberry)
(Autodesk Fusion 360 Product Manager) - - See more useful [Fusion 360 Utilities](https://tapnair.github.io/index.html) - - - Analytics - [![Analytics](https://ga-beacon.appspot.com/UA-41076924-3/project-archiver)](https://github.com/igrigorik/ga-beacon) - - - - -Platform: UNKNOWN diff --git a/Project_Archiver.egg-info/SOURCES.txt b/Project_Archiver.egg-info/SOURCES.txt deleted file mode 100644 index d8dae15..0000000 --- a/Project_Archiver.egg-info/SOURCES.txt +++ /dev/null @@ -1,41 +0,0 @@ -README.md -setup.py -Project-Archiver/Project-Archiver.manifest -Project-Archiver/Project-Archiver.py -Project-Archiver/config.py -Project-Archiver/startup.py -Project-Archiver/apper/apper/AboutCommand.py -Project-Archiver/apper/apper/Fusion360AppEvents.py -Project-Archiver/apper/apper/Fusion360CommandBase.py -Project-Archiver/apper/apper/Fusion360DebugUtilities.py -Project-Archiver/apper/apper/Fusion360Utilities.py -Project-Archiver/apper/apper/FusionApp.py -Project-Archiver/apper/apper/PaletteCommandBase.py -Project-Archiver/apper/apper/__init__.py -Project-Archiver/apper/apper/__version__.py -Project-Archiver/commands/AssemblyDelete.py -Project-Archiver/commands/CloseAllCommand.py -Project-Archiver/commands/ExportCommand.py -Project-Archiver/commands/resources/command_icons/16x16-dark.png -Project-Archiver/commands/resources/command_icons/16x16-disabled.png -Project-Archiver/commands/resources/command_icons/16x16.png -Project-Archiver/commands/resources/command_icons/32x32-dark.png -Project-Archiver/commands/resources/command_icons/32x32-disabled.png -Project-Archiver/commands/resources/command_icons/32x32.png -Project-Archiver/commands/resources/command_icons/64x64-dark.png -Project-Archiver/commands/resources/command_icons/64x64-disabled.png -Project-Archiver/commands/resources/command_icons/64x64.png -Project-Archiver/resources/archiver-addin.png -Project-Archiver/resources/button.png -Project-Archiver/resources/dialog.png -Project-Archiver/resources/download.png -Project-Archiver/resources/osx-result.png -Project-Archiver/resources/pump_case_drawing.png -Project-Archiver/resources/scripts-addins.png -Project-Archiver/resources/scripts-addins_button.png -Project-Archiver/resources/unzipped.png -Project-Archiver/resources/windows-result.png -Project_Archiver.egg-info/PKG-INFO -Project_Archiver.egg-info/SOURCES.txt -Project_Archiver.egg-info/dependency_links.txt -Project_Archiver.egg-info/top_level.txt \ No newline at end of file diff --git a/Project_Archiver.egg-info/dependency_links.txt b/Project_Archiver.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/Project_Archiver.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Project_Archiver.egg-info/top_level.txt b/Project_Archiver.egg-info/top_level.txt deleted file mode 100644 index 321d939..0000000 --- a/Project_Archiver.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -Project-Archiver diff --git a/README.md b/README.md index 48db375..c8448f0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,23 @@ # Project-Archiver +Forked since changes to the original project not being made and it being unusable otherwise! Is way faster and more reliable now : ) + +Main aim is to export massive projects without supervision + +Implemented: +- closing files after export +- File name cleaning +- increased robustness a bit (had folder name errors) + +TODO: +- some way of logging errors without GUI interrupts (can probably use a normal log file) +- only export un-exported files in a project, rather than going through all of them again + + + + + + + The archiver script will open all Fusion 360 3D data in a project and export it as STEP to a local location of your choosing. [How to install](#How-to-install) @@ -8,7 +27,7 @@ The archiver script will open all Fusion 360 3D data in a project and export it ---- ### How to install -1. Click the latest link and download the [latest distribution](https://github.com/tapnair/Project-Archiver/blob/master/dist/Project-Archiver.zip) +1. Click the latest link and download the [latest distribution](https://github.com/o-gent/Project-Archiver/blob/master/Project-Archiver.zip) *Note you should download from the link above. The regular git downloads won't get the apper submodule* @@ -58,10 +77,10 @@ Fusion 360 will be busy for the duration of the script running, so it would be a ### For Developers Clone the repo -Update the apper submodule by browsing to the 'Project-Archiver' sub directory in the unzipped directory and executing: +``` +git submodule update --init +``` - git submodule add https://github.com/tapnair/apper - ## License Samples are licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details. diff --git a/dist/Project-Archiver.zip b/dist/Project-Archiver.zip deleted file mode 100644 index 958f444..0000000 Binary files a/dist/Project-Archiver.zip and /dev/null differ