Make sure DRC reports a missing board outline.

Fixes https://gitlab.com/kicad/code/kicad/issues/6481
This commit is contained in:
Jeff Young 2020-11-24 14:22:05 +00:00
parent 44850e9409
commit 2f3f4c209e
4 changed files with 25 additions and 18 deletions

View File

@ -480,8 +480,8 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
if( !success && aErrorMsg ) if( !success && aErrorMsg )
{ {
*aErrorMsg = _( "Footprint outline is malformed. Run Footprint Checker for a " *aErrorMsg = _( "Footprint outline is missing or malformed. Run Footprint Checker for "
"full analysis." ); "a full analysis." );
} }
} }
else else
@ -489,7 +489,7 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
success = m_board->GetBoardPolygonOutlines( m_board_poly ); success = m_board->GetBoardPolygonOutlines( m_board_poly );
if( !success && aErrorMsg ) if( !success && aErrorMsg )
*aErrorMsg = _( "Board outline is malformed. Run DRC for a full analysis." ); *aErrorMsg = _( "Board outline is missing or malformed. Run DRC for a full analysis." );
} }
return success; return success;

View File

@ -1842,7 +1842,8 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE* aCurr
} }
bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, OUTLINE_ERROR_HANDLER* aErrorHandler ) bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines,
OUTLINE_ERROR_HANDLER* aErrorHandler )
{ {
bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError, bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
aErrorHandler ); aErrorHandler );

View File

@ -36,8 +36,6 @@
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <project/project_file.h> // LAST_PATH_TYPE #include <project/project_file.h> // LAST_PATH_TYPE
#include <widgets/text_ctrl_eval.h> #include <widgets/text_ctrl_eval.h>
#include <wx_html_report_panel.h>
#include <convert_drawsegment_list_to_polygon.h>
class DIALOG_EXPORT_STEP: public DIALOG_EXPORT_STEP_BASE class DIALOG_EXPORT_STEP: public DIALOG_EXPORT_STEP_BASE
@ -245,9 +243,10 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
wxString msg; wxString msg;
// Check if the board outline is continuous // Check if the board outline is continuous
if( !BuildBoardPolygonOutlines( m_parent->GetBoard(), outline, Millimeter2iu( 0.01 ) ) ) if( !m_parent->GetBoard()->GetBoardPolygonOutlines( outline ) )
{ {
DisplayErrorMessage( this, _( "Board outline is malformed. Run DRC for a full analysis." ) ); DisplayErrorMessage( this, _( "Board outline is missing or malformed. "
"Run DRC for a full analysis." ) );
return; return;
} }

View File

@ -80,6 +80,9 @@ private:
void DRC_TEST_PROVIDER_MISC::testOutline() void DRC_TEST_PROVIDER_MISC::testOutline()
{ {
SHAPE_POLY_SET boardOutlines;
bool errorHandled = false;
OUTLINE_ERROR_HANDLER errorHandler = OUTLINE_ERROR_HANDLER errorHandler =
[&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const wxPoint& pt ) [&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const wxPoint& pt )
{ {
@ -89,22 +92,26 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
drcItem->SetItems( itemA, itemB ); drcItem->SetItems( itemA, itemB );
reportViolation( drcItem, pt ); reportViolation( drcItem, pt );
errorHandled = true;
}; };
SHAPE_POLY_SET boardOutlines; if( !m_board->GetBoardPolygonOutlines( boardOutlines, &errorHandler ) )
m_board->GetBoardPolygonOutlines( boardOutlines, &errorHandler );
if( boardOutlines.IsEmpty() )
{ {
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE ); if( errorHandled )
{
// if there is an invalid outline, then there must be an outline
}
else
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
m_msg.Printf( _( "(no edges found on Edge.Cuts layer)" ) ); m_msg.Printf( _( "(no edges found on Edge.Cuts layer)" ) );
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg ); drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
drcItem->SetItems( m_board ); drcItem->SetItems( m_board );
reportViolation( drcItem, m_board->GetBoundingBox().Centre() ); reportViolation( drcItem, m_board->GetBoundingBox().Centre() );
}
} }
} }