x
This commit is contained in:
@@ -128,9 +128,9 @@ class GeometryVerificationService:
|
|||||||
stdout_text = stdout.decode('utf-8') if stdout else ''
|
stdout_text = stdout.decode('utf-8') if stdout else ''
|
||||||
stderr_text = stderr.decode('utf-8') if stderr else ''
|
stderr_text = stderr.decode('utf-8') if stderr else ''
|
||||||
|
|
||||||
logger.debug(f"验证脚本 stdout: {stdout_text[:500]}")
|
logger.info(f"验证脚本 stdout (前1000字符): {stdout_text[:1000]}")
|
||||||
if stderr_text:
|
if stderr_text:
|
||||||
logger.debug(f"验证脚本 stderr: {stderr_text[:500]}")
|
logger.warning(f"验证脚本 stderr: {stderr_text[:500]}")
|
||||||
|
|
||||||
if process.returncode == 0:
|
if process.returncode == 0:
|
||||||
# 尝试读取生成的报告文件(在 STP 文件目录下)
|
# 尝试读取生成的报告文件(在 STP 文件目录下)
|
||||||
@@ -181,34 +181,48 @@ class GeometryVerificationService:
|
|||||||
}
|
}
|
||||||
|
|
||||||
lines = output.split('\n')
|
lines = output.split('\n')
|
||||||
|
current_section = None
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
line = line.strip()
|
||||||
|
|
||||||
|
# 检测验证结果
|
||||||
if '验证结果:' in line:
|
if '验证结果:' in line:
|
||||||
if '✅ 通过' in line or '通过' in line:
|
if '✅ 通过' in line or '通过' in line:
|
||||||
result['status'] = 'passed'
|
result['status'] = 'passed'
|
||||||
elif '❌ 失败' in line or '失败' in line:
|
elif '❌ 失败' in line or '失败' in line:
|
||||||
result['status'] = 'failed'
|
result['status'] = 'failed'
|
||||||
elif '体积对比:' in line or '体积差异' in line:
|
|
||||||
|
# 检测当前段落
|
||||||
|
if '体积对比:' in line:
|
||||||
|
current_section = 'volume'
|
||||||
|
elif '表面积对比:' in line:
|
||||||
|
current_section = 'surface_area'
|
||||||
|
|
||||||
|
# 解析差异百分比
|
||||||
|
if '差异:' in line and '%' in line:
|
||||||
try:
|
try:
|
||||||
if '差异:' in line:
|
# 格式: "差异: 123.4567 mm³ (0.1234%)"
|
||||||
parts = line.split('差异:')
|
parts = line.split('(')
|
||||||
if len(parts) > 1:
|
if len(parts) >= 2:
|
||||||
diff_part = parts[1].strip()
|
percent_str = parts[-1].split('%')[0].strip()
|
||||||
if '%' in diff_part:
|
percent = float(percent_str)
|
||||||
percent = float(diff_part.split('%')[0].strip().split()[-1])
|
|
||||||
result['comparison']['volume'] = {'difference_percent': percent}
|
if current_section == 'volume':
|
||||||
except:
|
result['comparison']['volume'] = {'difference_percent': percent}
|
||||||
pass
|
elif current_section == 'surface_area':
|
||||||
elif '表面积对比:' in line or '表面积差异' in line:
|
result['comparison']['surface_area'] = {'difference_percent': percent}
|
||||||
try:
|
except Exception as e:
|
||||||
if '差异:' in line:
|
logger.debug(f"解析差异百分比失败: {e}")
|
||||||
parts = line.split('差异:')
|
|
||||||
if len(parts) > 1:
|
# 如果没有找到验证结果,但有 comparison 数据,则根据差异判断
|
||||||
diff_part = parts[1].strip()
|
if result['status'] == 'unknown' and result['comparison']:
|
||||||
if '%' in diff_part:
|
vol_diff = result['comparison'].get('volume', {}).get('difference_percent', 100)
|
||||||
percent = float(diff_part.split('%')[0].strip().split()[-1])
|
area_diff = result['comparison'].get('surface_area', {}).get('difference_percent', 100)
|
||||||
result['comparison']['surface_area'] = {'difference_percent': percent}
|
if vol_diff < 1 and area_diff < 2:
|
||||||
except:
|
result['status'] = 'passed'
|
||||||
pass
|
else:
|
||||||
|
result['status'] = 'failed'
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user