Move ALTIUM_PCB to use REPORTER for logging
Change not-yet-supported messages to debug level
This commit is contained in:
parent
339cf3f2e2
commit
e973c15087
|
@ -44,6 +44,7 @@
|
|||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <font/outline_font.h>
|
||||
#include <project.h>
|
||||
#include <reporter.h>
|
||||
#include <trigo.h>
|
||||
#include <utf.h>
|
||||
#include <wx/docview.h>
|
||||
|
@ -262,11 +263,12 @@ std::vector<PCB_LAYER_ID> ALTIUM_PCB::GetKicadLayersToIterate( ALTIUM_LAYER aAlt
|
|||
}
|
||||
|
||||
|
||||
ALTIUM_PCB::ALTIUM_PCB( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter,
|
||||
ALTIUM_PCB::ALTIUM_PCB( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter, REPORTER* aReporter,
|
||||
const wxString& aLibrary, const wxString& aFootprintName )
|
||||
{
|
||||
m_board = aBoard;
|
||||
m_progressReporter = aProgressReporter;
|
||||
m_reporter = aReporter;
|
||||
m_doneCount = 0;
|
||||
m_lastProgressCount = 0;
|
||||
m_totalCount = 0;
|
||||
|
@ -440,7 +442,13 @@ void ALTIUM_PCB::Parse( const ALTIUM_COMPOUND_FILE& altiumPcbFi
|
|||
|
||||
if( reader.HasParsingError() )
|
||||
{
|
||||
wxLogError( _( "'%s' was not parsed correctly." ), FormatPath( mappedFile ) );
|
||||
if( m_reporter )
|
||||
{
|
||||
m_reporter->Report( wxString::Format( _( "'%s' was not parsed correctly." ),
|
||||
FormatPath( mappedFile ) ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -448,7 +456,13 @@ void ALTIUM_PCB::Parse( const ALTIUM_COMPOUND_FILE& altiumPcbFi
|
|||
|
||||
if( reader.GetRemainingBytes() != 0 )
|
||||
{
|
||||
wxLogError( _( "'%s' was not fully parsed." ), FormatPath( mappedFile ) );
|
||||
if( m_reporter )
|
||||
{
|
||||
m_reporter->Report( wxString::Format( _( "'%s' was not fully parsed." ),
|
||||
FormatPath( mappedFile ) ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -503,8 +517,13 @@ void ALTIUM_PCB::Parse( const ALTIUM_COMPOUND_FILE& altiumPcbFi
|
|||
}
|
||||
else if( isRequired )
|
||||
{
|
||||
wxLogError( _( "File not found: '%s' for directory '%s'." ), FormatPath( mappedFile ),
|
||||
magic_enum::enum_name( directory ) );
|
||||
if( m_reporter )
|
||||
{
|
||||
m_reporter->Report( wxString::Format( _( "File not found: '%s' for directory '%s'." ),
|
||||
FormatPath( mappedFile ),
|
||||
magic_enum::enum_name( directory ) ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -687,7 +706,13 @@ FOOTPRINT* ALTIUM_PCB::ParseFootprint( ALTIUM_COMPOUND_FILE& altiumLibFile,
|
|||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "File not found: '%s'." ), FormatPath( parametersStreamName ) );
|
||||
if( m_reporter )
|
||||
{
|
||||
m_reporter->Report( wxString::Format( _( "File not found: '%s'." ),
|
||||
FormatPath( parametersStreamName ) ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
footprint->SetLibDescription( wxT( "" ) );
|
||||
}
|
||||
|
||||
|
@ -858,6 +883,7 @@ void ALTIUM_PCB::ParseFileHeader( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile
|
|||
// THROW_IO_ERROR( "FileHeader stream is not fully parsed" );
|
||||
}
|
||||
|
||||
|
||||
void ALTIUM_PCB::ParseExtendedPrimitiveInformationData( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile,
|
||||
const CFB::COMPOUND_FILE_ENTRY* aEntry )
|
||||
{
|
||||
|
@ -879,6 +905,7 @@ void ALTIUM_PCB::ParseExtendedPrimitiveInformationData( const ALTIUM_COMPOUND_FI
|
|||
THROW_IO_ERROR( wxT( "ExtendedPrimitiveInformation stream is not fully parsed" ) );
|
||||
}
|
||||
|
||||
|
||||
void ALTIUM_PCB::ParseBoard6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile,
|
||||
const CFB::COMPOUND_FILE_ENTRY* aEntry )
|
||||
{
|
||||
|
@ -1021,6 +1048,7 @@ void ALTIUM_PCB::ParseBoard6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile
|
|||
HelperCreateBoardOutline( elem.board_vertices );
|
||||
}
|
||||
|
||||
|
||||
void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector<ALTIUM_VERTICE>& aVertices )
|
||||
{
|
||||
SHAPE_LINE_CHAIN lineChain;
|
||||
|
@ -1061,6 +1089,7 @@ void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector<ALTIUM_VERTICE>& aV
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void ALTIUM_PCB::ParseClasses6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile,
|
||||
const CFB::COMPOUND_FILE_ENTRY* aEntry )
|
||||
{
|
||||
|
@ -1091,8 +1120,13 @@ void ALTIUM_PCB::ParseClasses6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFi
|
|||
{
|
||||
// Name conflict, happens in some unknown circumstances
|
||||
// unique_ptr will delete nc on this code path
|
||||
wxLogWarning( _( "More than one Altium netclass with name '%s' found. "
|
||||
"Only the first one will be imported." ), elem.name );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "More than one Altium netclass with name '%s' found. "
|
||||
"Only the first one will be imported." ), elem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1107,6 +1141,7 @@ void ALTIUM_PCB::ParseClasses6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFi
|
|||
m_board->m_LegacyNetclassesLoaded = true;
|
||||
}
|
||||
|
||||
|
||||
void ALTIUM_PCB::ParseComponents6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile,
|
||||
const CFB::COMPOUND_FILE_ENTRY* aEntry )
|
||||
{
|
||||
|
@ -1200,9 +1235,14 @@ void ALTIUM_PCB::ParseComponentsBodies6Data( const ALTIUM_COMPOUND_FILE& aAl
|
|||
|
||||
if( modelTuple == m_models.end() )
|
||||
{
|
||||
wxLogError( wxT( "ComponentsBodies6 stream tries to access model id %s which does not "
|
||||
"exist" ),
|
||||
elem.modelId );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "ComponentsBodies6 stream tries to access model id %s which does "
|
||||
"not exist" ), elem.modelId );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1396,7 +1436,12 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem)
|
|||
|
||||
if( aElem.textPoint.empty() )
|
||||
{
|
||||
wxLogError( wxT( "No text position present for leader dimension object" ) );
|
||||
if( m_reporter )
|
||||
{
|
||||
m_reporter->Report( wxT( "No text position present for leader dimension object" ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1432,9 +1477,14 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
|
|||
|
||||
if( klayer == UNDEFINED_LAYER )
|
||||
{
|
||||
wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ),
|
||||
aElem.layer );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ), aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
|
@ -1500,7 +1550,12 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
|
|||
|
||||
if( aElem.textPoint.empty() )
|
||||
{
|
||||
wxLogError( wxT( "No text position present for leader dimension object" ) );
|
||||
if( m_reporter )
|
||||
{
|
||||
m_reporter->Report( wxT( "No text position present for leader dimension object" ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1524,9 +1579,14 @@ void ALTIUM_PCB::HelperParseDimensions6Datum( const ADIMENSION6& aElem )
|
|||
|
||||
if( klayer == UNDEFINED_LAYER )
|
||||
{
|
||||
wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ),
|
||||
aElem.layer );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ), aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
|
||||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
|
@ -1550,9 +1610,14 @@ void ALTIUM_PCB::HelperParseDimensions6Center( const ADIMENSION6& aElem )
|
|||
|
||||
if( klayer == UNDEFINED_LAYER )
|
||||
{
|
||||
wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ),
|
||||
aElem.layer );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ), aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
|
||||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
|
@ -1595,14 +1660,24 @@ void ALTIUM_PCB::ParseDimensions6Data( const ALTIUM_COMPOUND_FILE& aAltiumPc
|
|||
HelperParseDimensions6Leader( elem );
|
||||
break;
|
||||
case ALTIUM_DIMENSION_KIND::DATUM:
|
||||
wxLogError( _( "Ignored dimension of kind %d (not yet supported)." ), elem.kind );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Ignored dimension of kind %d (not yet supported)." ), elem.kind );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
// HelperParseDimensions6Datum( elem );
|
||||
break;
|
||||
case ALTIUM_DIMENSION_KIND::CENTER:
|
||||
HelperParseDimensions6Center( elem );
|
||||
break;
|
||||
default:
|
||||
wxLogError( _( "Ignored dimension of kind %d (not yet supported)." ), elem.kind );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Ignored dimension of kind %d (not yet supported)." ), elem.kind );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1642,9 +1717,15 @@ void ALTIUM_PCB::ParseModelsData( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile
|
|||
{
|
||||
if( !altiumModelsPath.Mkdir() )
|
||||
{
|
||||
wxLogError( _( "Failed to create folder '%s'." ) + wxS( " " )
|
||||
+ _( "No 3D-models will be imported." ),
|
||||
altiumModelsPath.GetFullPath() );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Failed to create folder '%s'." ) + wxS( " " )
|
||||
+ _( "No 3D-models will be imported." ),
|
||||
altiumModelsPath.GetFullPath() );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1672,8 +1753,14 @@ void ALTIUM_PCB::ParseModelsData( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile
|
|||
|
||||
if( stepEntry == nullptr )
|
||||
{
|
||||
wxLogError( _( "File not found: '%s'. 3D-model not imported." ),
|
||||
FormatPath( stepPath ) );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File not found: '%s'. 3D-model not imported." ),
|
||||
FormatPath( stepPath ) );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1686,8 +1773,14 @@ void ALTIUM_PCB::ParseModelsData( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile
|
|||
|
||||
if( !storagePath.IsDirWritable() )
|
||||
{
|
||||
wxLogError( _( "Insufficient permissions to save file '%s'." ),
|
||||
storagePath.GetFullPath() );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Insufficient permissions to save file '%s'." ),
|
||||
storagePath.GetFullPath() );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1698,7 +1791,13 @@ void ALTIUM_PCB::ParseModelsData( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile
|
|||
|
||||
if( !outputStream.IsOk() )
|
||||
{
|
||||
wxLogError( _( "Unable to write file '%s'." ), storagePath.GetFullPath() );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Unable to write file '%s'." ), storagePath.GetFullPath() );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1722,6 +1821,7 @@ void ALTIUM_PCB::ParseNets6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile,
|
|||
ALTIUM_BINARY_PARSER reader( aAltiumPcbFile, aEntry );
|
||||
|
||||
wxASSERT( m_altiumToKicadNetcodes.empty() );
|
||||
|
||||
while( reader.GetRemainingBytes() >= 4 /* TODO: use Header section of file */ )
|
||||
{
|
||||
checkpoint();
|
||||
|
@ -2058,10 +2158,14 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem )
|
|||
|
||||
if( klayer == UNDEFINED_LAYER )
|
||||
{
|
||||
wxLogWarning(
|
||||
_( "Dashed outline found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ),
|
||||
aElem.layer );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Dashed outline found on an Altium layer (%d) with no KiCad equivalent. "
|
||||
"It has been moved to KiCad layer Eco1_User." ), aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
|
@ -2100,7 +2204,12 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem )
|
|||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Ignored polygon shape of kind %d (not yet supported)." ), aElem.kind );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Ignored polygon shape of kind %d (not yet supported)." ), aElem.kind );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2172,19 +2281,29 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot
|
|||
{
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogWarning( _( "Loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Loading library '%s':\n"
|
||||
"Footprint %s contains a dashed outline on Altium layer (%d) with "
|
||||
"no KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogWarning( _( "Footprint %s contains a dashed outline on Altium layer (%d) with "
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s contains a dashed outline on Altium layer (%d) with "
|
||||
"no KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
klayer = Eco1_User;
|
||||
|
@ -2219,17 +2338,27 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot
|
|||
{
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogError( _( "Error loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading library '%s':\n"
|
||||
"Footprint %s contains polygon shape of kind %d (not yet supported)." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.kind );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Footprint %s contains polygon shape of kind %d (not yet supported)." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s contains polygon shape of kind %d (not yet supported)." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.kind );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2787,17 +2916,27 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
// TODO: I assume other values are possible as well?
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogError( _( "Error loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading library '%s':\n"
|
||||
"Footprint %s pad %s is not marked as multilayer, but is a TH pad." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Footprint %s pad %s is not marked as multilayer, but is a TH pad." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s pad %s is not marked as multilayer, but is a TH pad." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2819,17 +2958,27 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
case ALTIUM_PAD_HOLE_SHAPE::SQUARE:
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogWarning( _( "Loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Loading library '%s':\n"
|
||||
"Footprint %s pad %s has a square hole (not yet supported)." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogWarning( _( "Footprint %s pad %s has a square hole (not yet supported)." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s pad %s has a square hole (not yet supported)." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
|
||||
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
|
||||
|
@ -2857,21 +3006,31 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
{
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogWarning( _( "Loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Loading library '%s':\n"
|
||||
"Footprint %s pad %s has a hole-rotation of %f degrees. "
|
||||
"KiCad only supports 90 degree rotations." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.name,
|
||||
slotRotation.AsDegrees() );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f degrees. "
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s pad %s has a hole-rotation of %f degrees. "
|
||||
"KiCad only supports 90 degree rotations." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.name,
|
||||
slotRotation.AsDegrees() );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2882,19 +3041,29 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
case ALTIUM_PAD_HOLE_SHAPE::UNKNOWN:
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogError( _( "Error loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading library '%s':\n"
|
||||
"Footprint %s pad %s uses a hole of unknown kind %d." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.name,
|
||||
aElem.sizeAndShape->holeshape );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Footprint %s pad %s uses a hole of unknown kind %d." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s pad %s uses a hole of unknown kind %d." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.name,
|
||||
aElem.sizeAndShape->holeshape );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
|
||||
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
|
||||
|
@ -2911,17 +3080,27 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
{
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogError( _( "Error loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading library '%s':\n"
|
||||
"Footprint %s pad %s uses a complex pad stack (not yet supported)." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Footprint %s pad %s uses a complex pad stack (not yet supported)." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s pad %s uses a complex pad stack (not yet supported)." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2960,17 +3139,27 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
default:
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogError( _( "Error loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading library '%s':\n"
|
||||
"Footprint %s pad %s uses an unknown pad-shape." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Footprint %s pad %s uses an unknown pad-shape." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s pad %s uses an unknown pad-shape." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3028,9 +3217,15 @@ void ALTIUM_PCB::ConvertPads6ToBoardItemOnNonCopper( const APAD6& aElem )
|
|||
|
||||
if( klayer == UNDEFINED_LAYER )
|
||||
{
|
||||
wxLogWarning( _( "Non-copper pad %s found on an Altium layer (%d) with no KiCad "
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Non-copper pad %s found on an Altium layer (%d) with no KiCad "
|
||||
"equivalent. It has been moved to KiCad layer Eco1_User." ),
|
||||
aElem.name, aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
|
||||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
|
@ -3050,21 +3245,31 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnNonCopper( FOOTPRINT* aFootprint,
|
|||
{
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogWarning( _( "Loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Loading library '%s':\n"
|
||||
"Footprint %s non-copper pad %s found on an Altium layer (%d) with no "
|
||||
"KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.name,
|
||||
aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogWarning( _( "Footprint %s non-copper pad %s found on an Altium layer (%d) with no "
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s non-copper pad %s found on an Altium layer (%d) with no "
|
||||
"KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.name,
|
||||
aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
}
|
||||
|
||||
klayer = Eco1_User;
|
||||
|
@ -3083,19 +3288,34 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem, PCB_LAYER_ID aLay
|
|||
{
|
||||
if( aElem.net != ALTIUM_NET_UNCONNECTED )
|
||||
{
|
||||
wxLogError( _( "Non-copper pad %s is connected to a net, which is not supported." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Non-copper pad %s is connected to a net, which is not supported." ),
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
|
||||
if( aElem.holesize != 0 )
|
||||
{
|
||||
wxLogError( _( "Non-copper pad %s has a hole, which is not supported." ), aElem.name );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Non-copper pad %s has a hole, which is not supported." ), aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
|
||||
if( aElem.padmode != ALTIUM_PAD_MODE::SIMPLE )
|
||||
{
|
||||
wxLogWarning( _( "Non-copper pad %s has a complex pad stack (not yet supported)." ),
|
||||
aElem.name );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Non-copper pad %s has a complex pad stack (not yet supported)." ),
|
||||
aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
|
||||
switch( aElem.topshape )
|
||||
|
@ -3236,7 +3456,13 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem, PCB_LAYER_ID aLay
|
|||
|
||||
case ALTIUM_PAD_SHAPE::UNKNOWN:
|
||||
default:
|
||||
wxLogError( _( "Non-copper pad %s uses an unknown pad-shape." ), aElem.name );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Non-copper pad %s uses an unknown pad-shape." ), aElem.name );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3286,10 +3512,16 @@ void ALTIUM_PCB::ParseVias6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFile,
|
|||
|
||||
if( !IsCopperLayer( start_klayer ) || !IsCopperLayer( end_klayer ) )
|
||||
{
|
||||
wxLogError( _( "Via from layer %d to %d uses a non-copper layer, which is not "
|
||||
"supported." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Via from layer %d to %d uses a non-copper layer, which is not "
|
||||
"supported." ),
|
||||
elem.layer_start,
|
||||
elem.layer_end );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
|
||||
continue; // just assume through-hole instead.
|
||||
}
|
||||
|
||||
|
@ -3339,10 +3571,16 @@ void ALTIUM_PCB::ConvertTracks6ToBoardItem( const ATRACK6& aElem, const int aPri
|
|||
if( m_polygons.size() <= aElem.polygon )
|
||||
{
|
||||
// Can happen when reading old Altium files: just skip this item
|
||||
wxLogError( "ATRACK6 stream tries to access polygon id %u "
|
||||
"of %u existing polygons. Skip it",
|
||||
(unsigned) aElem.polygon,
|
||||
(unsigned)m_polygons.size() );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "ATRACK6 stream tries to access polygon id %u "
|
||||
"of %u existing polygons; skipping it" ),
|
||||
static_cast<unsigned>( aElem.polygon ),
|
||||
static_cast<unsigned>( m_polygons.size() ) );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3558,7 +3796,14 @@ void ALTIUM_PCB::ConvertTexts6ToBoardItem( const ATEXT6& aElem )
|
|||
{
|
||||
if( aElem.fonttype == ALTIUM_TEXT_TYPE::BARCODE )
|
||||
{
|
||||
wxLogError( _( "Ignored barcode on Altium layer %d (not yet supported)." ), aElem.layer );
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Ignored barcode on Altium layer %d (not yet supported)." ),
|
||||
aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3573,17 +3818,27 @@ void ALTIUM_PCB::ConvertTexts6ToFootprintItem( FOOTPRINT* aFootprint, const ATEX
|
|||
{
|
||||
if( !m_footprintName.IsEmpty() )
|
||||
{
|
||||
wxLogError( _( "Error loading library '%s':\n"
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading library '%s':\n"
|
||||
"Footprint %s contains barcode on Altium layer %d (not yet supported)." ),
|
||||
m_library,
|
||||
m_footprintName,
|
||||
aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _( "Footprint %s contains barcode on Altium layer %d (not yet supported)." ),
|
||||
if( m_reporter )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Footprint %s contains barcode on Altium layer %d (not yet supported)." ),
|
||||
aFootprint->GetReference(),
|
||||
aElem.layer );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_DEBUG );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -107,6 +107,7 @@ class ALTIUM_PCB
|
|||
{
|
||||
public:
|
||||
explicit ALTIUM_PCB( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter,
|
||||
REPORTER* aReporter = nullptr,
|
||||
const wxString& aLibrary = wxEmptyString,
|
||||
const wxString& aFootprintName = wxEmptyString);
|
||||
~ALTIUM_PCB();
|
||||
|
@ -253,6 +254,7 @@ private:
|
|||
std::map<ALTIUM_LAYER, ZONE*> m_outer_plane;
|
||||
|
||||
PROGRESS_REPORTER* m_progressReporter; ///< optional; may be nullptr
|
||||
REPORTER* m_reporter; ///< optional; may be nullptr
|
||||
unsigned m_doneCount;
|
||||
unsigned m_lastProgressCount;
|
||||
unsigned m_totalCount; ///< for progress reporting
|
||||
|
|
|
@ -100,7 +100,7 @@ BOARD* PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard( const wxString& aFileName, BOARD*
|
|||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter );
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter, m_reporter );
|
||||
pcb.Parse( altiumPcbFile, mapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
|
|
|
@ -100,7 +100,7 @@ BOARD* PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard( const wxString& aFileName, BOARD
|
|||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter );
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter, m_reporter );
|
||||
pcb.Parse( altiumPcbFile, mapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <io/io_utils.h>
|
||||
#include <io/altium/altium_binary_parser.h>
|
||||
#include <pcb_io/pcb_io.h>
|
||||
#include <reporter.h>>
|
||||
|
||||
#include <board.h>
|
||||
|
||||
|
@ -41,6 +42,7 @@
|
|||
|
||||
PCB_IO_ALTIUM_DESIGNER::PCB_IO_ALTIUM_DESIGNER() : PCB_IO( wxS( "Altium Designer" ) )
|
||||
{
|
||||
m_reporter = &WXLOG_REPORTER::GetInstance();
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,7 +118,7 @@ BOARD* PCB_IO_ALTIUM_DESIGNER::LoadBoard( const wxString& aFileName, BOARD* aApp
|
|||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter );
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter, m_reporter );
|
||||
pcb.Parse( altiumPcbFile, mapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
|
@ -278,7 +280,7 @@ FOOTPRINT* PCB_IO_ALTIUM_DESIGNER::FootprintLoad( const wxString& aLibraryPath,
|
|||
continue;
|
||||
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, nullptr, aLibraryPath, aFootprintName );
|
||||
ALTIUM_PCB pcb( m_board, nullptr, m_reporter, aLibraryPath, aFootprintName );
|
||||
return pcb.ParseFootprint( *altiumLibFile, aFootprintName );
|
||||
}
|
||||
}
|
||||
|
@ -290,4 +292,4 @@ FOOTPRINT* PCB_IO_ALTIUM_DESIGNER::FootprintLoad( const wxString& aLibraryPath,
|
|||
THROW_IO_ERROR( wxString::Format( _( "Footprint '%s' not found in '%s'." ),
|
||||
aFootprintName,
|
||||
aLibraryPath ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <altium_pcb.h>
|
||||
#include <io/altium/altium_binary_parser.h>
|
||||
#include <pcb_io/pcb_io.h>
|
||||
#include <reporter.h>>
|
||||
|
||||
#include <board.h>
|
||||
|
||||
|
@ -32,6 +33,7 @@
|
|||
|
||||
PCB_IO_SOLIDWORKS::PCB_IO_SOLIDWORKS() : PCB_IO( wxS( "Solidworks PCB" ) )
|
||||
{
|
||||
m_reporter = &WXLOG_REPORTER::GetInstance();
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,7 +121,7 @@ BOARD* PCB_IO_SOLIDWORKS::LoadBoard( const wxString& aFileName, BOARD* aAppendTo
|
|||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter );
|
||||
ALTIUM_PCB pcb( m_board, m_progressReporter, m_reporter );
|
||||
pcb.Parse( altiumPcbFile, mapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
|
|
Loading…
Reference in New Issue