CHANGED: Design rules files now use .kicad_dru extension
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5763 Fixes https://gitlab.com/kicad/code/kicad/-/issues/5444
This commit is contained in:
parent
0c5aabc7f7
commit
0783669633
|
@ -165,6 +165,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
|
|||
wxT( "*.cmp" ),
|
||||
wxT( "*.brd" ), wxT( "*.kicad_pcb" ), // Brd files
|
||||
wxT( "*.mod" ), wxT( "*.kicad_mod" ), // fp files
|
||||
wxT( "*.kicad_dru" ),
|
||||
wxT( "*.gb?" ), wxT( "*.gbrjob" ), // Gerber files
|
||||
wxT( "*.gko" ), wxT( "*.gm1" ),
|
||||
wxT( "*.gm2" ), wxT( "*.g?" ),
|
||||
|
|
|
@ -140,6 +140,7 @@ const std::string ArchiveFileExtension( "zip" );
|
|||
const std::string LegacyPcbFileExtension( "brd" );
|
||||
const std::string KiCadPcbFileExtension( "kicad_pcb" );
|
||||
const std::string PageLayoutDescrFileExtension( "kicad_wks" );
|
||||
const std::string DesignRulesFileExtension( "kicad_dru" );
|
||||
|
||||
const std::string PdfFileExtension( "pdf" );
|
||||
const std::string MacrosFileExtension( "mcr" );
|
||||
|
|
|
@ -132,6 +132,7 @@ extern const std::string KiCadPcbFileExtension;
|
|||
#define PcbFileExtension KiCadPcbFileExtension // symlink choice
|
||||
extern const std::string KiCadSymbolLibFileExtension;
|
||||
extern const std::string PageLayoutDescrFileExtension;
|
||||
extern const std::string DesignRulesFileExtension;
|
||||
|
||||
extern const std::string LegacyFootprintLibPathExtension;
|
||||
extern const std::string PdfFileExtension;
|
||||
|
|
|
@ -70,6 +70,7 @@ static const wxChar* s_allowedExtensionsToList[] = {
|
|||
wxT( "^.*\\.kicad_sch$" ), // S-expr Eeschema files
|
||||
wxT( "^[^$].*\\.brd$" ), // Legacy Pcbnew files
|
||||
wxT( "^[^$].*\\.kicad_pcb$" ), // S format Pcbnew board files
|
||||
wxT( "^[^$].*\\.kicad_dru$" ), // Design rule files
|
||||
wxT( "^[^$].*\\.kicad_wks$" ), // S format kicad page layout help_textr files
|
||||
wxT( "^[^$].*\\.kicad_mod$" ), // S format kicad footprint files, currently not listed
|
||||
wxT( "^.*\\.net$" ), // pcbnew netlist file
|
||||
|
|
|
@ -210,7 +210,7 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
|||
// and that they at least parse.
|
||||
try
|
||||
{
|
||||
drcTool->GetDRCEngine()->InitEngine( m_parentFrame->Prj().AbsolutePath( "drc-rules" ) );
|
||||
drcTool->GetDRCEngine()->InitEngine( m_brdEditor->GetDesignRulesPath() );
|
||||
}
|
||||
catch( PARSE_ERROR& pe )
|
||||
{
|
||||
|
|
|
@ -331,8 +331,7 @@ void PANEL_SETUP_RULES::OnErrorLinkClicked( wxHtmlLinkEvent& event )
|
|||
|
||||
bool PANEL_SETUP_RULES::TransferDataToWindow()
|
||||
{
|
||||
wxString rulesFilepath = m_frame->Prj().AbsolutePath( "drc-rules" );
|
||||
wxFileName rulesFile( rulesFilepath );
|
||||
wxFileName rulesFile( m_frame->GetDesignRulesPath() );
|
||||
|
||||
if( rulesFile.FileExists() )
|
||||
{
|
||||
|
@ -373,7 +372,7 @@ bool PANEL_SETUP_RULES::TransferDataFromWindow()
|
|||
return false;
|
||||
}
|
||||
|
||||
wxString rulesFilepath = m_frame->Prj().AbsolutePath( "drc-rules" );
|
||||
wxString rulesFilepath = m_frame->GetDesignRulesPath();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <layer_widget.h>
|
||||
#include <class_dimension.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
|
||||
PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
FRAME_T aFrameType, const wxString& aTitle,
|
||||
|
@ -131,19 +133,6 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
if( new_board )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
|
||||
bds.m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard, &bds );
|
||||
|
||||
try
|
||||
{
|
||||
bds.m_DRCEngine->InitEngine( Prj().AbsolutePath( "drc-rules" ) );
|
||||
}
|
||||
catch( PARSE_ERROR& pe )
|
||||
{
|
||||
// TODO: We could redirect to Board Setup here and report the error. Or we could
|
||||
// wait till they run DRC or do an Inspect Clearance. Not sure which is better....
|
||||
}
|
||||
|
||||
if( m_toolManager )
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
|
||||
|
@ -153,6 +142,22 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
PCB_BASE_FRAME::SetBoard( aBoard );
|
||||
|
||||
if( new_board )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
|
||||
bds.m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard, &bds );
|
||||
|
||||
try
|
||||
{
|
||||
bds.m_DRCEngine->InitEngine( GetDesignRulesPath() );
|
||||
}
|
||||
catch( PARSE_ERROR& pe )
|
||||
{
|
||||
// TODO: We could redirect to Board Setup here and report the error. Or we could
|
||||
// wait till they run DRC or do an Inspect Clearance. Not sure which is better....
|
||||
}
|
||||
}
|
||||
|
||||
GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetDesignSettings().m_GridOrigin ) );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
|
@ -217,3 +222,12 @@ COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::GetColorSettings()
|
|||
}
|
||||
|
||||
|
||||
wxString PCB_BASE_EDIT_FRAME::GetDesignRulesPath()
|
||||
{
|
||||
if( !GetBoard() )
|
||||
return wxEmptyString;
|
||||
|
||||
wxFileName fn = GetBoard()->GetFileName();
|
||||
fn.SetExt( DesignRulesFileExtension );
|
||||
return Prj().AbsolutePath( fn.GetFullName() );
|
||||
}
|
||||
|
|
|
@ -212,6 +212,13 @@ public:
|
|||
*/
|
||||
void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
|
||||
|
||||
/**
|
||||
* Returns the absolute path to the design rules file for the currently-loaded board.
|
||||
* Note that there is no guarantee that this file actually exists and can be opened!
|
||||
* NOTE: only really makes sense from PcbNew, but is needed in PCB_BASE_EDIT_FRAME::SetBoard
|
||||
*/
|
||||
wxString GetDesignRulesPath();
|
||||
|
||||
protected:
|
||||
/// User defined rotation angle (in tenths of a degree).
|
||||
int m_rotationAngle;
|
||||
|
|
|
@ -323,9 +323,13 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
|
|||
|
||||
wxCHECK( engine, false );
|
||||
|
||||
wxFileName fn = GetBoard()->GetFileName();
|
||||
fn.SetExt( DesignRulesFileExtension );
|
||||
wxString drcRulesPath = s_SettingsManager->Prj().AbsolutePath( fn.GetFullName() );
|
||||
|
||||
try
|
||||
{
|
||||
engine->InitEngine( s_SettingsManager->Prj().AbsolutePath( "drc-rules" ) );
|
||||
engine->InitEngine( drcRulesPath );
|
||||
}
|
||||
catch( PARSE_ERROR& pe )
|
||||
{
|
||||
|
|
|
@ -191,7 +191,7 @@ void PCB_INSPECTION_TOOL::reportCopperClearance( PCB_LAYER_ID aLayer, BOARD_CONN
|
|||
|
||||
try
|
||||
{
|
||||
drcEngine.InitEngine( m_frame->Prj().AbsolutePath( "drc-rules" ) );
|
||||
drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
|
||||
}
|
||||
catch( PARSE_ERROR& pe )
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
|
|||
|
||||
try
|
||||
{
|
||||
drcEngine.InitEngine( m_frame->Prj().AbsolutePath( "drc-rules" ) );
|
||||
drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
|
||||
}
|
||||
catch( PARSE_ERROR& pe )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue