diff --git a/docs/feedback/real-corpus-kernel-defects-20261101.md b/docs/feedback/real-corpus-kernel-defects-20261101.md index 01b977426..e9d5b7228 100644 --- a/docs/feedback/real-corpus-kernel-defects-20261101.md +++ b/docs/feedback/real-corpus-kernel-defects-20261101.md @@ -493,6 +493,45 @@ P0-3/P0-4 的完成条件: 3. AP209:实现 curve_element/node 分析几何到 drawing/曲线的导入,或在 API 中明确归类为 analysis-only,不再作为 B-Rep 失败。 +## 9.7 P0-3 / P0-4 本轮处理 + +### P0-3 DWG R13/R14:外部转换器已验证 + +下载并验证 LibreDWG 0.14 win64: + + build/tools/libredwg64/dwg2dxf.exe + +配置: + + VDE_DWG_READ_CMD=D:\...\dwg2dxf.exe {in} -o {out} + +对 129 个失败的 DWG 重跑: + + OK 118 + FAIL 11 + +剩余 11 个不是转换器问题: + +- 3 个扩展名 .dwg 实际是 PDF/未知/损坏文件; +- R2000 的 paper-space-only 文件没有模型空间实体; +- 其余为无有效图元或非 DWG 数据。 + +结论:DWG R13/R14 在配置外部转换器后可用;纯内核仍需补 R13/R14 header/bitstream。 +另修正了“原生支持 R13-R2018”的错误提示为“R15-R2018;R13/R14 需转换器”。 + +### P0-4 AP209:analysis-only + +新增 ImportDiagnostic::analysis_only: + +- AP209 且 bodies 为空时设置 analysis_only=true; +- parsed=true,但 ok 仍表示无 B-Rep; +- vde_brep_check 返回 `result: SKIP (analysis-only)`,exit 0; +- JSON 增加 `analysis_only` 字段; +- 目录模式把 analysis-only 计为 WARN,不再计 FAIL。 + +这满足“AP209 明确归类为 analysis-only,而不是 B-Rep 失败”的完成条件; +真正导入 AP209 曲线仍需专门实现。 + ## 10. 修正计划 ### P0(先修) diff --git a/include/vde/brep/format_io.h b/include/vde/brep/format_io.h index 09fc703d3..0a0cf058e 100644 --- a/include/vde/brep/format_io.h +++ b/include/vde/brep/format_io.h @@ -121,6 +121,7 @@ struct ImportDiagnostic { bool ok = false; ///< 与 CadImportResult::ok 同口径 bool converter_used = false; bool has_drawing = false; + bool analysis_only = false; ///< AP209 分析模型:结构已解析但无 B-Rep int body_count = 0; int drawing_entity_count = 0; diff --git a/src/brep/format_io.cpp b/src/brep/format_io.cpp index 5e86070a8..3f862d5f8 100644 --- a/src/brep/format_io.cpp +++ b/src/brep/format_io.cpp @@ -639,6 +639,16 @@ void fill_import_diagnostic(CadImportResult& result, const std::string& path, diag_add_issue(d, ImportIssueSeverity::Warning, "step.warning", w); for (const auto& u : s.unsupported_reprs) diag_add_issue(d, ImportIssueSeverity::Warning, "step.unsupported_repr", u); + if (result.bodies.empty() && s.schema_ap.find("AP209") != std::string::npos) { + d.analysis_only = true; + d.parsed = true; // 结构已解析,只是没有 B-Rep + diag_add_issue(d, ImportIssueSeverity::Info, "step.analysis_model", + "AP209 分析模型:已识别曲线/节点几何,但没有 B-Rep;" + "按 analysis-only 处理"); + diag_add_repair(d, "analysis_model_converter", + "如需实体几何,请用 AP203/AP214/AP242 转换或专门的 AP209 处理器", + false); + } if (!s.skipped_entities.empty()) { std::map by_type; bool has_complex = false; @@ -1041,6 +1051,7 @@ std::string ImportDiagnostic::to_json() const { << ",\"error_count\":" << error_count() << ",\"warning_count\":" << warning_count() << ",\"can_heal\":" << json_bool(can_heal()) + << ",\"analysis_only\":" << json_bool(analysis_only) << ",\"issues\":["; for (size_t i = 0; i < issues.size(); ++i) { if (i) o << ','; diff --git a/tools/vde_brep_check.cpp b/tools/vde_brep_check.cpp index 5c380d775..c37ff05a0 100644 --- a/tools/vde_brep_check.cpp +++ b/tools/vde_brep_check.cpp @@ -153,6 +153,7 @@ bool body_defect(const ImportDiagnostic& d) { } int diagnostic_exit(const ImportDiagnostic& d, bool strict = false) { + if (d.analysis_only) return 0; // AP209 等分析模型:SKIP,不是 B-Rep 失败 if (!d.ok) return 2; if (d.has_errors()) return 1; for (const auto& b : d.body_diagnostics) @@ -196,9 +197,10 @@ int check_directory(const std::string& dir, bool strict, bool quick) { ++total; const ImportDiagnostic d = quick ? import_cad(native_path(f)).diagnostic : diagnose_import(native_path(f)); - const bool hard = !d.ok || d.has_errors() || (!quick && body_defect(d)); - const bool soft = !hard && (d.has_warnings() || d.can_heal()); - if (!d.ok) ++failed; + const bool hard = (!d.ok && !d.analysis_only) || d.has_errors() || + (!quick && body_defect(d)); + const bool soft = !hard && (d.has_warnings() || d.can_heal() || d.analysis_only); + if (!d.ok && !d.analysis_only) ++failed; else if (hard) ++defect; else if (soft) ++warn; else ++pass; @@ -357,6 +359,8 @@ int run_check(int argc, char** argv) { quick_opts.collect_body_diagnostics = json; // P2-1:JSON bodies/body_count 一致 CadImportResult imported = import_cad(native_path(path), quick_opts); imported.diagnostic.path = path; // JSON path 保持 UTF-8 + if (!json && imported.diagnostic.analysis_only) + std::printf("result: SKIP (analysis-only)\n"); if (json) { std::printf("%s\n", imported.diagnostic.to_json().c_str()); } else { @@ -413,6 +417,11 @@ int run_check(int argc, char** argv) { for (const auto& repair : imported.diagnostic.repairs) std::printf(" repair[%s] %s\n", repair.automatic ? "auto" : "manual", repair.description.c_str()); + if (imported.diagnostic.analysis_only) { + std::printf("result: SKIP (analysis-only; no B-Rep, drawing entities=%d)\n", + imported.diagnostic.drawing_entity_count); + return 0; + } if (!imported.ok) return 2; if (imported.bodies.empty()) { std::printf("result: PASS (no B-Rep; drawing entities=%d)\n",