From c9867a4ddb8361923bb4ed224f02c5fd66129eb2 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 5 Dec 2025 11:23:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/factory_sliceing_v2/utils/funcs.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/script/factory_sliceing_v2/utils/funcs.py b/script/factory_sliceing_v2/utils/funcs.py index 006178d..15ca2aa 100644 --- a/script/factory_sliceing_v2/utils/funcs.py +++ b/script/factory_sliceing_v2/utils/funcs.py @@ -216,10 +216,18 @@ def downloadJsonAndJpgFileAndMoveToCorrectDir(versionId, currentDir): jsonSubDir = os.path.join(dirNewName, 'json') if not os.path.exists(jsonSubDir): os.makedirs(jsonSubDir) + dataSubDir = os.path.join(dirNewName, 'data') + if not os.path.exists(dataSubDir): + os.makedirs(dataSubDir) # 将数据移动过来 shutil.move(localFilePath, os.path.join(jsonSubDir, '3DPrintLayout.json')) shutil.move(localJpgFilePath, os.path.join(jsonSubDir, f'{versionId}.jpg')) + #如果是大机台,将 json 文件复制到 data 目录下 + if str(machineInfo["machine_type"]) != '1': + shutil.copy(os.path.join(jsonSubDir, '3DPrintLayout.json'), os.path.join(dataSubDir, '3DPrintLayout.json')) + + # 检测文件是否移动成功 if not os.path.exists(os.path.join(jsonSubDir, '3DPrintLayout.json')): log(f"JSON文件不存在, versionId={versionId}") @@ -227,6 +235,9 @@ def downloadJsonAndJpgFileAndMoveToCorrectDir(versionId, currentDir): if not os.path.exists(os.path.join(jsonSubDir, f'{versionId}.jpg')): log(f"JPG文件不存在, versionId={versionId}") return False, False + if not os.path.exists(os.path.join(dataSubDir, '3DPrintLayout.json')): + log(f"JSON文件不存在, dataSubDir={dataSubDir}") + return False, False log(f"文件移动成功, versionId={versionId}") # 返回目录路径 return dirNewName, machineInfo