Skip to content

Commit fd454d0

Browse files
author
Antonia Huber
committed
Added possibility to give a filepath to stl-files
1 parent 8244f88 commit fd454d0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wakis/geometry.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def extract_materials_from_stp(stp_file):
6969

7070
return stl_materials
7171

72-
def extract_solids_from_stp(stp_file):
72+
def extract_solids_from_stp(stp_file, path=''):
73+
if path and not path.endswith('/'):
74+
path += '/'
7375
solids, materials = extract_names_from_stp(stp_file)
7476
stl_solids = {}
7577
for i in range(len(list(solids.keys()))):
@@ -84,7 +86,7 @@ def extract_solids_from_stp(stp_file):
8486
solid_re = re.sub(r'[^a-zA-Z0-9_-]', '-', solid)
8587
mat_re = re.sub(r'[^a-zA-Z0-9_-]', '-', mat)
8688
name = f'{str(i).zfill(3)}_{solid_re}_{mat_re}'
87-
stl_solids[f'{str(i).zfill(3)}_{solid_re}'] = name + '.stl'
89+
stl_solids[f'{str(i).zfill(3)}_{solid_re}'] = path + name + '.stl'
8890

8991
return stl_solids
9092

0 commit comments

Comments
 (0)