From b68bdc22d783f63a4fbcd819f4b4657f485e8939 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 2 Oct 2018 08:34:07 +0200 Subject: [PATCH] Fix in kicadpcb reader. Update dialog export step kicad2step: code cleanup, and more activity messages displayed --- libs/sexpr/include/sexpr/sexpr.h | 2 +- libs/sexpr/sexpr.cpp | 7 +- pcbnew/dialogs/dialog_export_step.cpp | 58 +- pcbnew/dialogs/dialog_export_step_base.cpp | 68 +- pcbnew/dialogs/dialog_export_step_base.fbp | 670 ++++++++++-------- pcbnew/dialogs/dialog_export_step_base.h | 18 +- utils/kicad2step/CMakeLists.txt | 1 + utils/kicad2step/kicad2step.cpp | 96 ++- utils/kicad2step/kicad2step_frame_base.cpp | 2 +- ...ame_base.fpb => kicad2step_frame_base.fbp} | 2 +- utils/kicad2step/kicad2step_frame_base.h | 16 +- utils/kicad2step/pcb/3d_resolver.cpp | 2 +- utils/kicad2step/pcb/kicadcurve.cpp | 6 +- utils/kicad2step/pcb/kicadpcb.cpp | 44 +- utils/kicad2step/pcb/kicadpcb.h | 8 +- utils/kicad2step/pcb/oce_utils.cpp | 72 +- 16 files changed, 572 insertions(+), 500 deletions(-) rename utils/kicad2step/{kicad2step_frame_base.fpb => kicad2step_frame_base.fbp} (99%) diff --git a/libs/sexpr/include/sexpr/sexpr.h b/libs/sexpr/include/sexpr/sexpr.h index 4b35041b17..9e010e7baa 100644 --- a/libs/sexpr/include/sexpr/sexpr.h +++ b/libs/sexpr/include/sexpr/sexpr.h @@ -68,7 +68,7 @@ namespace SEXPR std::string const & GetSymbol() const; SEXPR_LIST* GetList(); std::string AsString( size_t aLevel = 0) const; - size_t GetLineNumber() { return m_lineNumber; } + size_t GetLineNumber() const { return m_lineNumber; } }; struct SEXPR_INTEGER : public SEXPR diff --git a/libs/sexpr/sexpr.cpp b/libs/sexpr/sexpr.cpp index 4c49f2a43b..5b882afd5e 100644 --- a/libs/sexpr/sexpr.cpp +++ b/libs/sexpr/sexpr.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace SEXPR { @@ -128,7 +129,9 @@ namespace SEXPR { if( m_type != SEXPR_TYPE::SEXPR_TYPE_ATOM_SYMBOL ) { - throw INVALID_TYPE_EXCEPTION("SEXPR is not a symbol type!"); + std::string err_msg( "GetSymbol(): SEXPR is not a symbol type! error line "); + err_msg += std::to_string( GetLineNumber() ); + throw INVALID_TYPE_EXCEPTION( err_msg ); } return static_cast< SEXPR_SYMBOL const * >(this)->m_value; @@ -375,7 +378,7 @@ namespace SEXPR } else { - throw std::invalid_argument( "SEXPR is not a symbol type!" ); + throw std::invalid_argument( "operator>>: SEXPR is not a symbol type!" ); } } else diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index ce77207afd..72f41ca000 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -24,6 +24,7 @@ #include #include +#include #include "pcb_edit_frame.h" #include "kiface_i.h" @@ -35,6 +36,7 @@ #include #include +#define OPTKEY_STEP_OVERWRITE "STEP_Overwrite" class DIALOG_EXPORT_STEP: public DIALOG_EXPORT_STEP_BASE { @@ -53,6 +55,7 @@ private: // The last preference for STEP Origin: STEP_ORG_OPT m_STEP_org_opt; bool m_noVirtual; // remember last preference for No Virtual Component + bool m_overwriteFile; // remember last preference for overwrite file int m_OrgUnits; // remember last units for User Origin double m_XOrg; // remember last User Origin X value double m_YOrg; // remember last User Origin Y value @@ -86,6 +89,11 @@ protected: return m_cbRemoveVirtual->GetValue(); } + bool GetOverwriteFile() + { + return m_cbOverwriteFile->GetValue(); + } + public: DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString& aBoardPath ); @@ -153,6 +161,8 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString& m_noVirtual = cfg->m_ExportStep.no_virtual; m_cbRemoveVirtual->SetValue( m_noVirtual ); + m_config->Read( OPTKEY_STEP_OVERWRITE, &m_overwriteFile, false ); + m_cbOverwriteFile->SetValue( m_overwriteFile ); m_STEP_OrgUnitChoice->SetSelection( m_OrgUnits ); wxString tmpStr; @@ -243,7 +253,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) wxFileName fn = m_filePickerSTEP->GetFileName(); - if( fn.FileExists() ) + if( fn.FileExists() && !GetOverwriteFile() ) { msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ), fn.GetFullPath().GetData() ); @@ -333,49 +343,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) cmdK2S.Append( " " ); cmdK2S.Append( wxString::Format("\"%s\"", m_boardPath ) ); // output file path - int result = 0; - bool success = false; - wxArrayString output, errors; - REPORTER& reporter = m_messagesPanel->Reporter(); - reporter.ReportHead( wxString::Format( _( "Executing '%s'" ), cmdK2S ), RPT_SEVERITY_ACTION ); - - { - wxBusyCursor dummy; - result = wxExecute( cmdK2S, output, errors, wxEXEC_SYNC | wxEXEC_SHOW_CONSOLE ); - } - - // Check the output log for an indication of success, - // the value returned by wxExecute is not conclusive - for( auto& l : output ) - { - if( !l.IsEmpty() ) - reporter.ReportTail( l, REPORTER::RPT_INFO ); - - if( l.Contains( "Done" ) ) - { - success = true; - break; - } - } - - for( auto& err : errors ) - reporter.Report( err, RPT_SEVERITY_WARNING ); + wxExecute( cmdK2S, wxEXEC_ASYNC | wxEXEC_SHOW_CONSOLE ); - if( result ) // Any troubles? - { - if( !success ) - { - reporter.ReportTail( _( "Unable to create STEP file. Check that the board has a " - "valid outline and models." ), RPT_SEVERITY_ERROR ); - } - else - { - reporter.ReportTail( _( "STEP file has been created, but there are warnings." ), - RPT_SEVERITY_INFO ); - } - } - else - { - reporter.ReportTail( _( "STEP file has been created successfully." ), RPT_SEVERITY_INFO ); - } + aEvent.Skip(); // Close the dialog } diff --git a/pcbnew/dialogs/dialog_export_step_base.cpp b/pcbnew/dialogs/dialog_export_step_base.cpp index 90ffbc2e17..a6c80a1f9d 100644 --- a/pcbnew/dialogs/dialog_export_step_base.cpp +++ b/pcbnew/dialogs/dialog_export_step_base.cpp @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 17 2019) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "widgets/text_ctrl_eval.h" -#include "wx_html_report_panel.h" #include "dialog_export_step_base.h" @@ -73,9 +72,9 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i fgSizer1->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_staticText5 = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText5->Wrap( -1 ); - fgSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_staticTextUnits = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnits->Wrap( -1 ); + fgSizer1->Add( m_staticTextUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString m_STEP_OrgUnitChoiceChoices[] = { _("mm"), _("inch") }; int m_STEP_OrgUnitChoiceNChoices = sizeof( m_STEP_OrgUnitChoiceChoices ) / sizeof( wxString ); @@ -86,9 +85,9 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i fgSizer1->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_staticText3 = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText3->Wrap( -1 ); - fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_staticTextXpos = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextXpos->Wrap( -1 ); + fgSizer1->Add( m_staticTextXpos, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_STEP_Xorg = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); #ifdef __WXGTK__ @@ -104,9 +103,9 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i fgSizer1->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_staticText4 = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText4->Wrap( -1 ); - fgSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_staticTextYpos = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextYpos->Wrap( -1 ); + fgSizer1->Add( m_staticTextYpos, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_STEP_Yorg = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); #ifdef __WXGTK__ @@ -134,34 +133,25 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i bSizer8->Add( m_staticText7, 0, wxALL, 5 ); - wxBoxSizer* bSizer6; - bSizer6 = new wxBoxSizer( wxVERTICAL ); - - wxFlexGridSizer* fgSizer3; - fgSizer3 = new wxFlexGridSizer( 0, 2, 0, 0 ); - fgSizer3->SetFlexibleDirection( wxBOTH ); - fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer3->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_cbRemoveVirtual = new wxCheckBox( this, wxID_ANY, _("Ignore virtual components"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_cbRemoveVirtual, 0, wxALL, 5 ); + bSizer8->Add( m_cbRemoveVirtual, 0, wxALL, 5 ); + m_cbOverwriteFile = new wxCheckBox( this, wxID_ANY, _("Overwrite old file"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer8->Add( m_cbOverwriteFile, 0, wxALL, 5 ); - bSizer6->Add( fgSizer3, 1, wxEXPAND, 5 ); + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer8->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 ); - wxFlexGridSizer* fgSizer4; - fgSizer4 = new wxFlexGridSizer( 0, 3, 0, 0 ); - fgSizer4->SetFlexibleDirection( wxBOTH ); - fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + m_staticText9 = new wxStaticText( this, wxID_ANY, _("Board outline builder:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText9->Wrap( -1 ); + bSizer8->Add( m_staticText9, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + wxBoxSizer* bSizerTolerance; + bSizerTolerance = new wxBoxSizer( wxHORIZONTAL ); - fgSizer4->Add( 0, 0, 0, wxALL|wxEXPAND, 5 ); - - m_staticText8 = new wxStaticText( this, wxID_ANY, _("Tolerance:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText8->Wrap( -1 ); - fgSizer4->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_staticTextTolerance = new wxStaticText( this, wxID_ANY, _("Tolerance:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTolerance->Wrap( -1 ); + bSizerTolerance->Add( m_staticTextTolerance, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); wxString m_toleranceChoices[] = { _("Tight"), _("Standard"), _("Loose"), _("Very loose") }; int m_toleranceNChoices = sizeof( m_toleranceChoices ) / sizeof( wxString ); @@ -169,22 +159,16 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i m_tolerance->SetSelection( 1 ); m_tolerance->SetToolTip( _("Tolerance sets the distance between two points that are considered joined. Standard is 0.001mm.") ); - fgSizer4->Add( m_tolerance, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + bSizerTolerance->Add( m_tolerance, 1, wxALL, 5 ); - bSizer6->Add( fgSizer4, 1, wxEXPAND, 10 ); - - bSizer8->Add( bSizer6, 1, wxEXPAND, 5 ); + bSizer8->Add( bSizerTolerance, 0, wxEXPAND, 5 ); bSizer2->Add( bSizer8, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - bSizerSTEPFile->Add( bSizer2, 0, wxEXPAND, 5 ); - - m_messagesPanel = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - bSizerSTEPFile->Add( m_messagesPanel, 1, wxEXPAND | wxALL, 5 ); + bSizerSTEPFile->Add( bSizer2, 1, wxEXPAND, 5 ); m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizerSTEPFile->Add( m_staticline, 0, wxEXPAND | wxALL, 5 ); diff --git a/pcbnew/dialogs/dialog_export_step_base.fbp b/pcbnew/dialogs/dialog_export_step_base.fbp index 69c0168afa..151e879798 100644 --- a/pcbnew/dialogs/dialog_export_step_base.fbp +++ b/pcbnew/dialogs/dialog_export_step_base.fbp @@ -45,7 +45,7 @@ DIALOG_EXPORT_STEP_BASE - 650,361 + 560,277 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Export STEP @@ -245,7 +245,7 @@ 5 wxEXPAND - 0 + 1 bSizer2 @@ -716,7 +716,7 @@ 0 1 - m_staticText5 + m_staticTextUnits 1 @@ -852,7 +852,7 @@ 0 1 - m_staticText3 + m_staticTextXpos 1 @@ -988,7 +988,7 @@ 0 1 - m_staticText4 + m_staticTextYpos 1 @@ -1147,258 +1147,385 @@ -1 + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ignore virtual components + + 0 + + + 0 + + 1 + m_cbRemoveVirtual + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Overwrite old file + + 0 + + + 0 + + 1 + m_cbOverwriteFile + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline3 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Board outline builder: + 0 + + 0 + + + 0 + + 1 + m_staticText9 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + 5 wxEXPAND - 1 + 0 - bSizer6 - wxVERTICAL + bSizerTolerance + wxHORIZONTAL none 5 - wxEXPAND - 1 - - 2 - wxBOTH - - - 0 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Tolerance: + 0 + + 0 + + + 0 - fgSizer3 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 1 - - 0 - protected - 0 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Ignore virtual components - - 0 - - - 0 - - 1 - m_cbRemoveVirtual - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - + 1 + m_staticTextTolerance + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 - 10 - wxEXPAND + 5 + wxALL 1 - - 3 - wxBOTH - - - 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Tight" "Standard" "Loose" "Very loose" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 - fgSizer4 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALL|wxEXPAND - 0 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Tolerance: - 0 - - 0 - - - 0 - - 1 - m_staticText8 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Tight" "Standard" "Loose" "Very loose" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_tolerance - 1 - - - protected - 1 - - Resizable - 1 - 1 - - - ; ; forward_declare - 0 - Tolerance sets the distance between two points that are considered joined. Standard is 0.001mm. - - wxFILTER_NONE - wxDefaultValidator - - - - - - + 1 + m_tolerance + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + ; ; forward_declare + 0 + Tolerance sets the distance between two points that are considered joined. Standard is 0.001mm. + + wxFILTER_NONE + wxDefaultValidator + + + + @@ -1407,63 +1534,6 @@ - - 5 - wxEXPAND | wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_messagesPanel - 1 - - - protected - 1 - - Resizable - 1 - - WX_HTML_REPORT_PANEL; wx_html_report_panel.h - 0 - - - - wxTAB_TRAVERSAL - - 5 wxEXPAND | wxALL diff --git a/pcbnew/dialogs/dialog_export_step_base.h b/pcbnew/dialogs/dialog_export_step_base.h index a54b34849e..d4fe84c0e9 100644 --- a/pcbnew/dialogs/dialog_export_step_base.h +++ b/pcbnew/dialogs/dialog_export_step_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 17 2019) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,7 +11,6 @@ #include #include class TEXT_CTRL_EVAL; -class WX_HTML_REPORT_PANEL; #include "dialog_shim.h" #include @@ -28,7 +27,6 @@ class WX_HTML_REPORT_PANEL; #include #include #include -#include #include #include @@ -51,17 +49,19 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM wxRadioButton* m_rbUserDefinedOrigin; wxRadioButton* m_rbBoardCenterOrigin; wxStaticText* m_staticText2; - wxStaticText* m_staticText5; + wxStaticText* m_staticTextUnits; wxChoice* m_STEP_OrgUnitChoice; - wxStaticText* m_staticText3; + wxStaticText* m_staticTextXpos; TEXT_CTRL_EVAL* m_STEP_Xorg; - wxStaticText* m_staticText4; + wxStaticText* m_staticTextYpos; TEXT_CTRL_EVAL* m_STEP_Yorg; wxStaticText* m_staticText7; wxCheckBox* m_cbRemoveVirtual; - wxStaticText* m_staticText8; + wxCheckBox* m_cbOverwriteFile; + wxStaticLine* m_staticline3; + wxStaticText* m_staticText9; + wxStaticText* m_staticTextTolerance; wxChoice* m_tolerance; - WX_HTML_REPORT_PANEL* m_messagesPanel; wxStaticLine* m_staticline; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; @@ -76,7 +76,7 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM public: - DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export STEP"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 650,361 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export STEP"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 560,277 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EXPORT_STEP_BASE(); }; diff --git a/utils/kicad2step/CMakeLists.txt b/utils/kicad2step/CMakeLists.txt index 32204ab3ae..1c5a46f065 100644 --- a/utils/kicad2step/CMakeLists.txt +++ b/utils/kicad2step/CMakeLists.txt @@ -5,6 +5,7 @@ include_directories( SYSTEM set( KS2_LIB_FILES kicad2step.cpp + kicad2step_frame_base.cpp pcb/3d_resolver.cpp pcb/base.cpp pcb/kicadmodel.cpp diff --git a/utils/kicad2step/kicad2step.cpp b/utils/kicad2step/kicad2step.cpp index c11ab49c69..25e29caa96 100644 --- a/utils/kicad2step/kicad2step.cpp +++ b/utils/kicad2step/kicad2step.cpp @@ -48,11 +48,11 @@ public: virtual bool OnCmdLineParsed(wxCmdLineParser& parser) override; private: + KICAD2STEP_FRAME * m_frame; KICAD2MCAD_PRMS m_params; public: PANEL_KICAD2STEP* m_Panel; - KICAD2STEP_FRAME * m_frame; }; wxIMPLEMENT_APP(KICAD2MCAD_APP); @@ -80,6 +80,7 @@ KICAD2MCAD_PRMS::KICAD2MCAD_PRMS() } + void ReportMessage( const wxString& aMessage ) { KICAD2MCAD_APP& app = wxGetApp(); @@ -124,13 +125,12 @@ bool KICAD2MCAD_APP::OnInit() return false; // create the main application window - m_frame = new KICAD2STEP_FRAME("Kicad2step"); + m_frame = new KICAD2STEP_FRAME( "Kicad2step" ); m_Panel = m_frame->m_panelKicad2Step; m_Panel->m_params = m_params; - // and show it (the frames, unlike simple controls, are not shown when - // created initially) + // and show it (a wxRrame is not shown when created initially) m_frame->Show( true ); m_frame->Iconize( false ); @@ -140,9 +140,9 @@ bool KICAD2MCAD_APP::OnInit() int KICAD2MCAD_APP::OnRun() { - m_frame->Show(true); - m_Panel->RunConverter(); - return 0; + int diag = m_Panel->RunConverter(); + wxApp::OnRun(); // Start the main loop event, to manage the main frame + return diag; } @@ -178,7 +178,8 @@ PANEL_KICAD2STEP::PANEL_KICAD2STEP( wxWindow* parent, wxWindowID id, void PANEL_KICAD2STEP::AppendMessage( const wxString& aMessage ) { - m_tcMessages->AppendText( aMessage ); wxSafeYield(); + m_tcMessages->AppendText( aMessage ); + wxSafeYield(); } @@ -331,41 +332,44 @@ int PANEL_KICAD2STEP::RunConverter() return -1; } - wxFileName tfname; + wxFileName out_fname; if( m_params.m_outputFile.empty() ) { - tfname.Assign( fname.GetFullPath() ); - tfname.SetExt( m_params.getOutputExt() ); + out_fname.Assign( fname.GetFullPath() ); + out_fname.SetExt( m_params.getOutputExt() ); } else { - tfname.Assign( m_params.m_outputFile ); + out_fname.Assign( m_params.m_outputFile ); // Set the file extension if the user's requested // file name does not have an extension. - if( !tfname.HasExt() ) - tfname.SetExt( m_params.getOutputExt() ); + if( !out_fname.HasExt() ) + out_fname.SetExt( m_params.getOutputExt() ); } - if( tfname.FileExists() && !m_params.m_overwrite ) + if( out_fname.FileExists() && !m_params.m_overwrite ) { - wxMessageBox( "** Output already exists.\n" + ReportMessage( "** Output already exists.\n" "Enable the force overwrite flag to overwrite it." ); return -1; } - wxString outfile = tfname.GetFullPath(); - KICADPCB pcb( m_tcMessages ); + wxString outfile = out_fname.GetFullPath(); + KICADPCB pcb; pcb.SetOrigin( m_params.m_xOrigin, m_params.m_yOrigin ); pcb.SetMinDistance( m_params.m_minDistance ); - m_tcMessages->AppendText( wxString::Format( "Read: %s\n", m_params.m_filename ) ); + ReportMessage( wxString::Format( "Read: %s\n", m_params.m_filename ) ); - // create the new stream to "redirect" cout's output to + // create the new streams to "redirect" cout and cerr output to + // msgs_from_opencascade and errors_from_opencascade std::ostringstream msgs_from_opencascade; - STREAMBUF_SWAPPER swapper(cout, msgs_from_opencascade); + std::ostringstream errors_from_opencascade; + STREAMBUF_SWAPPER swapper_cout(cout, msgs_from_opencascade); + STREAMBUF_SWAPPER swapper_cerr(cerr, errors_from_opencascade); if( pcb.ReadFile( m_params.m_filename ) ) { @@ -379,9 +383,10 @@ int PANEL_KICAD2STEP::RunConverter() try { - m_tcMessages->AppendText( "Build STEP data\n" ); + ReportMessage( "Build STEP data\n" ); + pcb.ComposePCB( m_params.m_includeVirtual ); - m_tcMessages->AppendText( "Start WriteSTEP\n" ); + ReportMessage( "Write STEP file\n" ); #ifdef SUPPORTS_IGES if( m_fmtIGES ) @@ -392,30 +397,57 @@ int PANEL_KICAD2STEP::RunConverter() if( !res ) { - wxMessageBox( "Error WriteSTEP" ); + wxMessageBox( "Error Write STEP file" ); return -1; } - - m_tcMessages->AppendText( wxString::Format( "Step file %s created\n", outfile ) ); } catch( const Standard_Failure& e ) { - e.Print( std::cerr ); - wxMessageBox( "Error Read" ); + wxString err = e.GetMessageString(); + //e.Print( std::cerr ); + wxMessageBox( err, "Export Error" ); + + ReportMessage( wxString::Format( "\nExport Error: %s\n", err ) ); + ReportMessage( "\n*** Abort export ***\n" ); return -1; } catch( ... ) { wxMessageBox( "(no exception information)", "Unknown error" ); + ReportMessage( "\nUnknown error\n*** Abort export ***\n" ); return -1; } } + wxString msgs, errs; + msgs << msgs_from_opencascade.str(); + ReportMessage( msgs ); + + ReportMessage( wxString::Format( "\nStep file %s created\n\n", outfile ) ); + + errs << errors_from_opencascade.str(); + ReportMessage( errs ); + + // Check the output log for an indication of success + bool success = msgs.Contains( "Done" ); wxString msg; - msg << msgs_from_opencascade.str(); - m_tcMessages->AppendText( msg ); - wxMessageBox( "End kicad2step" ); + if( !errs.IsEmpty() ) // Any troubles? + { + if( !success ) + msg = "Unable to create STEP file.\n" + "Check that the board has a valid outline and models."; + else + { + msg = "STEP file has been created, but there are warnings."; + } + } + else // No error messages: the file is expected OK + { + msg.Printf( "STEP file:\n%s\nhas been created successfully.", outfile ); + } + + ReportMessage( msg ); return 0; } @@ -428,5 +460,5 @@ wxString KICAD2MCAD_PRMS::getOutputExt() const return wxString( "igs" ); else #endif - return wxString( "stp" ); + return wxString( "step" ); } diff --git a/utils/kicad2step/kicad2step_frame_base.cpp b/utils/kicad2step/kicad2step_frame_base.cpp index b40c1072b9..d50e1cc024 100644 --- a/utils/kicad2step/kicad2step_frame_base.cpp +++ b/utils/kicad2step/kicad2step_frame_base.cpp @@ -17,7 +17,7 @@ KICAD2STEP_FRAME_BASE::KICAD2STEP_FRAME_BASE( wxWindow* parent, wxWindowID id, c bSizerMain = new wxBoxSizer( wxVERTICAL ); m_panelKicad2Step = new PANEL_KICAD2STEP( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - bSizerMain->Add( m_panelKicad2Step, 1, wxEXPAND | wxALL, 5 ); + bSizerMain->Add( m_panelKicad2Step, 1, wxEXPAND, 5 ); this->SetSizer( bSizerMain ); diff --git a/utils/kicad2step/kicad2step_frame_base.fpb b/utils/kicad2step/kicad2step_frame_base.fbp similarity index 99% rename from utils/kicad2step/kicad2step_frame_base.fpb rename to utils/kicad2step/kicad2step_frame_base.fbp index cd8ee33d1a..e62302f146 100644 --- a/utils/kicad2step/kicad2step_frame_base.fpb +++ b/utils/kicad2step/kicad2step_frame_base.fbp @@ -109,7 +109,7 @@ none 5 - wxEXPAND | wxALL + wxEXPAND 1 1 diff --git a/utils/kicad2step/kicad2step_frame_base.h b/utils/kicad2step/kicad2step_frame_base.h index 404a712750..66ddbecfe4 100644 --- a/utils/kicad2step/kicad2step_frame_base.h +++ b/utils/kicad2step/kicad2step_frame_base.h @@ -27,21 +27,19 @@ /////////////////////////////////////////////////////////////////////////////// /// Class KICAD2STEP_FRAME_BASE /////////////////////////////////////////////////////////////////////////////// -class KICAD2STEP_FRAME_BASE : public wxFrame +class KICAD2STEP_FRAME_BASE : public wxFrame { private: - + protected: - + public: PANEL_KICAD2STEP* m_panelKicad2Step; - - KICAD2STEP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, - const wxString& title = _("Kicad2step Converter"), const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); - + + KICAD2STEP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Kicad2step Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + ~KICAD2STEP_FRAME_BASE(); - + }; #endif //__KICAD2STEP_FRAME_BASE_H__ diff --git a/utils/kicad2step/pcb/3d_resolver.cpp b/utils/kicad2step/pcb/3d_resolver.cpp index 1d96702671..1d6c66f2b8 100644 --- a/utils/kicad2step/pcb/3d_resolver.cpp +++ b/utils/kicad2step/pcb/3d_resolver.cpp @@ -396,7 +396,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName ) if( !( m_errflags & ERRFLG_ENVPATH ) ) { m_errflags |= ERRFLG_ENVPATH; - wxString errmsg = "[3D File Resolver] No such path; ensure the environment var is defined\n"; + wxString errmsg = "[3D File Resolver] file not found:\n"; errmsg << tname << "\n"; ReportMessage( errmsg ); } diff --git a/utils/kicad2step/pcb/kicadcurve.cpp b/utils/kicad2step/pcb/kicadcurve.cpp index fab98d8b6a..2361e6bbf0 100644 --- a/utils/kicad2step/pcb/kicadcurve.cpp +++ b/utils/kicad2step/pcb/kicadcurve.cpp @@ -147,13 +147,17 @@ std::string KICADCURVE::Describe() const case CURVE_LINE: desc << "line start: " << m_start << " end: " << m_end; break; + case CURVE_ARC: desc << "arc center: " << m_start << " radius: " << m_radius - << " angle: " << 180.0 * m_angle / M_PI; + << " angle: " << 180.0 * m_angle / M_PI + << " arc start: " << m_end << " arc end: " << m_ep; break; + case CURVE_CIRCLE: desc << "circle center: " << m_start << " radius: " << m_radius; break; + default: desc << ""; break; diff --git a/utils/kicad2step/pcb/kicadpcb.cpp b/utils/kicad2step/pcb/kicadpcb.cpp index c07a336b5e..7e3690a054 100644 --- a/utils/kicad2step/pcb/kicadpcb.cpp +++ b/utils/kicad2step/pcb/kicadpcb.cpp @@ -86,19 +86,18 @@ static wxString GetKicadConfigPath() } -KICADPCB::KICADPCB( wxTextCtrl* aMessageWindow ) +KICADPCB::KICADPCB() { wxFileName cfgdir( GetKicadConfigPath(), "" ); cfgdir.AppendDir( "3d" ); m_resolver.Set3DConfigDir( cfgdir.GetPath() ); m_thickness = 1.6; - m_pcb = NULL; + m_pcb_model = nullptr; m_minDistance = MIN_DISTANCE; m_useGridOrigin = false; m_useDrillOrigin = false; m_hasGridOrigin = false; m_hasDrillOrigin = false; - m_messageWindow = aMessageWindow; } @@ -110,19 +109,12 @@ KICADPCB::~KICADPCB() for( auto i : m_curves ) delete i; - if( m_pcb ) - delete m_pcb; + delete m_pcb_model; return; } -void KICADPCB::ReportMessage( const wxString& aMessage ) -{ - m_messageWindow->AppendText( aMessage ); wxSafeYield(); -} - - bool KICADPCB::ReadFile( const wxString& aFileName ) { wxFileName fname( aFileName ); @@ -175,9 +167,9 @@ bool KICADPCB::ReadFile( const wxString& aFileName ) bool KICADPCB::WriteSTEP( const wxString& aFileName ) { - if( m_pcb ) + if( m_pcb_model ) { - return m_pcb->WriteSTEP( aFileName ); + return m_pcb_model->WriteSTEP( aFileName ); } return false; @@ -187,9 +179,9 @@ bool KICADPCB::WriteSTEP( const wxString& aFileName ) #ifdef SUPPORTS_IGES bool KICADPCB::WriteIGES( const wxString& aFileName ) { - if( m_pcb ) + if( m_pcb_model ) { - return m_pcb->WriteIGES( aFileName ); + return m_pcb_model->WriteIGES( aFileName ); } return false; @@ -406,12 +398,12 @@ bool KICADPCB::parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType ) bool KICADPCB::ComposePCB( bool aComposeVirtual ) { - if( m_pcb ) + if( m_pcb_model ) return true; if( m_modules.empty() && m_curves.empty() ) { - ReportMessage( "Error: no PCB data to render\n" ); + ReportMessage( "Error: no PCB data (no footprint, no outline) to render\n" ); return false; } @@ -432,9 +424,9 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual ) origin = m_origin; } - m_pcb = new PCBMODEL(); - m_pcb->SetPCBThickness( m_thickness ); - m_pcb->SetMinDistance( m_minDistance ); + m_pcb_model = new PCBMODEL(); + m_pcb_model->SetPCBThickness( m_thickness ); + m_pcb_model->SetMinDistance( m_minDistance ); for( auto i : m_curves ) { @@ -451,17 +443,19 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual ) if( CURVE_ARC == lcurve.m_form ) lcurve.m_angle = -lcurve.m_angle; - m_pcb->AddOutlineSegment( &lcurve ); + m_pcb_model->AddOutlineSegment( &lcurve ); } for( auto i : m_modules ) - i->ComposePCB( m_pcb, &m_resolver, origin, aComposeVirtual ); + i->ComposePCB( m_pcb_model, &m_resolver, origin, aComposeVirtual ); + + ReportMessage( "Create PCB solid model\n" ); - if( !m_pcb->CreatePCB() ) + if( !m_pcb_model->CreatePCB() ) { ReportMessage( "could not create PCB solid model\n" ); - delete m_pcb; - m_pcb = NULL; + delete m_pcb_model; + m_pcb_model = NULL; return false; } diff --git a/utils/kicad2step/pcb/kicadpcb.h b/utils/kicad2step/pcb/kicadpcb.h index fad152bd31..a88e4eca95 100644 --- a/utils/kicad2step/pcb/kicadpcb.h +++ b/utils/kicad2step/pcb/kicadpcb.h @@ -55,7 +55,7 @@ class KICADPCB private: S3D_RESOLVER m_resolver; wxString m_filename; - PCBMODEL* m_pcb; + PCBMODEL* m_pcb_model; DOUBLET m_origin; DOUBLET m_gridOrigin; DOUBLET m_drillOrigin; @@ -73,7 +73,6 @@ private: double m_thickness; std::vector< KICADMODULE* > m_modules; std::vector< KICADCURVE* > m_curves; - wxTextCtrl* m_messageWindow; // to print messages bool parsePCB( SEXPR::SEXPR* data ); bool parseGeneral( SEXPR::SEXPR* data ); @@ -83,12 +82,9 @@ private: bool parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType ); public: - KICADPCB( wxTextCtrl* aMessageWindow ); + KICADPCB(); virtual ~KICADPCB(); - // print aMessage to to called window - void ReportMessage( const wxString& aMessage ); - int GetLayerId( std::string& aLayerName ); void SetOrigin( double aXOrigin, double aYOrigin ) diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index a9d5da528f..5ea31860d5 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -165,9 +165,9 @@ FormatType fileType( const char* aFileName ) if( !lfile.FileExists() ) { std::ostringstream ostr; -#ifdef __WXDEBUG__ +#ifdef DEBUG ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ +#endif /* DEBUG */ ostr << " * no such file: '" << aFileName << "'\n"; wxLogMessage( "%s", ostr.str().c_str() ); @@ -258,9 +258,9 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) if( distance < m_minDistance2 ) { std::ostringstream ostr; -#ifdef __WXDEBUG__ +#ifdef DEBUG ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ +#endif /* DEBUG */ ostr << " * rejected a zero-length " << aCurve->Describe() << "\n"; wxLogMessage( "%s", ostr.str().c_str() ); return false; @@ -277,9 +277,9 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) if( rad < m_minDistance2 ) { std::ostringstream ostr; -#ifdef __WXDEBUG__ +#ifdef DEBUG ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ +#endif /* DEBUG */ ostr << " * rejected a zero-radius " << aCurve->Describe() << "\n"; wxLogMessage( "%s", ostr.str().c_str() ); return false; @@ -317,9 +317,9 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) if( rad < m_minDistance2 ) { std::ostringstream ostr; -#ifdef __WXDEBUG__ +#ifdef DEBUG ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ +#endif /* DEBUG */ ostr << " * rejected an arc with equivalent end points, " << aCurve->Describe() << "\n"; wxLogMessage( "%s", ostr.str().c_str() ); @@ -423,9 +423,9 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) do { std::ostringstream ostr; -#ifdef __WXDEBUG__ +#ifdef DEBUG ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ +#endif /* DEBUG */ ostr << " * unsupported curve type: '" << aCurve->m_form << "'\n"; wxLogMessage( "%s", ostr.str().c_str() ); } while( 0 ); @@ -659,11 +659,13 @@ bool PCBMODEL::CreatePCB() m_hasPCB = true; // whether or not operations fail we note that CreatePCB has been invoked TopoDS_Shape board; - OUTLINE oln; // loop to assemble (represents PCB outline and cutouts) + OUTLINE oln; // loop to assemble (represents PCB outline and cutouts) oln.SetMinSqDistance( m_minDistance2 ); oln.AddSegment( *m_mincurve ); m_curves.erase( m_mincurve ); + ReportMessage( wxString::Format( "Build board outline (%d items)\n", (int)m_curves.size() ) ); + while( !m_curves.empty() ) { if( oln.IsClosed() ) @@ -756,10 +758,6 @@ bool PCBMODEL::CreatePCB() } else { - std::ostringstream ostr; -#ifdef __WXDEBUG__ - ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ ReportMessage( "could not create board cutout\n" ); } } @@ -769,7 +767,33 @@ bool PCBMODEL::CreatePCB() for( const auto& i : m_cutouts ) board = BRepAlgoAPI_Cut( board, i ); + if( m_cutouts.size() ) + ReportMessage( wxString::Format( "Build board cutout (%d holes)\n", (int)m_cutouts.size() ) ); + + // Substract holes (cutouts) can be time consuming, so display activity + // state to be sure there is no hang: + int char_count = 0; + int cur_count = 0; + int cntmax = m_cutouts.size(); + + for( auto hole : m_cutouts ) + { + board = BRepAlgoAPI_Cut( board, hole ); + + cur_count++; + char_count++; + + if( char_count < 80 ) + ReportMessage( "." ); + else + { + char_count = 0; + ReportMessage( wxString::Format( ". %d/%d\n", cur_count, cntmax ) ); + } + } + // push the board to the data structure + ReportMessage( "\nGenerate board full shape\n" ); m_pcb_label = m_assy->AddComponent( m_assy_label, board ); if( m_pcb_label.IsNull() ) @@ -1172,9 +1196,9 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source, scaled_shape = brep.Shape(); } else { std::ostringstream ostr; -#ifdef __WXDEBUG__ +#ifdef DEBUG ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ +#endif /* DEBUG */ ostr << " * failed to scale model\n"; wxLogMessage( "%s", ostr.str().c_str() ); scaled_shape = shape; @@ -1385,15 +1409,15 @@ bool OUTLINE::MakeShape( TopoDS_Shape& aShape, double aThickness ) } catch( const Standard_Failure& e ) { - ReportMessage( wxString::Format( "Exception caught: %s", e.GetMessageString() ) ); + ReportMessage( wxString::Format( "Exception caught: %s\n", e.GetMessageString() ) ); success = false; } if( !success ) { - ReportMessage( wxString::Format( "failed to add an edge: %d\n", - "last valid outline point: %f %f\n", - i.Describe(), lastPoint.x, lastPoint.y ) ); + ReportMessage( wxString::Format( + "failed to add an edge:\n%s\nlast valid outline point: %f %f\n", + i.Describe().c_str(), lastPoint.x, lastPoint.y ) ); return false; } } @@ -1445,10 +1469,8 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL break; default: - { - ReportMessage( wxString::Format( "unsupported curve type: %d\n", aCurve.m_form ) ); - return false; - } + ReportMessage( wxString::Format( "unsupported curve type: %d\n", aCurve.m_form ) ); + return false; } if( edge.IsNull() )