Drc dialog: make track to copper zones test optional, because it can be really very time consuming

This commit is contained in:
jean-pierre charras 2019-03-19 17:46:46 +01:00
parent aa5a2225e7
commit b1c5afd72f
7 changed files with 882 additions and 1413 deletions

View File

@ -51,7 +51,8 @@
*/
// Keywords for read and write config
#define RefillZonesBeforeDrc wxT( "RefillZonesBeforeDrc" )
#define RefillZonesBeforeDrcKey wxT( "RefillZonesBeforeDrc" )
#define DrcTrackToZoneTestKey wxT( "DrcTrackToZoneTest" )
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame,
@ -100,7 +101,8 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra
DIALOG_DRC_CONTROL::~DIALOG_DRC_CONTROL()
{
m_config->Write( RefillZonesBeforeDrc, m_cbRefillZones->GetValue() );
m_config->Write( RefillZonesBeforeDrcKey, m_cbRefillZones->GetValue() );
m_config->Write( DrcTrackToZoneTestKey, m_cbReportTracksToZonesErrors->GetValue() );
// Disconnect events
m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
@ -154,8 +156,10 @@ void DIALOG_DRC_CONTROL::InitValues()
// read options
bool value;
m_config->Read( RefillZonesBeforeDrc, &value, false );
m_config->Read( RefillZonesBeforeDrcKey, &value, false );
m_cbRefillZones->SetValue( value );
m_config->Read( DrcTrackToZoneTestKey, &value, false );
m_cbReportTracksToZonesErrors->SetValue( value );
Layout(); // adding the units above expanded Clearance text, now resize.
@ -211,7 +215,8 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
SetDrcParmeters();
m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pads DRC test enabled
true, // DRC test for zones enabled
// DRC test for zones enabled/disabled:
m_cbReportTracksToZonesErrors->GetValue(),
true, // DRC test for keepout areas enabled
m_cbRefillZones->GetValue(),
m_cbReportAllTrackErrors->GetValue(),

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -103,6 +103,11 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
bSizerOptSettings->Add( m_cbReportAllTrackErrors, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbReportTracksToZonesErrors = new wxCheckBox( this, wxID_ANY, _("Test tracks against filled copper areas (very slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbReportTracksToZonesErrors->SetToolTip( _("If selected, tracks will be tested against copper zones. \nIf copper zones are up to date, this test should be not needed.\n\nThis test can be *very slow* for complicated designs.") );
bSizerOptSettings->Add( m_cbReportTracksToZonesErrors, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerOptions->Add( bSizerOptSettings, 1, wxEXPAND, 5 );
@ -141,7 +146,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
fgSizerRpt->Add( m_RptFilenameCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
m_BrowseButton = new wxBitmapButton( this, ID_BUTTON_BROWSE_RPT_FILE, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_BrowseButton = new wxBitmapButton( this, ID_BUTTON_BROWSE_RPT_FILE, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_BrowseButton->SetMinSize( wxSize( 30,28 ) );
fgSizerRpt->Add( m_BrowseButton, 0, wxALIGN_CENTER_VERTICAL, 2 );

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_DRC_BASE_H__
#define __DIALOG_DRC_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -23,10 +22,10 @@ class DRCLISTBOX;
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/gbsizer.h>
#include <wx/listbox.h>
@ -60,6 +59,7 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
wxStaticText* m_MicroViaMinUnit;
wxCheckBox* m_cbRefillZones;
wxCheckBox* m_cbReportAllTrackErrors;
wxCheckBox* m_cbReportTracksToZonesErrors;
wxStaticText* m_messagesLabel;
wxTextCtrl* m_Messages;
wxCheckBox* m_CreateRptCtrl;
@ -107,4 +107,3 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
};
#endif //__DIALOG_DRC_BASE_H__

View File

@ -140,7 +140,7 @@ DRC::DRC( PCB_EDIT_FRAME* aPcbWindow )
m_drcInLegacyRoutingMode = false;
m_doPad2PadTest = true; // enable pad to pad clearance tests
m_doUnconnectedTest = true; // enable unconnected tests
m_doZonesTest = true; // enable zone to items clearance tests
m_doZonesTest = false; // disable zone to items clearance tests
m_doKeepoutTest = true; // enable keepout areas to items clearance tests
m_refillZones = false; // Only fill zones if requested by user.
m_reportAllTrackErrors = false;
@ -180,7 +180,8 @@ int DRC::DrcOnCreatingTrack( TRACK* aRefSegm, TRACK* aList )
int rpt_state = m_reportAllTrackErrors;
m_reportAllTrackErrors = false;
if( !doTrackDrc( aRefSegm, aList, true ) )
// Test new segment against tracks and pads, not against copper zones
if( !doTrackDrc( aRefSegm, aList, true, false ) )
{
if( m_currentMarker )
{
@ -843,7 +844,8 @@ void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar )
}
}
if( !doTrackDrc( segm, segm->Next(), true ) )
// Test new segment against tracks and pads, optionally against copper zones
if( !doTrackDrc( segm, segm->Next(), true, m_doZonesTest ) )
{
if( m_currentMarker )
{

View File

@ -180,13 +180,14 @@ class DRC
private:
// protected or private functions() are lowercase first character.
bool m_doPad2PadTest;
bool m_doUnconnectedTest;
bool m_doZonesTest;
bool m_doKeepoutTest;
bool m_doCreateRptFile;
bool m_refillZones;
bool m_reportAllTrackErrors;
bool m_doPad2PadTest; // enable pad to pad clearance tests
bool m_doUnconnectedTest; // enable unconnected tests
bool m_doZonesTest; // enable zone to items clearance tests
bool m_doKeepoutTest; // enable keepout areas to items clearance tests
bool m_doCreateRptFile; // enable creating a report file
bool m_refillZones; // refill zones if requested (by user).
bool m_reportAllTrackErrors; // Report all tracks errors (or only 4 first errors)
bool m_do;
wxString m_rptFilename;
@ -313,11 +314,13 @@ private:
*
* @param aRefSeg The segment to test
* @param aStart the first item of track list to test against (usually BOARD::m_Track)
* @param doPads true if should do pads test
* @param aTestPads true if should do pads test
* @param aTestZones true if should do copper zones test. This can be very time consumming
* @return bool - true if no problems, else false and m_currentMarker is
* filled in with the problem information.
*/
bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool doPads = true );
bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart,
bool aTestPads, bool aTestZones );
/**
* Test the current segment or via.

View File

@ -135,7 +135,7 @@ bool convex2pointDRC( wxPoint* aTref, int aTrefCount, wxPoint aPcompare, int aDi
}
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool aTestPads, bool aTestZones )
{
TRACK* track;
wxPoint delta; // length on X and Y axis of segments
@ -354,7 +354,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
dummypad.SetLayerSet( LSET::AllCuMask() ); // Ensure the hole is on all layers
// Compute the min distance to pads
if( testPads )
if( aTestPads )
{
unsigned pad_count = m_pcb->GetPadCount();
@ -704,10 +704,12 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
}
}
/***********************************************/
/* Phase 3: test DRC with zones */
/***********************************************/
/***************************************/
/* Phase 3: test DRC with copper zones */
/***************************************/
// Can be *very* time consumming.
if( aTestZones )
{
SEG refSeg( aRefSeg->GetStart(), aRefSeg->GetEnd() );
for( ZONE_CONTAINER* zone : m_pcb->Zones() )
@ -727,6 +729,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( outline->Distance( refSeg, aRefSeg->GetWidth() ) < clearance )
addMarkerToPcb( m_markerFactory.NewMarker( aRefSeg, zone, DRCE_TRACK_NEAR_ZONE ) );
}
}
/***********************************************/
/* Phase 4: test DRC with to board edge */