Pcbnew: Partial merge from pcad2kicad (from Alexander Lunev). Fix an old bug related to pads with offset: sometimes the connection to a zone was not detected.
This commit is contained in:
parent
8306f4c65c
commit
5fc382df85
|
@ -7,9 +7,9 @@
|
|||
|
||||
#ifndef KICAD_BUILD_VERSION
|
||||
#if defined KICAD_GOST
|
||||
# define KICAD_BUILD_VERSION "(2013-mar-08 GOST)"
|
||||
# define KICAD_BUILD_VERSION "(2013-mar-09 GOST)"
|
||||
#else
|
||||
# define KICAD_BUILD_VERSION "(2013-mar-08)"
|
||||
# define KICAD_BUILD_VERSION "(2013-mar-09)"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
; General Product Description Definitions
|
||||
!define PRODUCT_NAME "KiCad"
|
||||
!define PRODUCT_VERSION "2013.03.08"
|
||||
!define PRODUCT_VERSION "2013.03.09"
|
||||
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
|
||||
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
|
||||
!define COMPANY_NAME ""
|
||||
|
@ -36,7 +36,7 @@ SetCompressor /final /solid lzma
|
|||
CRCCheck force
|
||||
XPStyle on
|
||||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
OutFile "${PRODUCT_NAME}_stable-${PRODUCT_VERSION}-BZR3989_Win_full_version.exe"
|
||||
OutFile "${PRODUCT_NAME}_stable-${PRODUCT_VERSION}-BZR3990_Win_full_version.exe"
|
||||
InstallDir "$PROGRAMFILES\KiCad"
|
||||
ShowInstDetails hide
|
||||
ShowUnInstDetails hide
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/**
|
||||
* @file pcad_plugin.cpp
|
||||
* @brief Pcbnew PLUGIN for P-Cad 2002/2004 ASCII *.pcb format.
|
||||
* @brief Pcbnew PLUGIN for P-Cad 200x ASCII *.pcb format.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/**
|
||||
* @file pcad_plugin.h
|
||||
* @brief Pcbnew PLUGIN for P-Cad 2002/2004 ASCII *.pcb format.
|
||||
* @brief Pcbnew PLUGIN for P-Cad 200x ASCII *.pcb format.
|
||||
*/
|
||||
|
||||
#ifndef PCAD_PLUGIN_H_
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -50,19 +50,19 @@ namespace PCAD2KICAD {
|
|||
|
||||
int PCB::GetKiCadLayer( int aPCadLayer )
|
||||
{
|
||||
assert( aPCadLayer >= FIRST_COPPER_LAYER && aPCadLayer <= LAST_NO_COPPER_LAYER );
|
||||
wxASSERT( aPCadLayer >= 0 && aPCadLayer < MAX_PCAD_LAYER_QTY );
|
||||
return m_layersMap[aPCadLayer].KiCadLayer;
|
||||
}
|
||||
|
||||
LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer )
|
||||
{
|
||||
assert( aPCadLayer >= FIRST_COPPER_LAYER && aPCadLayer <= LAST_NO_COPPER_LAYER );
|
||||
wxASSERT( aPCadLayer >= 0 && aPCadLayer < MAX_PCAD_LAYER_QTY );
|
||||
return m_layersMap[aPCadLayer].layerType;
|
||||
}
|
||||
|
||||
wxString PCB::GetLayerNetNameRef( int aPCadLayer )
|
||||
{
|
||||
assert( aPCadLayer >= FIRST_COPPER_LAYER && aPCadLayer <= LAST_NO_COPPER_LAYER );
|
||||
wxASSERT( aPCadLayer >= 0 && aPCadLayer < MAX_PCAD_LAYER_QTY );
|
||||
return m_layersMap[aPCadLayer].netNameRef;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ PCB::PCB( BOARD* aBoard ) : PCB_MODULE( this, aBoard )
|
|||
|
||||
m_defaultMeasurementUnit = wxT( "mil" );
|
||||
|
||||
for( i = 0; i < NB_LAYERS; i++ )
|
||||
for( i = 0; i < MAX_PCAD_LAYER_QTY; i++ )
|
||||
{
|
||||
m_layersMap[i].KiCadLayer = SOLDERMASK_N_FRONT; // default
|
||||
m_layersMap[i].layerType = LAYER_TYPE_NONSIGNAL; // default
|
||||
|
@ -173,7 +173,7 @@ void PCB::SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue,
|
|||
t1Node = aNode;
|
||||
n = aXmlName;
|
||||
|
||||
// new file foramat version
|
||||
// new file format version
|
||||
if( FindNode( tNode, wxT( "patternGraphicsNameRef" ) ) )
|
||||
{
|
||||
FindNode( tNode,
|
||||
|
@ -262,6 +262,11 @@ void PCB::DoPCBComponents( XNODE* aNode,
|
|||
if( tNode )
|
||||
{
|
||||
mc = new PCB_MODULE( this, m_board );
|
||||
|
||||
mNode = FindNode( lNode, wxT( "patternGraphicsNameRef" ) );
|
||||
if( mNode )
|
||||
mNode->GetAttribute( wxT( "Name" ), &mc->m_patGraphRefName );
|
||||
|
||||
mc->Parse( tNode, aStatusBar, m_defaultMeasurementUnit, aActualConversion );
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +520,9 @@ void PCB::MapLayer( XNODE* aNode )
|
|||
if( FindNode( aNode, wxT( "layerNum" ) ) )
|
||||
FindNode( aNode, wxT( "layerNum" ) )->GetNodeContent().ToLong( &num );
|
||||
|
||||
assert( num >= FIRST_COPPER_LAYER && num <= LAST_NO_COPPER_LAYER );
|
||||
if( num < 0 || num >= MAX_PCAD_LAYER_QTY )
|
||||
THROW_IO_ERROR( wxString::Format( wxT( "layerNum = %ld is out of range" ), num ) );
|
||||
|
||||
m_layersMap[(int) num].KiCadLayer = KiCadLayer;
|
||||
|
||||
if( FindNode( aNode, wxT( "layerType" ) ) )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -38,13 +38,15 @@
|
|||
|
||||
namespace PCAD2KICAD {
|
||||
|
||||
#define MAX_PCAD_LAYER_QTY 32
|
||||
|
||||
class PCB : public PCB_MODULE, public PCB_CALLBACKS
|
||||
{
|
||||
public:
|
||||
PCB_COMPONENTS_ARRAY m_pcbComponents; // PCB Modules,Lines,Routes,Texts, .... and so on
|
||||
PCB_NETS_ARRAY m_pcbNetlist; // net objects collection
|
||||
wxString m_defaultMeasurementUnit;
|
||||
TLAYER m_layersMap[NB_LAYERS]; // flexible layers mapping
|
||||
TLAYER m_layersMap[MAX_PCAD_LAYER_QTY]; // flexible layers mapping
|
||||
int m_sizeX;
|
||||
int m_sizeY;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -58,11 +58,14 @@ void PCB_ARC::Parse( XNODE* aNode,
|
|||
wxString aActualConversion )
|
||||
{
|
||||
XNODE* lNode;
|
||||
double r = 0.0, a = 0.0;
|
||||
int endPointX, endPointY;
|
||||
double a = 0.0;
|
||||
int r = 0;
|
||||
int endX;
|
||||
int endY;
|
||||
|
||||
m_PCadLayer = aLayer;
|
||||
m_KiCadLayer = GetKiCadLayer();
|
||||
|
||||
if( FindNode( aNode, wxT( "width" ) ) )
|
||||
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(),
|
||||
aDefaultMeasurementUnit, &m_width, aActualConversion );
|
||||
|
@ -88,17 +91,16 @@ void PCB_ARC::Parse( XNODE* aNode,
|
|||
|
||||
if( lNode )
|
||||
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
|
||||
&endPointX, &endPointY, aActualConversion );
|
||||
&endX, &endY, aActualConversion );
|
||||
|
||||
int alpha1 = ArcTangente( m_startY - m_positionY, m_startX - m_positionX );
|
||||
int alpha2 = ArcTangente( endPointY - m_positionY, endPointX - m_positionX );
|
||||
int alpha2 = ArcTangente( endY - m_positionY, endX - m_positionX );
|
||||
m_angle = alpha1 - alpha2;
|
||||
|
||||
if( m_angle < 0 )
|
||||
m_angle = 3600 + m_angle;
|
||||
}
|
||||
|
||||
if( aNode->GetName() == wxT( "arc" ) )
|
||||
else if( aNode->GetName() == wxT( "arc" ) )
|
||||
{
|
||||
lNode = FindNode( aNode, wxT( "pt" ) );
|
||||
|
||||
|
@ -108,18 +110,20 @@ void PCB_ARC::Parse( XNODE* aNode,
|
|||
|
||||
lNode = FindNode( aNode, wxT( "radius" ) );
|
||||
if( lNode)
|
||||
r = StrToIntUnits( lNode->GetNodeContent(), wxT( ' ' ), aActualConversion );
|
||||
SetWidth( FindNode( aNode, wxT( "radius" ) )->GetNodeContent(),
|
||||
aDefaultMeasurementUnit, &r, aActualConversion );
|
||||
|
||||
|
||||
lNode = FindNode( aNode, wxT( "startAngle" ) );
|
||||
if( lNode )
|
||||
a = StrToInt1Units( lNode->GetNodeContent() );
|
||||
|
||||
m_startX = KiROUND( m_positionX + r * sin( (a - 900.0) * M_PI / 1800.0 ) );
|
||||
m_startY = KiROUND( m_positionY - r * cos( (a - 900.0) * M_PI / 1800.0 ) );
|
||||
|
||||
lNode = FindNode( aNode, wxT( "sweepAngle" ) );
|
||||
if( lNode )
|
||||
m_angle = StrToInt1Units( lNode->GetNodeContent() );
|
||||
|
||||
m_startX = KiROUND( m_positionX + (double)r * cos( a * M_PI / 1800.0 ) );
|
||||
m_startY = KiROUND( m_positionY - (double)r * sin( a * M_PI / 1800.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,6 +137,17 @@ void PCB_ARC::SetPosOffset( int aX_offs, int aY_offs )
|
|||
}
|
||||
|
||||
|
||||
void PCB_ARC::Flip()
|
||||
{
|
||||
PCB_COMPONENT::Flip();
|
||||
|
||||
m_startX = -m_startX;
|
||||
m_angle = -m_angle;
|
||||
|
||||
m_KiCadLayer = FlipLayers( m_KiCadLayer );
|
||||
}
|
||||
|
||||
|
||||
void PCB_ARC::AddToModule( MODULE* aModule )
|
||||
{
|
||||
if( IsValidNonCopperLayerIndex( m_KiCadLayer ) )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -51,6 +51,7 @@ public:
|
|||
wxString aDefaultMeasurementUnit, wxString aActualConversion );
|
||||
|
||||
virtual void SetPosOffset( int aX_offs, int aY_offs );
|
||||
virtual void Flip();
|
||||
void AddToModule( MODULE* aModule );
|
||||
void AddToBoard();
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -61,7 +61,6 @@ PCB_COMPONENT::~PCB_COMPONENT()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void PCB_COMPONENT::AddToModule( MODULE* aModule )
|
||||
{
|
||||
}
|
||||
|
@ -73,4 +72,44 @@ void PCB_COMPONENT::SetPosOffset( int aX_offs, int aY_offs )
|
|||
m_positionY += aY_offs;
|
||||
}
|
||||
|
||||
void PCB_COMPONENT::Flip()
|
||||
{
|
||||
m_positionX = -m_positionX;
|
||||
}
|
||||
|
||||
int PCB_COMPONENT::FlipLayers( int aLayer )
|
||||
{
|
||||
int result = aLayer; // dafault is no swap
|
||||
|
||||
// routed layers
|
||||
if( aLayer == LAYER_N_BACK )
|
||||
result = LAYER_N_FRONT;
|
||||
|
||||
if( aLayer == LAYER_N_FRONT )
|
||||
result = LAYER_N_BACK;
|
||||
|
||||
// Silk
|
||||
if( aLayer == SILKSCREEN_N_FRONT )
|
||||
result = SILKSCREEN_N_BACK;
|
||||
|
||||
if( aLayer == SILKSCREEN_N_BACK )
|
||||
result = SILKSCREEN_N_FRONT;
|
||||
|
||||
// Paste
|
||||
if( aLayer == SOLDERPASTE_N_FRONT )
|
||||
result = SOLDERPASTE_N_BACK;
|
||||
|
||||
if( aLayer == SOLDERPASTE_N_BACK )
|
||||
result = SOLDERPASTE_N_FRONT;
|
||||
|
||||
// Mask
|
||||
if( aLayer == SOLDERMASK_N_FRONT )
|
||||
result = SOLDERMASK_N_BACK;
|
||||
|
||||
if( aLayer == SOLDERMASK_N_BACK )
|
||||
result = SOLDERMASK_N_FRONT;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace PCAD2KICAD
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -66,6 +66,7 @@ public:
|
|||
~PCB_COMPONENT();
|
||||
|
||||
virtual void SetPosOffset( int aX_offs, int aY_offs );
|
||||
virtual void Flip();
|
||||
virtual void AddToModule( MODULE* aModule );
|
||||
virtual void AddToBoard() = 0;
|
||||
|
||||
|
@ -76,6 +77,8 @@ public:
|
|||
protected:
|
||||
PCB_CALLBACKS* m_callbacks;
|
||||
BOARD* m_board;
|
||||
|
||||
int FlipLayers( int aLayer );
|
||||
};
|
||||
|
||||
WX_DEFINE_ARRAY( PCB_COMPONENT*, PCB_COMPONENTS_ARRAY );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -41,6 +41,7 @@ PCB_COPPER_POUR::PCB_COPPER_POUR( PCB_CALLBACKS* aCallbacks,
|
|||
int aPCadLayer ) :
|
||||
PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
|
||||
{
|
||||
m_filled = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,6 +88,9 @@ bool PCB_COPPER_POUR::Parse( XNODE* aNode,
|
|||
SetWidth( FindNode( aNode, wxT( "thermalWidth" ) )->GetNodeContent(),
|
||||
aDefaultMeasurementUnit, &thermalWidth, aActualConversion );
|
||||
|
||||
if( FindNode( aNode, wxT( "island" ) ) )
|
||||
m_filled = true;
|
||||
|
||||
lNode = FindNode( aNode, wxT( "pcbPoly" ) );
|
||||
|
||||
if( lNode )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -105,6 +105,15 @@ void PCB_LINE::SetPosOffset( int aX_offs, int aY_offs )
|
|||
}
|
||||
|
||||
|
||||
void PCB_LINE::Flip()
|
||||
{
|
||||
PCB_COMPONENT::Flip();
|
||||
|
||||
m_toX = -m_toX;
|
||||
m_KiCadLayer = FlipLayers( m_KiCadLayer );
|
||||
}
|
||||
|
||||
|
||||
void PCB_LINE::AddToModule( MODULE* aModule )
|
||||
{
|
||||
if( IsValidNonCopperLayerIndex( m_KiCadLayer ) )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -52,6 +52,7 @@ public:
|
|||
wxString aDefaultMeasurementUnit,
|
||||
wxString aActualConversion );
|
||||
virtual void SetPosOffset( int aX_offs, int aY_offs );
|
||||
virtual void Flip();
|
||||
void AddToModule( MODULE* aModule );
|
||||
void AddToBoard();
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -154,26 +154,25 @@ XNODE* PCB_MODULE::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGra
|
|||
if( pNode )
|
||||
lNode = FindNode( pNode, wxT( "multiLayer" ) ); // Old file format
|
||||
|
||||
*aPatGraphRefName = wxEmptyString; // default
|
||||
|
||||
if( lNode )
|
||||
{
|
||||
*aPatGraphRefName = wxEmptyString; // default
|
||||
result = lNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
// New file format
|
||||
|
||||
if( *aPatGraphRefName == wxEmptyString ) // default
|
||||
{
|
||||
if( FindNode( aNode, wxT( "patternGraphicsNameRef" ) ) )
|
||||
{
|
||||
FindNode( aNode,
|
||||
wxT( "patternGraphicsNameRef" ) )->GetAttribute( wxT( "Name" ),
|
||||
aPatGraphRefName );
|
||||
}
|
||||
}
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////
|
||||
// lNode:=iNode.ChildNodes.FindNode('patternGraphicsDef'); before
|
||||
// Fixed 02/08, Sergeys input file format
|
||||
// Did it work before ????
|
||||
// lNode:=pNode.ChildNodes.FindNode('patternGraphicsDef'); Nw for some files
|
||||
// ////////////////////////////////////////////////////////////////////
|
||||
if( FindNode( aNode, wxT( "patternGraphicsDef" ) ) )
|
||||
lNode = FindNode( aNode, wxT( "patternGraphicsDef" ) );
|
||||
else
|
||||
|
@ -586,59 +585,23 @@ void PCB_MODULE::AddToBoard()
|
|||
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
|
||||
{
|
||||
if( m_moduleObjects[i]->m_objType == wxT( 'P' ) )
|
||||
( (PCB_PAD*) m_moduleObjects[i] )->AddToModule( module, m_rotation );
|
||||
( (PCB_PAD*) m_moduleObjects[i] )->AddToModule( module, m_rotation, false );
|
||||
}
|
||||
|
||||
// VIAS
|
||||
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
|
||||
{
|
||||
if( m_moduleObjects[i]->m_objType == wxT( 'V' ) )
|
||||
( (PCB_VIA*) m_moduleObjects[i] )->AddToModule( module, m_rotation );
|
||||
( (PCB_VIA*) m_moduleObjects[i] )->AddToModule( module, m_rotation, false );
|
||||
}
|
||||
|
||||
module->CalculateBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
int PCB_MODULE::FlipLayers( int aLayer )
|
||||
{
|
||||
int result = aLayer; // no swap default....
|
||||
|
||||
// routed layers
|
||||
if( aLayer == 0 )
|
||||
result = 15;
|
||||
|
||||
if( aLayer == 15 )
|
||||
result = 0;
|
||||
|
||||
// Silk
|
||||
if( aLayer == 21 )
|
||||
result = 20;
|
||||
|
||||
if( aLayer == 20 )
|
||||
result = 21;
|
||||
|
||||
// Paste
|
||||
if( aLayer == 19 )
|
||||
result = 18;
|
||||
|
||||
if( aLayer == 18 )
|
||||
result = 19;
|
||||
|
||||
// Mask
|
||||
if( aLayer == 23 )
|
||||
result = 22;
|
||||
|
||||
if( aLayer == 22 )
|
||||
result = 23;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void PCB_MODULE::Flip()
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
if( m_mirror == 1 )
|
||||
{
|
||||
|
@ -652,45 +615,12 @@ void PCB_MODULE::Flip()
|
|||
|
||||
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
|
||||
{
|
||||
// MODULE LINES
|
||||
if( m_moduleObjects[i]->m_objType == wxT( 'L' ) )
|
||||
if( m_moduleObjects[i]->m_objType == wxT( 'L' ) || // lines
|
||||
m_moduleObjects[i]->m_objType == wxT( 'A' ) || // arcs
|
||||
m_moduleObjects[i]->m_objType == wxT( 'P' ) || // pads
|
||||
m_moduleObjects[i]->m_objType == wxT( 'V' ) ) // vias
|
||||
{
|
||||
m_moduleObjects[i]->m_positionX = -m_moduleObjects[i]->m_positionX;
|
||||
( (PCB_LINE*) m_moduleObjects[i] )->m_toX =
|
||||
-( (PCB_LINE*) m_moduleObjects[i] )->m_toX;
|
||||
m_moduleObjects[i]->m_KiCadLayer = FlipLayers( m_moduleObjects[i]->m_KiCadLayer );
|
||||
}
|
||||
|
||||
// MODULE Arcs
|
||||
if( m_moduleObjects[i]->m_objType == wxT( 'A' ) )
|
||||
{
|
||||
m_moduleObjects[i]->m_positionX = -m_moduleObjects[i]->m_positionX;
|
||||
( (PCB_ARC*) m_moduleObjects[i] )->m_startX =
|
||||
-( (PCB_ARC*) m_moduleObjects[i] )->m_startX;
|
||||
m_moduleObjects[i]->m_KiCadLayer = FlipLayers( m_moduleObjects[i]->m_KiCadLayer );
|
||||
}
|
||||
|
||||
// PADS
|
||||
if( m_moduleObjects[i]->m_objType == wxT( 'P' ) )
|
||||
{
|
||||
m_moduleObjects[i]->m_positionX = -m_moduleObjects[i]->m_positionX;
|
||||
m_moduleObjects[i]->m_rotation = -m_moduleObjects[i]->m_rotation;
|
||||
|
||||
for( j = 0; j < (int) ( (PCB_PAD*) m_moduleObjects[i] )->m_shapes.GetCount(); j++ )
|
||||
( (PCB_PAD*) m_moduleObjects[i] )->m_shapes[j]->m_KiCadLayer =
|
||||
FlipLayers( ( (PCB_PAD*) m_moduleObjects[i] )->m_shapes[j]->m_KiCadLayer );
|
||||
|
||||
}
|
||||
|
||||
// VIAS
|
||||
if( m_moduleObjects[i]->m_objType == wxT( 'V' ) )
|
||||
{
|
||||
m_moduleObjects[i]->m_positionX = -m_moduleObjects[i]->m_positionX;
|
||||
|
||||
for( j = 0; j < (int) ( (PCB_VIA*) m_moduleObjects[i] )->m_shapes.GetCount(); j++ )
|
||||
( (PCB_VIA*) m_moduleObjects[i] )->m_shapes[j]->m_KiCadLayer =
|
||||
FlipLayers( ( (PCB_VIA*) m_moduleObjects[i] )->m_shapes[j]->m_KiCadLayer );
|
||||
|
||||
m_moduleObjects[i]->Flip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -68,7 +68,6 @@ public:
|
|||
private:
|
||||
XNODE* FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName );
|
||||
wxString ModuleLayer( int aMirror );
|
||||
int FlipLayers( int aLayer );
|
||||
};
|
||||
|
||||
} // namespace PCAD2KICAD
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -41,6 +41,7 @@ PCB_PAD::PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aC
|
|||
m_number = 0;
|
||||
m_hole = 0;
|
||||
m_isHolePlated = true;
|
||||
m_defaultPinDes = wxEmptyString;
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,6 +97,26 @@ void PCB_PAD::Parse( XNODE* aNode, wxString aDefaultMeasurementUnit,
|
|||
m_rotation = StrToInt1Units( str );
|
||||
}
|
||||
|
||||
lNode = FindNode( aNode, wxT( "netNameRef" ) );
|
||||
|
||||
if( lNode )
|
||||
{
|
||||
lNode->GetAttribute( wxT( "Name" ), &propValue );
|
||||
propValue.Trim( false );
|
||||
propValue.Trim( true );
|
||||
m_net = propValue;
|
||||
m_netCode = GetNetCode( m_net );
|
||||
}
|
||||
|
||||
lNode = FindNode( aNode, wxT( "defaultPinDes" ) );
|
||||
|
||||
if( lNode )
|
||||
{
|
||||
lNode->GetAttribute( wxT( "Name" ), &propValue );
|
||||
//propValue.Trim( false );
|
||||
m_defaultPinDes = propValue;
|
||||
}
|
||||
|
||||
lNode = aNode;
|
||||
|
||||
while( lNode && lNode->GetName() != wxT( "www.lura.sk" ) )
|
||||
|
@ -149,7 +170,21 @@ void PCB_PAD::Parse( XNODE* aNode, wxString aDefaultMeasurementUnit,
|
|||
}
|
||||
|
||||
|
||||
void PCB_PAD::AddToModule( MODULE* aModule, int aRotation )
|
||||
void PCB_PAD::Flip()
|
||||
{
|
||||
int i;
|
||||
|
||||
PCB_COMPONENT::Flip();
|
||||
|
||||
if( m_objType == wxT( 'P' ) )
|
||||
m_rotation = -m_rotation;
|
||||
|
||||
for( i = 0; i < (int)m_shapes.GetCount(); i++ )
|
||||
m_shapes[i]->m_KiCadLayer = FlipLayers( m_shapes[i]->m_KiCadLayer );
|
||||
}
|
||||
|
||||
|
||||
void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad )
|
||||
{
|
||||
PCB_PAD_SHAPE* padShape;
|
||||
wxString padShapeName = wxT( "Ellipse" );
|
||||
|
@ -158,12 +193,12 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation )
|
|||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
if( !m_isHolePlated && m_hole )
|
||||
{
|
||||
// mechanical hole
|
||||
D_PAD* pad = new D_PAD( aModule );
|
||||
aModule->m_Pads.PushBack( pad );
|
||||
|
||||
if( !m_isHolePlated && m_hole )
|
||||
{
|
||||
// mechanical hole
|
||||
pad->SetShape( PAD_CIRCLE );
|
||||
pad->SetAttribute( PAD_HOLE_NOT_PLATED );
|
||||
|
||||
|
@ -171,20 +206,10 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation )
|
|||
pad->SetDrillSize( wxSize( m_hole, m_hole ) );
|
||||
pad->SetSize( wxSize( m_hole, m_hole ) );
|
||||
|
||||
// pad's "Position" is not relative to the module's,
|
||||
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
|
||||
wxPoint padpos( m_positionX, m_positionY );
|
||||
pad->SetPos0( padpos );
|
||||
RotatePoint( &padpos, aModule->GetOrientation() );
|
||||
pad->SetPosition( padpos + aModule->GetPosition() );
|
||||
|
||||
pad->SetLayerMask( ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT );
|
||||
}
|
||||
else
|
||||
{
|
||||
D_PAD* pad = new D_PAD( aModule );
|
||||
aModule->m_Pads.PushBack( pad );
|
||||
|
||||
( m_hole ) ? padType = PAD_STANDARD : padType = PAD_SMD;
|
||||
|
||||
// form layer mask
|
||||
|
@ -250,7 +275,10 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation )
|
|||
|
||||
pad->SetNet( 0 );
|
||||
pad->SetNetname( m_net );
|
||||
}
|
||||
|
||||
if( !aEncapsulatedPad )
|
||||
{
|
||||
// pad's "Position" is not relative to the module's,
|
||||
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
|
||||
wxPoint padpos( m_positionX, m_positionY );
|
||||
|
@ -268,6 +296,8 @@ void PCB_PAD::AddToBoard()
|
|||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
if( m_objType == wxT( 'V' ) ) // via
|
||||
{
|
||||
// choose one of the shapes
|
||||
for( i = 0; i < (int) m_shapes.GetCount(); i++ )
|
||||
{
|
||||
|
@ -307,6 +337,18 @@ void PCB_PAD::AddToBoard()
|
|||
via->SetLayer( m_KiCadLayer );
|
||||
via->SetNet( m_netCode );
|
||||
}
|
||||
}
|
||||
else // pad
|
||||
{
|
||||
MODULE* module = new MODULE( m_board );
|
||||
m_board->Add( module, ADD_APPEND );
|
||||
|
||||
m_name.text = m_defaultPinDes;
|
||||
|
||||
module->SetPosition( wxPoint( m_positionX, m_positionY ) );
|
||||
AddToModule( module, 0, true );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace PCAD2KICAD
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -51,8 +51,12 @@ public:
|
|||
virtual void Parse( XNODE* aNode,
|
||||
wxString aDefaultMeasurementUnit,
|
||||
wxString aActualConversion );
|
||||
void AddToModule( MODULE* aModule, int aRotation );
|
||||
virtual void Flip();
|
||||
void AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad );
|
||||
void AddToBoard();
|
||||
|
||||
private:
|
||||
wxString m_defaultPinDes;
|
||||
};
|
||||
|
||||
} // namespace PCAD2KICAD
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -45,6 +45,7 @@ PCB_POLYGON::PCB_POLYGON( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLay
|
|||
m_PCadLayer = aPCadLayer;
|
||||
m_KiCadLayer = GetKiCadLayer();
|
||||
m_timestamp = GetNewTimestamp();
|
||||
m_filled = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,7 +210,9 @@ void PCB_POLYGON::AddToBoard()
|
|||
zone->SetDoNotAllowCopperPour( true );
|
||||
}
|
||||
|
||||
//zone->BuildFilledPolysListData( m_board );
|
||||
//if( m_filled )
|
||||
// cvpcb is not linked
|
||||
// zone->BuildFilledPolysListData( m_board );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
|
||||
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -66,6 +66,8 @@ public:
|
|||
|
||||
void FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
|
||||
wxString aDefaultMeasurementUnit, wxString actualConversion );
|
||||
protected:
|
||||
bool m_filled;
|
||||
};
|
||||
|
||||
} // namespace PCAD2KICAD
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
|
||||
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -26,7 +26,6 @@
|
|||
* @file s_expr_loader.cpp
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <dsnlexer.h>
|
||||
#include <macros.h>
|
||||
#include <wx/xml/xml.h>
|
||||
|
|
|
@ -166,7 +166,11 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
|
|||
|
||||
if( item->Type() == PCB_PAD_T )
|
||||
{
|
||||
pos1 = pos2 = ( (D_PAD*) item )->GetPosition();
|
||||
// For pads we use the shape position instead of
|
||||
// the pad position, because the zones are connected
|
||||
// to the center of the shape, not the pad position
|
||||
// (this is important for pads with thermal relief)
|
||||
pos1 = pos2 = ( (D_PAD*) item )->ReturnShapePos();
|
||||
}
|
||||
else if( item->Type() == PCB_VIA_T )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue