x
This commit is contained in:
+25
-8
@@ -485,17 +485,24 @@ async def process_file_core(
|
||||
# 网格失败不影响整体流程,只记录日志
|
||||
logger.warning(f"网格生成或保存失败,不影响主流程: {mesh_err}")
|
||||
|
||||
# 3. 生成模具型腔(模拟数据)
|
||||
# 3. 生成模具型腔(使用真实的 MoldCavityGenerator)
|
||||
await storage_service.update_task_status(
|
||||
db_session, task_id, "processing", 40, "生成模具型腔(模拟)"
|
||||
db_session, task_id, "processing", 40, "生成模具型腔"
|
||||
)
|
||||
|
||||
cavity_data = {
|
||||
"cavity_count": 1,
|
||||
"cavity_dimensions": {"length": 100, "width": 80, "height": 50},
|
||||
"runner_system": "cold_runner",
|
||||
"gating_type": "edge_gate"
|
||||
}
|
||||
# 使用 MoldCavityGenerator 生成型腔数据
|
||||
cavity_mesh_data = None
|
||||
try:
|
||||
if shape:
|
||||
# 生成型腔和型芯
|
||||
cavity_result = mold_generator.generate_mold_cavities(shape)
|
||||
|
||||
# 生成详细的型腔JSON数据(包含网格)
|
||||
cavity_mesh_data = mold_generator.generate_detailed_cavity_json(cavity_result)
|
||||
logger.info(f"型腔网格数据生成完成: {cavity_mesh_data.get('mold_cavities', {}).get('cavity', {}).get('vertex_count', 0)} 顶点")
|
||||
except Exception as cavity_err:
|
||||
logger.warning(f"型腔生成失败,使用简化数据: {cavity_err}")
|
||||
cavity_mesh_data = None
|
||||
|
||||
# 4. 生成详细JSON数据(使用计算值)
|
||||
await storage_service.update_task_status(
|
||||
@@ -676,6 +683,16 @@ async def process_file_core(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 合并型腔网格数据(如果有)
|
||||
if cavity_mesh_data and "mold_cavities" in cavity_mesh_data:
|
||||
if "cavity" in cavity_mesh_data["mold_cavities"]:
|
||||
detailed_cavity_json["mold_cavities"]["cavity"] = cavity_mesh_data["mold_cavities"]["cavity"]
|
||||
if "core" in cavity_mesh_data["mold_cavities"]:
|
||||
detailed_cavity_json["mold_cavities"]["core"] = cavity_mesh_data["mold_cavities"]["core"]
|
||||
if "parting_surface" in cavity_mesh_data["mold_cavities"]:
|
||||
detailed_cavity_json["mold_cavities"]["parting_surface"] = cavity_mesh_data["mold_cavities"]["parting_surface"]
|
||||
logger.info(f"型腔网格数据已合并: cavity {cavity_mesh_data['mold_cavities'].get('cavity', {}).get('vertex_count', 0)} 顶点")
|
||||
|
||||
# 5. 生成关键信息(模拟)
|
||||
cavity_key_info = detailed_cavity_json["mold_cavities"]["cavity_key_info"]
|
||||
|
||||
Reference in New Issue
Block a user