diff --git a/src/Mod/Import/App/dxf/dxf.cpp b/src/Mod/Import/App/dxf/dxf.cpp index 257fb5a165..b47c75a296 100644 --- a/src/Mod/Import/App/dxf/dxf.cpp +++ b/src/Mod/Import/App/dxf/dxf.cpp @@ -2342,6 +2342,7 @@ 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)...); // We place these formatted messages in a map, count their occurrences and not their first @@ -2538,6 +2539,8 @@ bool CDxfRead::ReadVersion() m_version = RUnknown; } + m_stats.dxfVersion = m_record_data; + return ResolveEncoding(); } @@ -2606,6 +2609,9 @@ bool CDxfRead::ResolveEncoding() Py_DECREF(pyDecoder); Py_DECREF(pyUTF8Decoder); } + + m_stats.dxfEncoding = m_encoding; + return !m_encoding.empty(); } @@ -2759,6 +2765,9 @@ bool CDxfRead::ReadEntity() m_entityAttributes.m_paperSpace); // TODO: Ensure the stream is noboolalpha (for that // matter ensure the stream has the "C" locale SetupValueAttribute(eColor, m_entityAttributes.m_Color); + + m_stats.entityCounts[m_record_data]++; + // The entity record is already the current record and is already checked as a type 0 record if (IsObjectName("LINE")) { return ReadLine(); diff --git a/src/Mod/Import/App/dxf/dxf.h b/src/Mod/Import/App/dxf/dxf.h index c3da0d8fba..7af0b45a73 100644 --- a/src/Mod/Import/App/dxf/dxf.h +++ b/src/Mod/Import/App/dxf/dxf.h @@ -176,6 +176,18 @@ struct LWPolyDataOut point3D Extr; }; +// Statistics reporting structure +struct DxfImportStats +{ + double importTimeSeconds = 0.0; + std::string dxfVersion; + std::string dxfEncoding; + std::map entityCounts; + std::map importSettings; + int totalEntitiesCreated = 0; + int unsupportedFeaturesCount = 0; +}; + // "using" for enums is not supported by all platforms // https://stackoverflow.com/questions/41167119/how-to-fix-a-wsubobject-linkage-warning @@ -455,6 +467,7 @@ private: double m_unitScalingFactor = 0.0; protected: + DxfImportStats m_stats; // An additional scaling factor which can be modified before readDXF is called, and will be // incorporated into m_unitScalingFactor. void SetAdditionalScaling(double scaling)