From c2e7524cb602ccb665b57fb86195c1a7df40acf9 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 2 Jan 2023 18:34:13 -0500 Subject: [PATCH] Surpress the giant opencascade stats print unless we are tracing Also catch Warn level messages to set a flag and print the relevant there were warning message Fixes https://gitlab.com/kicad/code/kicad/-/issues/8613 --- pcbnew/exporters/step/exporter_step.cpp | 10 ++++++++-- pcbnew/exporters/step/exporter_step.h | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pcbnew/exporters/step/exporter_step.cpp b/pcbnew/exporters/step/exporter_step.cpp index de4251d892..769262cb56 100644 --- a/pcbnew/exporters/step/exporter_step.cpp +++ b/pcbnew/exporters/step/exporter_step.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include // OpenCascade messenger #include // OpenCascade output messenger @@ -77,7 +78,8 @@ protected: const Message_Gravity theGravity ) const override #endif { - if( theGravity >= Message_Info ) + if( theGravity >= Message_Warning + || ( wxLog::IsAllowedTraceMask( traceKiCad2Step ) && theGravity == Message_Info ) ) { ReportMessage( theString.ToCString() ); @@ -89,6 +91,9 @@ protected: #endif } + if( theGravity == Message_Warning ) + m_converter->SetWarn(); + if( theGravity >= Message_Alarm ) m_converter->SetError(); @@ -105,6 +110,7 @@ EXPORTER_STEP::EXPORTER_STEP( BOARD* aBoard, const EXPORTER_STEP_PARAMS& aParams m_params( aParams ), m_error( false ), m_fail( false ), + m_warn( false ), m_hasDrillOrigin( false ), m_hasGridOrigin( false ), m_board( aBoard ), @@ -361,7 +367,7 @@ bool EXPORTER_STEP::Export() msg = _( "Unable to create STEP file.\n" "Check that the board has a valid outline and models." ); } - else if( m_error ) + else if( m_error || m_warn ) { msg = _( "STEP file has been created, but there are warnings." ); } diff --git a/pcbnew/exporters/step/exporter_step.h b/pcbnew/exporters/step/exporter_step.h index 6fc7c8e4c8..5b5e931830 100644 --- a/pcbnew/exporters/step/exporter_step.h +++ b/pcbnew/exporters/step/exporter_step.h @@ -72,7 +72,8 @@ public: wxString m_outputFile; void SetError() { m_error = true; } - void SetFail() { m_error = true; } + void SetFail() { m_fail = true; } + void SetWarn() { m_warn = true; } private: bool composePCB(); @@ -84,6 +85,7 @@ private: bool m_error; bool m_fail; + bool m_warn; bool m_hasDrillOrigin; bool m_hasGridOrigin;