重构路由
This commit is contained in:
@@ -461,7 +461,7 @@ class AluminumFoamMoldGenerator:
|
||||
|
||||
try:
|
||||
parting_surface = BRepBuilderAPI_MakeFace(parting_plane).Face()
|
||||
except:
|
||||
except Exception:
|
||||
# 回退到默认平面
|
||||
parting_plane = gp_Pln(gp_Pnt(0, 0, center[2]), gp_Dir(0, 0, 1))
|
||||
parting_surface = BRepBuilderAPI_MakeFace(parting_plane).Face()
|
||||
@@ -488,7 +488,7 @@ class AluminumFoamMoldGenerator:
|
||||
"direction": [1, 0, 0],
|
||||
"reason": "产品扁平,需要垂直分型"
|
||||
})
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return {
|
||||
@@ -585,7 +585,7 @@ class AluminumFoamMoldGenerator:
|
||||
param = first_param + i * step
|
||||
point = curve.Value(param)
|
||||
edges.append([point.X(), point.Y(), point.Z()])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
explorer.Next()
|
||||
@@ -615,8 +615,9 @@ class AluminumFoamMoldGenerator:
|
||||
[xmin, ymax, center_z],
|
||||
[xmin, ymin, center_z]
|
||||
]
|
||||
except:
|
||||
return [[0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0], [0, 0, 0]]
|
||||
except Exception:
|
||||
logger.warning("分型线简化计算失败,返回空列表")
|
||||
return []
|
||||
|
||||
def _smooth_parting_line(self, parting_line: List[List[float]]) -> List[List[float]]:
|
||||
"""
|
||||
@@ -678,7 +679,7 @@ class AluminumFoamMoldGenerator:
|
||||
|
||||
return 50.0
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
return 50.0
|
||||
|
||||
def _apply_shrinkage_compensation(self, shape: Any) -> Any:
|
||||
@@ -850,7 +851,7 @@ class AluminumFoamMoldGenerator:
|
||||
"origin": [0, 0, 0],
|
||||
"bounds": {"u_range": [-200, 200], "v_range": [-200, 200]}
|
||||
}
|
||||
except:
|
||||
except Exception:
|
||||
return {
|
||||
"type": "plane",
|
||||
"normal": [0, 0, 1],
|
||||
@@ -870,7 +871,7 @@ class AluminumFoamMoldGenerator:
|
||||
|
||||
try:
|
||||
parting_surface = BRepBuilderAPI_MakeFace(parting_plane).Face()
|
||||
except:
|
||||
except Exception:
|
||||
parting_plane = gp_Pln(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1))
|
||||
parting_surface = BRepBuilderAPI_MakeFace(parting_plane).Face()
|
||||
|
||||
@@ -930,7 +931,7 @@ class AluminumFoamMoldGenerator:
|
||||
avg_thickness = (volume / surface_area) * 0.6
|
||||
return f"{avg_thickness * 0.7:.2f} - {avg_thickness * 1.3:.2f} mm"
|
||||
|
||||
return "10.0 - 30.0 mm (铝泡沫典型)"
|
||||
return "无法估算 (缺少几何数据)"
|
||||
|
||||
def _calculate_complexity_score(self, analysis: Dict) -> float:
|
||||
"""计算复杂度评分"""
|
||||
@@ -942,7 +943,7 @@ class AluminumFoamMoldGenerator:
|
||||
complexity = min(thickness_ratio / 5.0, 10.0)
|
||||
return round(complexity, 1)
|
||||
|
||||
return 5.0
|
||||
return 0.0
|
||||
|
||||
def _estimate_cycle_time(self, analysis: Dict) -> str:
|
||||
"""估算成型周期"""
|
||||
@@ -963,7 +964,7 @@ class AluminumFoamMoldGenerator:
|
||||
|
||||
def _assess_warpage_risk(self, analysis: Dict) -> str:
|
||||
"""评估翘曲风险"""
|
||||
bbox = analysis.get("bounding_box", {}).get("dimensions", [1, 1, 1])
|
||||
bbox = analysis.get("bounding_box", {}).get("dimensions", [0, 0, 0])
|
||||
aspect_ratio = max(bbox) / min(bbox)
|
||||
|
||||
if aspect_ratio > 5:
|
||||
|
||||
Reference in New Issue
Block a user