|
|
|
|
@ -1749,6 +1749,34 @@ def _route_network_metric_max(report, key):
|
|
|
|
|
return maximum
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _route_lane_summary(report):
|
|
|
|
|
max_lane_index = 0
|
|
|
|
|
lane_spacing = 0.0
|
|
|
|
|
for route in report.get("routes", []) or []:
|
|
|
|
|
if not isinstance(route, dict):
|
|
|
|
|
continue
|
|
|
|
|
lane = route.get("lane", {})
|
|
|
|
|
if not isinstance(lane, dict):
|
|
|
|
|
continue
|
|
|
|
|
try:
|
|
|
|
|
lane_index = int(lane.get("index", 0) or 0)
|
|
|
|
|
except Exception:
|
|
|
|
|
lane_index = 0
|
|
|
|
|
if lane_index <= max_lane_index:
|
|
|
|
|
continue
|
|
|
|
|
max_lane_index = lane_index
|
|
|
|
|
try:
|
|
|
|
|
lane_spacing = float(lane.get("spacing_mm", 0.0) or 0.0)
|
|
|
|
|
except Exception:
|
|
|
|
|
lane_spacing = 0.0
|
|
|
|
|
if max_lane_index <= 0:
|
|
|
|
|
return {}
|
|
|
|
|
return {
|
|
|
|
|
"max_lane_index": max_lane_index,
|
|
|
|
|
"spacing_mm": lane_spacing,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_eplan_connection_route_report(report):
|
|
|
|
|
message = "批量生成布线连接完成:routed={0}, collision_warnings={1}, missing_terminals={2}".format(
|
|
|
|
|
report.get("routed", 0),
|
|
|
|
|
@ -1800,6 +1828,12 @@ def format_eplan_connection_route_report(report):
|
|
|
|
|
network_parts.append("避障屏蔽 {0} 段".format(blocked_segments))
|
|
|
|
|
if network_parts:
|
|
|
|
|
message += "\n路径网络:{0}。".format(",".join(network_parts))
|
|
|
|
|
lane_summary = _route_lane_summary(report)
|
|
|
|
|
if lane_summary:
|
|
|
|
|
message += "\n并行错位:最大 lane {0},间距 {1:.1f} mm。".format(
|
|
|
|
|
lane_summary.get("max_lane_index", 0),
|
|
|
|
|
float(lane_summary.get("spacing_mm", 0.0) or 0.0),
|
|
|
|
|
)
|
|
|
|
|
route_source_sample = _route_source_sample_text(report)
|
|
|
|
|
if route_source_sample:
|
|
|
|
|
message += "\n{0}".format(route_source_sample)
|
|
|
|
|
|