有构建板,支持多模型构建,但生成支撑的切片还有bug
This commit is contained in:
36
tmp/patch_routes.py
Normal file
36
tmp/patch_routes.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import re
|
||||
|
||||
with open('app/routes.py', 'r', encoding='utf-8') as f:
|
||||
text = f.read()
|
||||
|
||||
old_str = """ print_file = PrintFile(
|
||||
filename=unique_filename,
|
||||
original_filename=f"{combined_name}.stl",
|
||||
file_type='stl',
|
||||
user_id=current_user.id,
|
||||
status='waiting'
|
||||
)
|
||||
db.session.add(print_file)
|
||||
db.session.commit()
|
||||
|
||||
slice_stl_task(print_file.id, merged_filepath, quality)"""
|
||||
|
||||
new_str = """ print_file = PrintFile(
|
||||
filename=unique_filename,
|
||||
original_filename=f"{combined_name}.stl",
|
||||
file_type='stl',
|
||||
user_id=current_user.id,
|
||||
status='merging'
|
||||
)
|
||||
db.session.add(print_file)
|
||||
db.session.commit()
|
||||
|
||||
from .tasks import merge_and_slice_task
|
||||
merge_and_slice_task(print_file.id, inputs, merged_filepath, quality)"""
|
||||
|
||||
if old_str in text:
|
||||
with open('app/routes.py', 'w', encoding='utf-8') as f:
|
||||
f.write(text.replace(old_str, new_str))
|
||||
print("Patched successfully")
|
||||
else:
|
||||
print("Old string not found")
|
||||
Reference in New Issue
Block a user