init
This commit is contained in:
+52
-12
@@ -212,11 +212,51 @@ async def process_file_core(
|
||||
"gating_type": "edge_gate"
|
||||
}
|
||||
|
||||
# 3. 生成详细JSON数据(模拟)
|
||||
# 3. 生成详细JSON数据(使用计算值)
|
||||
await storage_service.update_task_status(
|
||||
db_session, task_id, "processing", 60, "生成型腔详细数据(模拟)"
|
||||
db_session, task_id, "processing", 60, "生成型腔详细数据"
|
||||
)
|
||||
|
||||
# 使用模具生成器计算各项参数
|
||||
volume_mm3 = geometry_data.get("volume", 0)
|
||||
surface_area_mm2 = geometry_data.get("surface_area", 0)
|
||||
bbox = geometry_data.get("bounding_box", {})
|
||||
bbox_dims = bbox.get("dimensions", [0, 0, 0])
|
||||
|
||||
# 计算产品重量(ABS密度:1.05 g/cm³)
|
||||
volume_cm3 = volume_mm3 / 1000
|
||||
product_weight_g = volume_cm3 * 1.05
|
||||
|
||||
# 计算投影面积(取X、Y方向)
|
||||
if len(bbox_dims) >= 2:
|
||||
projected_area_cm2 = (bbox_dims[0] * bbox_dims[1]) / 100
|
||||
else:
|
||||
projected_area_cm2 = 0
|
||||
|
||||
# 计算夹紧力(投影面积 × 注塑压力600 kg/cm²,转换为吨)
|
||||
clamping_force_ton = int(projected_area_cm2 * 600 / 1000)
|
||||
|
||||
# 计算壁厚范围
|
||||
if surface_area_mm2 > 0 and volume_mm3 > 0:
|
||||
avg_thickness_mm = (volume_mm3 / surface_area_mm2) * 0.6
|
||||
wall_thickness_min = avg_thickness_mm * 0.7
|
||||
wall_thickness_max = avg_thickness_mm * 1.3
|
||||
else:
|
||||
avg_thickness_mm = 2.5
|
||||
wall_thickness_min = 2.0
|
||||
wall_thickness_max = 3.0
|
||||
|
||||
# 计算复杂度评分
|
||||
if surface_area_mm2 > 0 and volume_mm3 > 0:
|
||||
complexity_score = min((avg_thickness_mm / 5.0), 1.0)
|
||||
else:
|
||||
complexity_score = 0.5
|
||||
|
||||
# 计算模具尺寸(基于产品尺寸 + 模具边距)
|
||||
mold_length = max(bbox_dims[0] if len(bbox_dims) > 0 else 120, 120) + 40
|
||||
mold_width = max(bbox_dims[1] if len(bbox_dims) > 1 else 100, 100) + 40
|
||||
mold_height = max(bbox_dims[2] if len(bbox_dims) > 2 else 60, 60) + 50
|
||||
|
||||
detailed_cavity_json = {
|
||||
"metadata": {
|
||||
"file_name": Path(file_path).name,
|
||||
@@ -225,26 +265,26 @@ async def process_file_core(
|
||||
"draft_angle": 2.0
|
||||
},
|
||||
"product_analysis": {
|
||||
"volume": geometry_data["volume"],
|
||||
"surface_area": geometry_data["surface_area"],
|
||||
"bounding_box": geometry_data["bounding_box"]
|
||||
"volume": volume_mm3,
|
||||
"surface_area": surface_area_mm2,
|
||||
"bounding_box": bbox
|
||||
},
|
||||
"manufacturing_info": {
|
||||
"recommended_material": "ABS",
|
||||
"estimated_clamping_force": "150 吨",
|
||||
"estimated_clamping_force": f"{clamping_force_ton} 吨",
|
||||
"estimated_mold_size": {
|
||||
"length": 120,
|
||||
"width": 100,
|
||||
"height": 60
|
||||
"length": int(mold_length),
|
||||
"width": int(mold_width),
|
||||
"height": int(mold_height)
|
||||
}
|
||||
},
|
||||
"mold_cavities": {
|
||||
"cavity_count": 1,
|
||||
"cavity_key_info": {
|
||||
"geometric_characteristics": {
|
||||
"product_weight": "1.2 g",
|
||||
"wall_thickness_range": "1.5-3.0 mm",
|
||||
"complexity_score": 0.7
|
||||
"product_weight": f"{product_weight_g:.2f} g",
|
||||
"wall_thickness_range": f"{wall_thickness_min:.2f} - {wall_thickness_max:.2f} mm",
|
||||
"complexity_score": round(complexity_score, 2)
|
||||
},
|
||||
"quality_considerations": {
|
||||
"potential_weld_lines": "center",
|
||||
|
||||
Reference in New Issue
Block a user