From bf0c8f24fa5196fba37f7c0ce83481353c817356 Mon Sep 17 00:00:00 2001 From: Furgo <148809153+furgo16@users.noreply.github.com> Date: Wed, 18 Jun 2025 09:22:03 +0200 Subject: [PATCH] Import: DXF parser/imported improve unsupported features count Classify unsupported features by type, and report on the breakdown. --- src/Mod/Import/App/dxf/ImpExpDxf.cpp | 7 ++++++- src/Mod/Import/App/dxf/dxf.cpp | 2 +- src/Mod/Import/App/dxf/dxf.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Mod/Import/App/dxf/ImpExpDxf.cpp b/src/Mod/Import/App/dxf/ImpExpDxf.cpp index 5d48ce770e..b9adb639e1 100644 --- a/src/Mod/Import/App/dxf/ImpExpDxf.cpp +++ b/src/Mod/Import/App/dxf/ImpExpDxf.cpp @@ -1384,7 +1384,6 @@ Py::Object ImpExpDxfRead::getStatsAsPyObject() statsDict.setItem("finalScalingFactor", Py::Float(m_stats.finalScalingFactor)); statsDict.setItem("importTimeSeconds", Py::Float(m_stats.importTimeSeconds)); statsDict.setItem("totalEntitiesCreated", Py::Long(m_stats.totalEntitiesCreated)); - statsDict.setItem("unsupportedFeaturesCount", Py::Long(m_stats.unsupportedFeaturesCount)); Py::Dict entityCountsDict; for (const auto& pair : m_stats.entityCounts) { @@ -1398,5 +1397,11 @@ Py::Object ImpExpDxfRead::getStatsAsPyObject() } statsDict.setItem("importSettings", importSettingsDict); + Py::Dict unsupportedFeaturesDict; + for (const auto& pair : m_stats.unsupportedFeatures) { + unsupportedFeaturesDict.setItem(pair.first.c_str(), Py::Long(pair.second)); + } + statsDict.setItem("unsupportedFeatures", unsupportedFeaturesDict); + return statsDict; } diff --git a/src/Mod/Import/App/dxf/dxf.cpp b/src/Mod/Import/App/dxf/dxf.cpp index 81117d3e36..7028ff56a1 100644 --- a/src/Mod/Import/App/dxf/dxf.cpp +++ b/src/Mod/Import/App/dxf/dxf.cpp @@ -2397,9 +2397,9 @@ bool CDxfRead::SkipBlockContents() template void CDxfRead::UnsupportedFeature(const char* format, args&&... argValuess) { - m_stats.unsupportedFeaturesCount++; // NOLINTNEXTLINE(runtime/printf) std::string formattedMessage = fmt::sprintf(format, std::forward(argValuess)...); + m_stats.unsupportedFeatures[formattedMessage]++; // We place these formatted messages in a map, count their occurrences and not their first // occurrence. if (m_unsupportedFeaturesNoted[formattedMessage].first++ == 0) { diff --git a/src/Mod/Import/App/dxf/dxf.h b/src/Mod/Import/App/dxf/dxf.h index ac3d6b6f77..b6a04a1cad 100644 --- a/src/Mod/Import/App/dxf/dxf.h +++ b/src/Mod/Import/App/dxf/dxf.h @@ -187,8 +187,8 @@ struct DxfImportStats double finalScalingFactor = 1.0; std::map entityCounts; std::map importSettings; + std::map unsupportedFeatures; int totalEntitiesCreated = 0; - int unsupportedFeaturesCount = 0; };