Save pintype alongside pinfunction (in pads).

Fixes https://gitlab.com/kicad/code/kicad/issues/7283
This commit is contained in:
Jeff Young 2021-01-26 15:27:42 +00:00
parent 0e7c18119e
commit 1e9639e89c
4 changed files with 48 additions and 12 deletions

View File

@ -214,6 +214,7 @@ pcb_text_size
pcb_text_width
pcbplotparams
pinfunction
pintype
placed
plus
polygon

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 CERN
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -22,7 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <build_version.h> // LEGACY_BOARD_FILE_VERSION
#include <wildcards_and_files_ext.h>
#include <advanced_config.h>
#include <base_units.h>
@ -1311,7 +1310,8 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
m_out->Print( aNestLevel, "(pad %s %s %s",
m_out->Quotew( aPad->GetName() ).c_str(),
type, shape );
type,
shape );
m_out->Print( 0, " (at %s", FormatInternalUnits( aPad->GetPos0() ).c_str() );
if( aPad->GetOrientation() != 0.0 )
@ -1403,47 +1403,75 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
// Unconnected pad is default net so don't save it.
if( !( m_ctl & CTL_OMIT_PAD_NETS ) && aPad->GetNetCode() != NETINFO_LIST::UNCONNECTED )
{
StrPrintf( &output, " (net %d %s)", m_mapping->Translate( aPad->GetNetCode() ),
m_out->Quotew( aPad->GetNetname() ).c_str() );
}
// Add pinfunction, if exists.
// Pin function is closely related to nets, so if CTL_OMIT_NETS is set,
// omit also pin function (for instance when saved from library editor)
if( !( m_ctl & CTL_OMIT_PAD_NETS ) && !aPad->GetPinFunction().IsEmpty() )
StrPrintf( &output, " (pinfunction %s)",
m_out->Quotew( aPad->GetPinFunction() ).c_str() );
// Pin functions and types are closely related to nets, so if CTL_OMIT_NETS is set, omit
// them as well (for instance when saved from library editor).
if( !( m_ctl & CTL_OMIT_PAD_NETS ) )
{
if( !aPad->GetPinFunction().IsEmpty() )
{
StrPrintf( &output, " (pinfunction %s)",
m_out->Quotew( aPad->GetPinFunction() ).c_str() );
}
if( !aPad->GetPinType().IsEmpty() )
{
StrPrintf( &output, " (pintype %s)",
m_out->Quotew( aPad->GetPinType() ).c_str() );
}
}
if( aPad->GetPadToDieLength() != 0 )
{
StrPrintf( &output, " (die_length %s)",
FormatInternalUnits( aPad->GetPadToDieLength() ).c_str() );
}
if( aPad->GetLocalSolderMaskMargin() != 0 )
{
StrPrintf( &output, " (solder_mask_margin %s)",
FormatInternalUnits( aPad->GetLocalSolderMaskMargin() ).c_str() );
}
if( aPad->GetLocalSolderPasteMargin() != 0 )
{
StrPrintf( &output, " (solder_paste_margin %s)",
FormatInternalUnits( aPad->GetLocalSolderPasteMargin() ).c_str() );
}
if( aPad->GetLocalSolderPasteMarginRatio() != 0 )
{
StrPrintf( &output, " (solder_paste_margin_ratio %s)",
Double2Str( aPad->GetLocalSolderPasteMarginRatio() ).c_str() );
}
if( aPad->GetLocalClearance() != 0 )
{
StrPrintf( &output, " (clearance %s)",
FormatInternalUnits( aPad->GetLocalClearance() ).c_str() );
}
if( aPad->GetEffectiveZoneConnection() != ZONE_CONNECTION::INHERITED )
{
StrPrintf( &output, " (zone_connect %d)",
static_cast<int>( aPad->GetEffectiveZoneConnection() ) );
}
if( aPad->GetThermalSpokeWidth() != 0 )
{
StrPrintf( &output, " (thermal_width %s)",
FormatInternalUnits( aPad->GetThermalSpokeWidth() ).c_str() );
}
if( aPad->GetThermalGap() != 0 )
{
StrPrintf( &output, " (thermal_gap %s)",
FormatInternalUnits( aPad->GetThermalGap() ).c_str() );
}
if( output.size() )
{

View File

@ -93,7 +93,8 @@ class PCB_TEXT;
//#define SEXPR_BOARD_FILE_VERSION 20201115 // module -> footprint and change fill syntax.
//#define SEXPR_BOARD_FILE_VERSION 20201116 // Write version and generator string in footprint files.
//#define SEXPR_BOARD_FILE_VERSION 20201220 // Add free via token
#define SEXPR_BOARD_FILE_VERSION 20210108 // Pad locking moved from footprint to pads
//#define SEXPR_BOARD_FILE_VERSION 20210108 // Pad locking moved from footprint to pads
#define SEXPR_BOARD_FILE_VERSION 20210126 // Store pintype alongside pinfunction (in pads).
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 CERN
* Copyright (C) 2012-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -3773,6 +3773,12 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
NeedRIGHT();
break;
case T_pintype:
NeedSYMBOLorNUMBER();
pad->SetPinType( FromUTF8() );
NeedRIGHT();
break;
case T_die_length:
pad->SetPadToDieLength( parseBoardUnits( T_die_length ) );
NeedRIGHT();
@ -4009,7 +4015,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
Expecting( "at, locked, drill, layers, net, die_length, roundrect_rratio, "
"solder_mask_margin, solder_paste_margin, solder_paste_margin_ratio, "
"clearance, tstamp, primitives, remove_unused_layers, keep_end_layers, "
"zone_connect, thermal_width, or thermal_gap" );
"pinfunction, pintype, zone_connect, thermal_width, or thermal_gap" );
}
}