Skip to content

Commit

Permalink
Renaming the STL files for the UC2 configurator
Browse files Browse the repository at this point in the history
  • Loading branch information
beniroquai committed Jan 9, 2021
1 parent 0abd1c7 commit 4c63ce7
Show file tree
Hide file tree
Showing 88 changed files with 41 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CAD/RAW/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ Save as -> Pack 'n go -> save somewhere and copy the ```.ipt``` files in the [IP
### STL files

Export -> export as STL and hit options -> individual files.
Rename them with e.g. Bulkrenamer or so.

#### Renaming
On Windows:
```
python rename.py
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Diff not rendered.
35 changes: 35 additions & 0 deletions CAD/RAW/STL/convertname2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 9 14:55:03 2021
@author: diederichbenedict
"""
# rename the following pattern:
# *v3_XXX.stl -> *v3.stl
# or
# *_XXX.stl -> v3 (more generic!)


import os

delimiter = '_'
filetype = '.stl'
basefolder = 'C:\\Users\\diederichbenedict\\Dropbox\\Dokumente\\Promotion\\PROJECTS\\UC2-GIT\\CAD\\RAW\\STL\\'
basefolder = '/Users/bene/Dropbox/Dokumente/Promotion/PROJECTS/UC2-GIT/CAD/RAW/STL/'

import glob, os
os.chdir(basefolder)
for filename in glob.glob("*"+filetype):
filename_final = ''

filename_split = filename.split(delimiter)
for i in range(len(filename_split)-1):
if not filename_split[i] == 'v3':
filename_final += (filename_split[i] + delimiter)

filename_final += 'v3'+filetype

print(filename + " -> " + filename_final)

# rename
os.rename(filename,filename_final)

0 comments on commit 4c63ce7

Please sign in to comment.