2012-03-17 17:30:03 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
|
2017-03-17 14:41:00 +00:00
|
|
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-03-17 17:30:03 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file pcbnew_scripting_helpers.cpp
|
|
|
|
* @brief Scripting helper functions for pcbnew functionality
|
|
|
|
*/
|
|
|
|
|
2012-04-20 21:20:56 +00:00
|
|
|
#include <Python.h>
|
2018-08-05 10:28:10 +00:00
|
|
|
#undef HAVE_CLOCK_GETTIME // macro is defined in Python.h and causes redefine warning
|
2012-03-17 17:30:03 +00:00
|
|
|
|
2019-12-05 14:03:15 +00:00
|
|
|
#include <action_plugin.h>
|
2012-03-17 15:17:13 +00:00
|
|
|
#include <class_board.h>
|
2020-09-29 15:30:04 +00:00
|
|
|
#include <class_marker_pcb.h>
|
2019-12-05 14:03:15 +00:00
|
|
|
#include <cstdlib>
|
2020-09-23 00:23:14 +00:00
|
|
|
#include <drc/drc_engine.h>
|
|
|
|
#include <drc/drc_item.h>
|
2020-06-05 22:21:41 +00:00
|
|
|
#include <fp_lib_table.h>
|
2012-03-17 15:17:13 +00:00
|
|
|
#include <io_mgr.h>
|
2019-12-05 14:03:15 +00:00
|
|
|
#include <kicad_string.h>
|
|
|
|
#include <pcbnew_scripting_helpers.h>
|
2020-06-05 22:21:41 +00:00
|
|
|
#include <project.h>
|
2020-05-31 21:42:04 +00:00
|
|
|
#include <settings/settings_manager.h>
|
2020-09-29 15:30:04 +00:00
|
|
|
#include <project/project_local_settings.h>
|
2020-05-31 21:42:04 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2012-03-17 15:17:13 +00:00
|
|
|
|
2017-08-27 06:04:12 +00:00
|
|
|
static PCB_EDIT_FRAME* s_PcbEditFrame = NULL;
|
2012-03-17 15:17:13 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
static SETTINGS_MANAGER* s_SettingsManager = nullptr;
|
|
|
|
|
2020-09-26 01:27:39 +00:00
|
|
|
/// A valid app is needed for preventing some asserts when opening the settings manager
|
|
|
|
static wxApp* s_WxApp = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
wxApp* GetApp()
|
|
|
|
{
|
|
|
|
if( !s_WxApp )
|
|
|
|
s_WxApp = new wxApp();
|
|
|
|
|
|
|
|
return s_WxApp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
BOARD* GetBoard()
|
2012-03-17 15:17:13 +00:00
|
|
|
{
|
2017-08-27 06:04:12 +00:00
|
|
|
if( s_PcbEditFrame )
|
|
|
|
return s_PcbEditFrame->GetBoard();
|
2013-03-15 16:35:24 +00:00
|
|
|
else
|
|
|
|
return NULL;
|
2012-03-17 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2017-08-27 06:04:12 +00:00
|
|
|
void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
|
2012-03-17 15:17:13 +00:00
|
|
|
{
|
2017-08-27 06:04:12 +00:00
|
|
|
s_PcbEditFrame = aPcbEditFrame;
|
2012-03-17 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2012-07-31 21:00:33 +00:00
|
|
|
BOARD* LoadBoard( wxString& aFileName )
|
2012-04-14 21:18:27 +00:00
|
|
|
{
|
2013-03-15 16:35:24 +00:00
|
|
|
if( aFileName.EndsWith( wxT( ".kicad_pcb" ) ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return LoadBoard( aFileName, IO_MGR::KICAD_SEXP );
|
2012-04-22 11:14:58 +00:00
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
else if( aFileName.EndsWith( wxT( ".brd" ) ) )
|
|
|
|
return LoadBoard( aFileName, IO_MGR::LEGACY );
|
2013-01-16 12:38:30 +00:00
|
|
|
|
2012-04-22 11:14:58 +00:00
|
|
|
// as fall back for any other kind use the legacy format
|
2013-03-15 16:35:24 +00:00
|
|
|
return LoadBoard( aFileName, IO_MGR::LEGACY );
|
2012-04-14 21:18:27 +00:00
|
|
|
}
|
2012-03-17 15:17:13 +00:00
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
SETTINGS_MANAGER* GetSettingsManager()
|
|
|
|
{
|
|
|
|
if( !s_SettingsManager )
|
2020-09-26 01:27:39 +00:00
|
|
|
{
|
|
|
|
// Ensure wx system settings stuff is available
|
|
|
|
GetApp();
|
2020-06-20 14:36:16 +00:00
|
|
|
s_SettingsManager = new SETTINGS_MANAGER( true );
|
2020-09-26 01:27:39 +00:00
|
|
|
}
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
return s_SettingsManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PROJECT* GetDefaultProject()
|
|
|
|
{
|
2020-06-20 14:36:16 +00:00
|
|
|
PROJECT* project = GetSettingsManager()->GetProject( "" );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-06-20 14:36:16 +00:00
|
|
|
if( !project )
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
|
|
|
GetSettingsManager()->LoadProject( "" );
|
|
|
|
project = GetSettingsManager()->GetProject( "" );
|
|
|
|
}
|
|
|
|
|
|
|
|
return project;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-31 21:00:33 +00:00
|
|
|
BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat )
|
2012-03-17 15:17:13 +00:00
|
|
|
{
|
2020-05-31 21:42:04 +00:00
|
|
|
wxFileName pro = aFileName;
|
|
|
|
pro.SetExt( ProjectFileExtension );
|
|
|
|
pro.MakeAbsolute();
|
|
|
|
wxString projectPath = pro.GetFullPath();
|
|
|
|
|
2020-06-20 14:36:16 +00:00
|
|
|
PROJECT* project = GetSettingsManager()->GetProject( projectPath );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-06-20 14:36:16 +00:00
|
|
|
if( !project )
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
2020-06-20 14:36:16 +00:00
|
|
|
GetSettingsManager()->LoadProject( projectPath );
|
2020-09-23 00:23:14 +00:00
|
|
|
project = GetSettingsManager()->GetProject( projectPath );
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Board cannot be loaded without a project, so create the default project
|
|
|
|
if( !project )
|
|
|
|
project = GetDefaultProject();
|
|
|
|
|
2017-08-17 15:55:05 +00:00
|
|
|
BOARD* brd = IO_MGR::Load( aFormat, aFileName );
|
|
|
|
|
|
|
|
if( brd )
|
2018-12-04 01:03:44 +00:00
|
|
|
{
|
2020-05-31 21:42:04 +00:00
|
|
|
brd->SetProject( project );
|
2020-09-29 11:33:44 +00:00
|
|
|
|
|
|
|
// Move legacy view settings to local project settings
|
|
|
|
if( !brd->m_LegacyVisibleLayers.test( Rescue ) )
|
2020-09-29 15:30:04 +00:00
|
|
|
project->GetLocalSettings().m_VisibleLayers = brd->m_LegacyVisibleLayers;
|
2020-09-29 11:33:44 +00:00
|
|
|
|
|
|
|
if( !brd->m_LegacyVisibleItems.test( GAL_LAYER_INDEX( GAL_LAYER_ID_BITMASK_END ) ) )
|
2020-09-29 15:30:04 +00:00
|
|
|
project->GetLocalSettings().m_VisibleItems = brd->m_LegacyVisibleItems;
|
2020-09-29 11:33:44 +00:00
|
|
|
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = brd->GetDesignSettings();
|
|
|
|
bds.m_DRCEngine = std::make_shared<DRC_ENGINE>( brd, &bds );
|
|
|
|
|
|
|
|
for( MARKER_PCB* marker : brd->ResolveDRCExclusions() )
|
|
|
|
brd->Add( marker );
|
|
|
|
|
2017-08-17 15:55:05 +00:00
|
|
|
brd->BuildConnectivity();
|
2018-12-04 01:03:44 +00:00
|
|
|
brd->BuildListOfNets();
|
|
|
|
brd->SynchronizeNetsAndNetClasses();
|
|
|
|
}
|
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
return brd;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOARD* CreateEmptyBoard()
|
|
|
|
{
|
|
|
|
BOARD* brd = new BOARD();
|
|
|
|
|
|
|
|
brd->SetProject( GetDefaultProject() );
|
2017-08-17 15:55:05 +00:00
|
|
|
|
|
|
|
return brd;
|
2012-03-17 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2017-06-23 17:22:27 +00:00
|
|
|
bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat )
|
2012-03-17 15:17:13 +00:00
|
|
|
{
|
2017-08-17 15:55:05 +00:00
|
|
|
aBoard->BuildConnectivity();
|
2013-03-15 16:35:24 +00:00
|
|
|
aBoard->SynchronizeNetsAndNetClasses();
|
2014-05-15 08:11:17 +00:00
|
|
|
aBoard->GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
|
2012-03-17 15:17:13 +00:00
|
|
|
|
2017-06-23 17:22:27 +00:00
|
|
|
IO_MGR::Save( aFormat, aFileName, aBoard, NULL );
|
2017-05-24 16:08:15 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
wxFileName pro = aFileName;
|
|
|
|
pro.SetExt( ProjectFileExtension );
|
|
|
|
pro.MakeAbsolute();
|
|
|
|
wxString projectPath = pro.GetFullPath();
|
|
|
|
|
|
|
|
GetSettingsManager()->SaveProject( pro.GetFullPath() );
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
return true;
|
2012-03-17 15:17:13 +00:00
|
|
|
}
|
2017-03-17 14:41:00 +00:00
|
|
|
|
|
|
|
|
2017-06-23 17:22:27 +00:00
|
|
|
bool SaveBoard( wxString& aFileName, BOARD* aBoard )
|
|
|
|
{
|
2017-10-03 10:23:52 +00:00
|
|
|
return SaveBoard( aFileName, aBoard, IO_MGR::KICAD_SEXP );
|
2017-06-23 17:22:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-06-05 22:21:41 +00:00
|
|
|
FP_LIB_TABLE* GetFootprintLibraryTable()
|
|
|
|
{
|
|
|
|
BOARD* board = GetBoard();
|
|
|
|
|
|
|
|
if( !board )
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
PROJECT* project = board->GetProject();
|
|
|
|
|
|
|
|
if( !project )
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return project->PcbFootprintLibs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxArrayString GetFootprintLibraries()
|
|
|
|
{
|
|
|
|
wxArrayString footprintLibraryNames;
|
|
|
|
|
|
|
|
FP_LIB_TABLE* tbl = GetFootprintLibraryTable();
|
|
|
|
|
|
|
|
if( !tbl )
|
|
|
|
return footprintLibraryNames;
|
|
|
|
|
|
|
|
for( const wxString& name : tbl->GetLogicalLibs() )
|
|
|
|
footprintLibraryNames.Add( name );
|
|
|
|
|
|
|
|
return footprintLibraryNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxArrayString GetFootprints( const wxString& aNickName )
|
|
|
|
{
|
|
|
|
wxArrayString footprintNames;
|
|
|
|
|
|
|
|
FP_LIB_TABLE* tbl = GetFootprintLibraryTable();
|
|
|
|
|
|
|
|
if( !tbl )
|
|
|
|
return footprintNames;
|
|
|
|
|
|
|
|
tbl->FootprintEnumerate( footprintNames, aNickName, true );
|
|
|
|
|
|
|
|
return footprintNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-15 22:54:47 +00:00
|
|
|
bool ExportSpecctraDSN( wxString& aFullFilename )
|
|
|
|
{
|
|
|
|
if( s_PcbEditFrame )
|
|
|
|
{
|
|
|
|
bool ok = s_PcbEditFrame->ExportSpecctraFile( aFullFilename );
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 11:17:50 +00:00
|
|
|
bool ExportVRML( const wxString& aFullFileName, double aMMtoWRMLunit,
|
|
|
|
bool aExport3DFiles, bool aUseRelativePaths,
|
|
|
|
bool aUsePlainPCB, const wxString& a3D_Subdir,
|
|
|
|
double aXRef, double aYRef )
|
|
|
|
{
|
|
|
|
if( s_PcbEditFrame )
|
|
|
|
{
|
|
|
|
bool ok = s_PcbEditFrame->ExportVRML_File( aFullFileName, aMMtoWRMLunit,
|
|
|
|
aExport3DFiles, aUseRelativePaths,
|
|
|
|
aUsePlainPCB, a3D_Subdir, aXRef, aYRef );
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2019-04-15 22:54:47 +00:00
|
|
|
|
|
|
|
bool ImportSpecctraSES( wxString& aFullFilename )
|
|
|
|
{
|
|
|
|
if( s_PcbEditFrame )
|
|
|
|
{
|
|
|
|
bool ok = s_PcbEditFrame->ImportSpecctraSession( aFullFilename );
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName, wxString* aLibPath )
|
|
|
|
{
|
|
|
|
if( s_PcbEditFrame )
|
|
|
|
{
|
|
|
|
s_PcbEditFrame->ArchiveModulesOnBoard( aStoreInNewLib, aLibName, aLibPath );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-17 14:41:00 +00:00
|
|
|
void Refresh()
|
|
|
|
{
|
2017-08-27 06:04:12 +00:00
|
|
|
if( s_PcbEditFrame )
|
|
|
|
{
|
2017-12-03 10:19:42 +00:00
|
|
|
auto board = s_PcbEditFrame->GetBoard();
|
|
|
|
board->BuildConnectivity();
|
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
// Re-init everything: this is the easy way to do that
|
2019-05-30 12:25:08 +00:00
|
|
|
s_PcbEditFrame->ActivateGalCanvas();
|
2019-06-13 17:28:55 +00:00
|
|
|
s_PcbEditFrame->GetCanvas()->Refresh();
|
2017-08-27 06:04:12 +00:00
|
|
|
}
|
2017-03-17 14:41:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-27 06:04:12 +00:00
|
|
|
void UpdateUserInterface()
|
|
|
|
{
|
|
|
|
if( s_PcbEditFrame )
|
|
|
|
s_PcbEditFrame->UpdateUserInterface();
|
2017-03-17 14:41:00 +00:00
|
|
|
}
|
2018-03-06 08:28:57 +00:00
|
|
|
|
|
|
|
|
2019-02-19 13:46:08 +00:00
|
|
|
int GetUserUnits()
|
|
|
|
{
|
|
|
|
if( s_PcbEditFrame )
|
2019-12-20 14:47:41 +00:00
|
|
|
return static_cast<int>( s_PcbEditFrame->GetUserUnits() );
|
2019-02-19 13:46:08 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-06 08:28:57 +00:00
|
|
|
bool IsActionRunning()
|
|
|
|
{
|
|
|
|
return ACTION_PLUGINS::IsActionRunning();
|
|
|
|
}
|
2020-09-23 00:23:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
|
|
|
|
bool aTestTracksAgainstZones, bool aReportAllTrackErrors )
|
|
|
|
{
|
|
|
|
wxCHECK( aBoard, false );
|
|
|
|
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
|
|
|
|
std::shared_ptr<DRC_ENGINE> engine = bds.m_DRCEngine;
|
|
|
|
|
|
|
|
if( !engine )
|
|
|
|
{
|
|
|
|
bds.m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard, &bds );
|
|
|
|
engine = bds.m_DRCEngine;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxCHECK( engine, false );
|
|
|
|
|
2020-09-26 01:20:54 +00:00
|
|
|
wxFileName fn = aBoard->GetFileName();
|
2020-09-25 01:26:23 +00:00
|
|
|
fn.SetExt( DesignRulesFileExtension );
|
|
|
|
wxString drcRulesPath = s_SettingsManager->Prj().AbsolutePath( fn.GetFullName() );
|
|
|
|
|
2020-09-23 00:23:14 +00:00
|
|
|
try
|
|
|
|
{
|
2020-09-25 01:26:23 +00:00
|
|
|
engine->InitEngine( drcRulesPath );
|
2020-09-23 00:23:14 +00:00
|
|
|
}
|
|
|
|
catch( PARSE_ERROR& pe )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::shared_ptr<DRC_ITEM>> footprints;
|
|
|
|
std::vector<std::shared_ptr<DRC_ITEM>> unconnected;
|
|
|
|
std::vector<std::shared_ptr<DRC_ITEM>> violations;
|
|
|
|
|
|
|
|
engine->SetProgressReporter( nullptr );
|
|
|
|
|
|
|
|
engine->SetViolationHandler(
|
|
|
|
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
|
|
|
|
{
|
|
|
|
if( aItem->GetErrorCode() == DRCE_MISSING_FOOTPRINT
|
|
|
|
|| aItem->GetErrorCode() == DRCE_DUPLICATE_FOOTPRINT
|
|
|
|
|| aItem->GetErrorCode() == DRCE_EXTRA_FOOTPRINT
|
|
|
|
|| aItem->GetErrorCode() == DRCE_NET_CONFLICT )
|
|
|
|
{
|
|
|
|
footprints.push_back( aItem );
|
|
|
|
}
|
|
|
|
else if( aItem->GetErrorCode() == DRCE_UNCONNECTED_ITEMS )
|
|
|
|
{
|
|
|
|
unconnected.push_back( aItem );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
violations.push_back( aItem );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
engine->RunTests( aUnits, aTestTracksAgainstZones, aReportAllTrackErrors, false );
|
|
|
|
engine->ClearViolationHandler();
|
|
|
|
|
|
|
|
// TODO: Unify this with DIALOG_DRC::writeReport
|
|
|
|
|
|
|
|
FILE* fp = wxFopen( aFileName, wxT( "w" ) );
|
|
|
|
|
|
|
|
if( fp == nullptr )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
std::map<KIID, EDA_ITEM*> itemMap;
|
|
|
|
aBoard->FillItemMap( itemMap );
|
|
|
|
|
|
|
|
fprintf( fp, "** Drc report for %s **\n", TO_UTF8( aBoard->GetFileName() ) );
|
|
|
|
|
|
|
|
wxDateTime now = wxDateTime::Now();
|
|
|
|
|
|
|
|
fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
|
|
|
|
|
|
|
|
fprintf( fp, "\n** Found %d DRC violations **\n", static_cast<int>( violations.size() ) );
|
|
|
|
|
|
|
|
for( const std::shared_ptr<DRC_ITEM>& item : violations )
|
|
|
|
{
|
|
|
|
SEVERITY severity = static_cast<SEVERITY>( bds.GetSeverity( item->GetErrorCode() ) );
|
|
|
|
fprintf( fp, "%s", TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf( fp, "\n** Found %d unconnected pads **\n", static_cast<int>( unconnected.size() ) );
|
|
|
|
|
|
|
|
for( const std::shared_ptr<DRC_ITEM>& item : unconnected )
|
|
|
|
{
|
|
|
|
SEVERITY severity = static_cast<SEVERITY>( bds.GetSeverity( item->GetErrorCode() ) );
|
|
|
|
fprintf( fp, "%s", TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf( fp, "\n** Found %d Footprint errors **\n", static_cast<int>( footprints.size() ) );
|
|
|
|
|
|
|
|
for( const std::shared_ptr<DRC_ITEM>& item : footprints )
|
|
|
|
{
|
|
|
|
SEVERITY severity = static_cast<SEVERITY>( bds.GetSeverity( item->GetErrorCode() ) );
|
|
|
|
fprintf( fp, "%s", TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf( fp, "\n** End of Report **\n" );
|
|
|
|
fclose( fp );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|