|
|
|
|
@ -1734,6 +1734,21 @@ def _route_source_sample_text(report):
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _route_network_metric_max(report, key):
|
|
|
|
|
maximum = 0
|
|
|
|
|
for route in report.get("routes", []) or []:
|
|
|
|
|
if not isinstance(route, dict):
|
|
|
|
|
continue
|
|
|
|
|
network = route.get("network", {})
|
|
|
|
|
if not isinstance(network, dict):
|
|
|
|
|
continue
|
|
|
|
|
try:
|
|
|
|
|
maximum = max(maximum, int(network.get(key, 0) or 0))
|
|
|
|
|
except Exception:
|
|
|
|
|
continue
|
|
|
|
|
return maximum
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_eplan_connection_route_report(report):
|
|
|
|
|
message = "批量生成布线连接完成:routed={0}, collision_warnings={1}, missing_terminals={2}".format(
|
|
|
|
|
report.get("routed", 0),
|
|
|
|
|
@ -1776,6 +1791,15 @@ def format_eplan_connection_route_report(report):
|
|
|
|
|
total_length_mm = float(report.get("total_length_mm", 0.0) or 0.0)
|
|
|
|
|
if total_length_mm > 0.0:
|
|
|
|
|
message += "\n布线连接总长度:{0:.1f} mm。".format(total_length_mm)
|
|
|
|
|
bridged_segments = _route_network_metric_max(report, "bridged_segments")
|
|
|
|
|
blocked_segments = _route_network_metric_max(report, "blocked_segments")
|
|
|
|
|
network_parts = []
|
|
|
|
|
if bridged_segments > 0:
|
|
|
|
|
network_parts.append("自动桥接 {0} 段相邻线槽".format(bridged_segments))
|
|
|
|
|
if blocked_segments > 0:
|
|
|
|
|
network_parts.append("避障屏蔽 {0} 段".format(blocked_segments))
|
|
|
|
|
if network_parts:
|
|
|
|
|
message += "\n路径网络:{0}。".format(",".join(network_parts))
|
|
|
|
|
route_source_sample = _route_source_sample_text(report)
|
|
|
|
|
if route_source_sample:
|
|
|
|
|
message += "\n{0}".format(route_source_sample)
|
|
|
|
|
|