Eagle PCB import plugin: more descriptive warning messages
This commit is contained in:
parent
e466bf50ae
commit
7d7303215b
|
@ -424,6 +424,11 @@ struct ECOORD
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ToMm() const
|
||||||
|
{
|
||||||
|
return value / 1000000.0;
|
||||||
|
}
|
||||||
|
|
||||||
ECOORD operator+( const ECOORD& aOther ) const
|
ECOORD operator+( const ECOORD& aOther ) const
|
||||||
{
|
{
|
||||||
return ECOORD( value + aOther.value, ECOORD_UNIT );
|
return ECOORD( value + aOther.value, ECOORD_UNIT );
|
||||||
|
|
|
@ -146,6 +146,14 @@ EAGLE_PLUGIN::EAGLE_PLUGIN() :
|
||||||
{
|
{
|
||||||
init( NULL );
|
init( NULL );
|
||||||
|
|
||||||
|
// add a dummy layer, so the layers numbers match the vector index
|
||||||
|
// (in Eagle layers are enumerated from 1)
|
||||||
|
wxXmlNode dummy( wxXML_ELEMENT_NODE, "dummyLayer" );
|
||||||
|
dummy.AddAttribute( "number", "0" );
|
||||||
|
dummy.AddAttribute( "name", "invalid" );
|
||||||
|
dummy.AddAttribute( "color", "black" );
|
||||||
|
m_eagleLayers.push_back( ELAYER( &dummy ) );
|
||||||
|
|
||||||
clear_cu_map();
|
clear_cu_map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,9 +362,6 @@ void EAGLE_PLUGIN::loadDesignRules( wxXmlNode* aDesignRules )
|
||||||
|
|
||||||
void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
|
void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
|
||||||
{
|
{
|
||||||
typedef std::vector<ELAYER> ELAYERS;
|
|
||||||
typedef ELAYERS::const_iterator EITER;
|
|
||||||
|
|
||||||
ELAYERS cu; // copper layers
|
ELAYERS cu; // copper layers
|
||||||
|
|
||||||
// Get the first layer and iterate
|
// Get the first layer and iterate
|
||||||
|
@ -373,6 +378,7 @@ void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
|
||||||
}
|
}
|
||||||
|
|
||||||
layerNode = layerNode->GetNext();
|
layerNode = layerNode->GetNext();
|
||||||
|
m_eagleLayers.push_back( elayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
// establish cu layer map:
|
// establish cu layer map:
|
||||||
|
@ -1238,9 +1244,10 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
||||||
{
|
{
|
||||||
wxLogMessage( wxString::Format(
|
wxLogMessage( wxString::Format(
|
||||||
"Line on copper layer in package %s ( %d, %d ) ( %d, %d )\n Moving to drawings layer",
|
"Line on copper layer in package %s (%d mm, %d mm) (%d mm, %d mm)."
|
||||||
aModule->GetFPID().GetLibItemName().c_str(), w.x1.ToPcbUnits(), w.y1.ToPcbUnits(),
|
"\nMoving to Dwgs.User layer",
|
||||||
w.x2.ToPcbUnits(), w.y2.ToPcbUnits() ) );
|
aModule->GetFPID().GetLibItemName().c_str(), w.x1.ToMm(), w.y1.ToMm(),
|
||||||
|
w.x2.ToMm(), w.y2.ToMm() ) );
|
||||||
layer = Dwgs_User;
|
layer = Dwgs_User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1368,10 +1375,10 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
ETEXT t( aTree );
|
ETEXT t( aTree );
|
||||||
PCB_LAYER_ID layer = kicad_layer( t.layer );
|
PCB_LAYER_ID layer = kicad_layer( t.layer );
|
||||||
|
|
||||||
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
if( IsCopperLayer( layer ) ) // skip copper texts
|
||||||
{
|
{
|
||||||
wxLogMessage( wxString::Format(
|
wxLogMessage( wxString::Format(
|
||||||
"Unsupported text on copper layer in package %s\nMoving to drawings layer.",
|
"Unsupported text on copper layer in package %s.\nMoving to Dwgs.User layer.",
|
||||||
aModule->GetFPID().GetLibItemName().c_str() ) );
|
aModule->GetFPID().GetLibItemName().c_str() ) );
|
||||||
layer = Dwgs_User;
|
layer = Dwgs_User;
|
||||||
}
|
}
|
||||||
|
@ -1483,16 +1490,17 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
PCB_LAYER_ID layer = kicad_layer( r.layer );
|
PCB_LAYER_ID layer = kicad_layer( r.layer );
|
||||||
|
|
||||||
// Rectangles are not supported yet in footprints as they are not editable.
|
// Rectangles are not supported yet in footprints as they are not editable.
|
||||||
wxLogMessage( wxString::Format( "Unsupported rectangle in package %s (%d, %d) (%d, %d)",
|
wxLogMessage( wxString::Format( "Unsupported rectangle in package %s"
|
||||||
aModule->GetFPID().GetLibItemName().c_str(), r.x1.ToPcbUnits(), r.y1.ToPcbUnits(),
|
" (%f mm, %f mm) (%f mm, %f mm), layer: %s",
|
||||||
r.x2.ToPcbUnits(), r.y2.ToPcbUnits() ) );
|
aModule->GetFPID().GetLibItemName().c_str(), r.x1.ToMm(), r.y1.ToMm(),
|
||||||
|
r.x2.ToMm(), r.y2.ToMm(), m_eagleLayers[r.layer].name ) );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
||||||
{
|
{
|
||||||
wxLogMessage( wxString::Format(
|
wxLogMessage( wxString::Format(
|
||||||
"Unsupported rectangle on copper layer in package %s\nMoving to drawings layer.",
|
"Unsupported rectangle on copper layer in package %s.\nMoving to Dwgs.User layer.",
|
||||||
aModule->GetFPID().GetLibItemName().c_str() ) );
|
aModule->GetFPID().GetLibItemName().c_str() ) );
|
||||||
layer = Dwgs_User;
|
layer = Dwgs_User;
|
||||||
}
|
}
|
||||||
|
@ -1530,7 +1538,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
||||||
{
|
{
|
||||||
wxLogMessage( wxString::Format(
|
wxLogMessage( wxString::Format(
|
||||||
"Unsupported polygon on copper layer in package %s\nMoving to drawings layer.",
|
"Unsupported polygon on copper layer in package %s.\nMoving to Dwgs.User layer.",
|
||||||
aModule->GetFPID().GetLibItemName().c_str() ) );
|
aModule->GetFPID().GetLibItemName().c_str() ) );
|
||||||
layer = Dwgs_User;
|
layer = Dwgs_User;
|
||||||
}
|
}
|
||||||
|
@ -1578,7 +1586,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
if( IsCopperLayer( layer ) ) // skip copper "package.circle"s
|
||||||
{
|
{
|
||||||
wxLogMessage( wxString::Format(
|
wxLogMessage( wxString::Format(
|
||||||
"Unsupported circle on copper layer in package%s\nMoving to drawings layer.",
|
"Unsupported circle on copper layer in package %s.\nMoving to Dwgs.User layer.",
|
||||||
aModule->GetFPID().GetLibItemName().c_str() ) );
|
aModule->GetFPID().GetLibItemName().c_str() ) );
|
||||||
layer = Dwgs_User;
|
layer = Dwgs_User;
|
||||||
}
|
}
|
||||||
|
@ -2025,8 +2033,8 @@ PCB_LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
|
||||||
case EAGLE_LAYER::HOLES:
|
case EAGLE_LAYER::HOLES:
|
||||||
default:
|
default:
|
||||||
// some layers do not map to KiCad
|
// some layers do not map to KiCad
|
||||||
wxLogMessage( wxString::Format( "Unsupported Eagle layer %d. Use drawings layer",
|
wxLogMessage( wxString::Format( "Unsupported Eagle layer '%s' (%d), converted to Dwgs.User layer",
|
||||||
aEagleLayer ) );
|
m_eagleLayers[aEagleLayer].name, aEagleLayer ) );
|
||||||
kiLayer = Dwgs_User; break;
|
kiLayer = Dwgs_User; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,8 +125,11 @@ public:
|
||||||
~EAGLE_PLUGIN();
|
~EAGLE_PLUGIN();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
typedef std::vector<ELAYER> ELAYERS;
|
||||||
|
typedef ELAYERS::const_iterator EITER;
|
||||||
|
|
||||||
int m_cu_map[17]; ///< map eagle to kicad, cu layers only.
|
int m_cu_map[17]; ///< map eagle to kicad, cu layers only.
|
||||||
|
ELAYERS m_eagleLayers; ///< Eagle layers data
|
||||||
|
|
||||||
ERULES* m_rules; ///< Eagle design rules.
|
ERULES* m_rules; ///< Eagle design rules.
|
||||||
XPATH* m_xpath; ///< keeps track of what we are working on within
|
XPATH* m_xpath; ///< keeps track of what we are working on within
|
||||||
|
|
Loading…
Reference in New Issue