ADDED: Pcbnew, add "pin function" (pin name in eeschema) to pads.

The pin name defined in Eeschema is now available as pad info.
Useful for the board designer (the pin function is displayed in the message panel).
Needed for the Gerber P&P files.
This commit is contained in:
jean-pierre charras 2019-11-17 10:11:29 +01:00
parent 13df645af9
commit 71cd8c57bf
23 changed files with 2665 additions and 2421 deletions

View File

@ -439,6 +439,21 @@ wxString ConvertNotAllowedCharsInGerber( const wxString& aString, bool aAllowUtf
}
std::string GBR_DATA_FIELD::GetGerberString()
{
wxString converted;
if( !m_field.IsEmpty() )
converted = ConvertNotAllowedCharsInGerber( m_field, m_useUTF8, m_escapeString );
// Convert the char string to std::string. Be carefull when converting awxString to
// a std::string: using static_cast<const char*> is mandatory
std::string txt = static_cast<const char*>( converted.utf8_str() );
return txt;
}
std::string FormatStringToGerber( const wxString& aString )
{
wxString converted;
@ -500,8 +515,9 @@ bool FormatNetAttribute( std::string& aPrintedText, std::string& aLastNetAttribu
if( ( aData->m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) )
{
// print info associated to a flashed pad (cmpref, pad name)
// example: %TO.P,R5,3*%
// print info associated to a flashed pad (cmpref, pad name, and optionally pin function)
// example1: %TO.P,R5,3*%
// example2: %TO.P,R5,3,reset*%
pad_attribute_string = prepend_string + "TO.P,";
pad_attribute_string += FormatStringToGerber( aData->m_Cmpref ) + ",";
@ -509,7 +525,17 @@ bool FormatNetAttribute( std::string& aPrintedText, std::string& aLastNetAttribu
// Happens for "mechanical" or never connected pads
pad_attribute_string += FormatStringToGerber( NO_PAD_NAME );
else
pad_attribute_string += FormatStringToGerber( aData->m_Padname );
{
pad_attribute_string += aData->m_Padname.GetGerberString();
// In Pcbnew, the pin function comes from the schematic.
// so it exists only for named pads
if( !aData->m_PadPinFunction.IsEmpty() )
{
pad_attribute_string += ',';
pad_attribute_string += aData->m_PadPinFunction.GetGerberString();
}
}
pad_attribute_string += eol_string;
}

View File

@ -27,6 +27,7 @@ num
part
pin
pins
pinfunction
ref
sheetpath
source

View File

@ -166,6 +166,7 @@ path
pcb_text_size
pcb_text_width
pcbplotparams
pinfunction
placed
plus
polygon

View File

@ -565,6 +565,14 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets( bool aUseGraph )
xnet->AddChild( xnode = node( "node" ) );
xnode->AddAttribute( "ref", refText );
xnode->AddAttribute( "pin", pinText );
wxString pinName;
if( pin->GetName() != "~" ) // ~ is a char used to code empty strings in libs.
pinName = pin->GetName();
if( !pinName.IsEmpty() )
xnode->AddAttribute( "pinfunction", pinName );
}
}
}
@ -610,6 +618,9 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets( bool aUseGraph )
xnet->AddChild( xnode = node( "node" ) );
xnode->AddAttribute( "ref", ref );
xnode->AddAttribute( "pin", nitem->GetPinNumText() );
if( !nitem->GetPinNameText().IsEmpty() )
xnode->AddAttribute( "pinfunction", nitem->GetPinNameText() );
}
}

View File

@ -458,3 +458,19 @@ void NETLIST_OBJECT::SetNetNameCandidate( NETLIST_OBJECT* aCandidate )
break;
}
}
const wxString NETLIST_OBJECT::GetPinNameText() const
{
wxString name;
// returns the pin name, for NET_PIN (usual pin) item.
if( m_Type == NET_PIN )
{
name = static_cast<LIB_PIN*>( m_Comp )->GetName();
if( name == "~" ) //empty name
name = wxEmptyString;
}
return name;
}

View File

@ -178,7 +178,6 @@ public:
bool HasNetNameCandidate() { return m_netNameCandidate != NULL; }
/**
* Function GetPinNum
* returns a pin number in wxString form. Pin numbers are not always
* numbers. \"A23\" would be a valid pin number.
*/
@ -187,6 +186,11 @@ public:
return m_PinNum;
}
/**
* returns the pin name, for NET_PIN (usual pin) item.
*/
const wxString GetPinNameText() const;
/** For Pins (NET_PINS):
* @return the schematic component which contains this pin
* (Note: this is the schematic component, not the library component

View File

@ -731,9 +731,15 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN
if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) )
{
cmp_pad_msg.Printf( _( "Cmp: %s; Pad: %s" ),
if( m_netAttributes.m_PadPinFunction.IsEmpty() )
cmp_pad_msg.Printf( _( "Cmp: %s Pad: %s" ),
m_netAttributes.m_Cmpref,
m_netAttributes.m_Padname );
m_netAttributes.m_Padname.GetValue() );
else
cmp_pad_msg.Printf( _( "Cmp: %s Pad: %s Fct %s" ),
m_netAttributes.m_Cmpref,
m_netAttributes.m_Padname.GetValue(),
m_netAttributes.m_PadPinFunction.GetValue() );
}
else if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )

View File

@ -419,7 +419,13 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
{
m_NetAttributeDict.m_NetAttribType |= GBR_NETLIST_METADATA::GBR_NETINFO_PAD;
m_NetAttributeDict.m_Cmpref = FormatStringFromGerber( dummy.GetPrm( 1 ) );
m_NetAttributeDict.m_Padname = FormatStringFromGerber( dummy.GetPrm( 2 ) );
m_NetAttributeDict.m_Padname.SetField( FormatStringFromGerber( dummy.GetPrm( 2 ) ), true, true );
if( dummy.GetPrmCount() > 3 )
m_NetAttributeDict.m_PadPinFunction.SetField(
FormatStringFromGerber( dummy.GetPrm( 3 ) ), true, true );
else
m_NetAttributeDict.m_PadPinFunction.Clear();
}
}
break;

View File

@ -171,8 +171,21 @@ public:
}
void SetNetName( const wxString& aNetname ) { m_NetlistMetadata.m_Netname = aNetname; }
void SetPadName( const wxString& aPadname ) { m_NetlistMetadata.m_Padname = aPadname; }
void SetCmpReference( const wxString& aComponentRef ) { m_NetlistMetadata.m_Cmpref = aComponentRef; }
void SetPadName( const wxString& aPadname, bool aUseUTF8 = false, bool aEscapeString = false )
{
m_NetlistMetadata.m_Padname.SetField( aPadname, aUseUTF8, aEscapeString );
}
void SetPadPinFunction( const wxString& aPadPinFunction, bool aUseUTF8, bool aEscapeString )
{
m_NetlistMetadata.m_PadPinFunction.SetField( aPadPinFunction, aUseUTF8, aEscapeString );
}
void SetCmpReference( const wxString& aComponentRef )
{
m_NetlistMetadata.m_Cmpref = aComponentRef;
}
/**
* Allowed attributes are not the same on board copper layers and on other layers

View File

@ -85,6 +85,49 @@ public:
wxString FormatCmpPnPMetadata();
};
/**
* This class handle a Gerber data field.
* this is a unicode string with some chars converted in escaped Hexa sequence
* when creating the file
* Chars always escaped because they are separator in Gerber files: * , \ %
* non ascii 7 chars can be converted to UTF8 or escaped.
*/
class GBR_DATA_FIELD
{
public:
GBR_DATA_FIELD() : m_useUTF8( false ), m_escapeString( false )
{}
void clear()
{
m_field.clear();
m_useUTF8 = false;
m_escapeString = false;
}
void Clear() { clear(); }
const wxString& GetValue() { return m_field; }
void SetField( const wxString& aField, bool aUseUTF8, bool aEscapeString )
{
m_field = aField;
m_useUTF8 = aUseUTF8;
m_escapeString = aEscapeString;
}
bool IsEmpty() { return m_field.IsEmpty(); }
std::string GetGerberString();
private:
wxString m_field; ///< the unicade text to print in Gbr file
///< (after escape and quoting)
bool m_useUTF8; ///< true to use UTF8, false to escape non ascii7 chars
bool m_escapeString; ///< true to quote the field in gbr file
};
/** this class handle info which can be added in a gerber file as attribute
* of an object
@ -98,6 +141,7 @@ public:
* for other copper layer items (pads on internal layers, tracks ... ), only .N and .C
* can be used
*/
class GBR_NETLIST_METADATA
{
public:
@ -118,9 +162,10 @@ public:
bool m_NotInNet; ///< true if a pad of a footprint cannot be connected
///< (for instance a mechanical NPTH, ot a not named pad)
///< in this case the pad net name is empty in gerber file
wxString m_Padname; ///< for a flashed pad: the pad name ((TO.P attribute)
wxString m_Cmpref; ///< the component reference parent of the data
wxString m_Netname; ///< for items associated to a net: the netname
GBR_DATA_FIELD m_Padname; ///< for a flashed pad: the pad name ((TO.P attribute)
GBR_DATA_FIELD m_PadPinFunction; ///< for a pad: the pin function (defined in schematic)
wxString m_Cmpref; ///< the component reference parent of the data
wxString m_Netname; ///< for items associated to a net: the netname
wxString m_ExtraData; ///< a string to print after %TO object attributes, if not empty
///< it is printed "as this"
@ -161,6 +206,7 @@ public:
if( m_NetAttribType == GBR_NETINFO_UNSPECIFIED )
{
m_Padname.clear();
m_PadPinFunction.clear();
m_Cmpref.clear();
m_Netname.clear();
return;
@ -170,6 +216,7 @@ public:
{
m_NetAttribType = GBR_NETINFO_UNSPECIFIED;
m_Padname.clear();
m_PadPinFunction.clear();
m_Cmpref.clear();
m_Netname.clear();
return;
@ -193,6 +240,7 @@ public:
{
m_NetAttribType &= ~GBR_NETINFO_PAD;
m_Padname.clear();
m_PadPinFunction.clear();
return;
}
}

View File

@ -766,9 +766,13 @@ void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& a
if( module )
{
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
}
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
if( !GetPinFunction().IsEmpty() )
aList.push_back( MSG_PANEL_ITEM( _( "Pin fct" ), GetPinFunction(), BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ) );
board = GetBoard();

View File

@ -189,6 +189,14 @@ public:
m_name = aName;
}
/**
* Set the pad function (pin name in schematic)
*/
void SetPinFunction( const wxString& aName )
{
m_pinFunction = aName;
}
/**
* @return the pad name
*/
@ -197,6 +205,14 @@ public:
return m_name;
}
/**
* @return the pad function (pin name in schematic)
*/
const wxString& GetPinFunction() const
{
return m_pinFunction;
}
/**
* Function IncrementPadName
*
@ -818,9 +834,11 @@ private:
private: // Private variable members:
// Actually computed and cached on demand by the accessor
mutable int m_boundingRadius; ///< radius of the circle containing the pad shape
mutable int m_boundingRadius; ///< radius of the circle containing the pad shape
wxString m_name;
wxString m_name; ///< pad name (pin number in schematic)
wxString m_pinFunction; ///< pin function in schematic
// TODO: Remove m_Pos from Pad or make private. View positions calculated from m_Pos0
wxPoint m_Pos; ///< pad Position on board

View File

@ -449,6 +449,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT&
{
pad->SetLocalRatsnestVisible( oldPad->GetLocalRatsnestVisible() );
pad->SetNetCode( oldPad->GetNetCode() );
pad->SetPinFunction( oldPad->GetPinFunction() );
}
}

View File

@ -57,10 +57,16 @@ PLACEFILE_GERBER_WRITER::PLACEFILE_GERBER_WRITER( BOARD* aPcb )
int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
PCB_LAYER_ID aLayer, bool aIncludeBrdEdges )
PCB_LAYER_ID aLayer, bool aIncludeBrdEdges
)
{
m_layer = aLayer;
PCB_PLOT_PARAMS plotOpts = m_pcb->GetPlotOptions();
if( plotOpts.GetUseAuxOrigin() )
m_offset = m_pcb->GetAuxOrigin();
// Collect footprints on the right layer
std::vector<MODULE*> fp_list;
@ -73,7 +79,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
fp_list.push_back( footprint );
}
LOCALE_IO dummy_io; // Use the standard notation for double numbers
LOCALE_IO dummy_io; // Use the standard notation for float numbers
GERBER_PLOTTER plotter;
@ -104,7 +110,6 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
return -1;
// We need a BRDITEMS_PLOTTER to plot pads
PCB_PLOT_PARAMS plotOpts;
BRDITEMS_PLOTTER brd_plotter( &plotter, m_pcb, plotOpts );
plotter.StartPlot();
@ -167,7 +172,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
gbr_metadata.m_NetlistMetadata.SetExtraData( pnpAttrib.FormatCmpPnPMetadata() );
wxPoint flash_pos = footprint->GetPosition() + m_offset;
wxPoint flash_pos = footprint->GetPosition();
plotter.FlashPadCircle( flash_pos, flash_position_shape_diam, FILLED, &gbr_metadata );
gbr_metadata.m_NetlistMetadata.ClearExtraData();
@ -194,7 +199,6 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
if( !poly.PointCount() )
continue;
poly.Move( m_offset );
useFpPadsBbox = false;
plotter.PLOTTER::PlotPoly( poly, NO_FILL, line_thickness, &gbr_metadata );
}
@ -219,7 +223,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
poly.SetClosed( true );
poly.Rotate( -footprint->GetOrientationRadians(), VECTOR2I( 0, 0 ) );
poly.Move( footprint->GetPosition() + m_offset );
poly.Move( footprint->GetPosition() );
plotter.PLOTTER::PlotPoly( poly, NO_FILL, line_thickness, &gbr_metadata );
}
@ -234,11 +238,15 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
gbr_metadata.SetApertureAttrib(
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_PAD1_POSITION );
gbr_metadata.SetPadName( pad1->GetName() );
gbr_metadata.SetPadName( pad1->GetName(), allowUtf8, true );
gbr_metadata.SetPadPinFunction( pad1->GetPinFunction(), allowUtf8, true );
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_PAD );
// Flashes a diamond at pad position:
plotter.FlashRegularPolygon( pad1->GetPosition() + m_offset, pad1_mark_size,
plotter.FlashRegularPolygon( pad1->GetPosition(),
pad1_mark_size,
4, 0.0, FILLED, &gbr_metadata );
}
}
@ -271,10 +279,13 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename,
if( !pad->IsOnLayer( aLayer ) )
continue;
gbr_metadata.SetPadName( pad->GetName() );
gbr_metadata.SetPadName( pad->GetName(), allowUtf8, true );
gbr_metadata.SetPadPinFunction( pad->GetPinFunction(), allowUtf8, true );
// Flashes a round, 0 sized round shape at pad position
plotter.FlashPadCircle( pad->GetPosition() + m_offset, other_pads_mark_size,
plotter.FlashPadCircle( pad->GetPosition(),
other_pads_mark_size,
FILLED, &gbr_metadata );
}
}

View File

@ -63,7 +63,8 @@ public:
* @param aIncludeBrdEdges = true to include board outlines
* @return component count, or -1 if the file cannot be created
*/
int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges );
int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer,
bool aIncludeBrdEdges );
/**
* @return a filename which identify the drill file function.

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,7 @@ void BOARD_NETLIST_UPDATER::cacheNetname( D_PAD* aPad, const wxString& aNetname
m_padNets[ aPad ] = aNetname;
}
wxString BOARD_NETLIST_UPDATER::getNetname( D_PAD* aPad )
{
if( m_isDryRun && m_padNets.count( aPad ) )
@ -91,6 +92,21 @@ wxString BOARD_NETLIST_UPDATER::getNetname( D_PAD* aPad )
}
void BOARD_NETLIST_UPDATER::cachePinFunction( D_PAD* aPad, const wxString& aPinFunction )
{
m_padPinFunctions[ aPad ] = aPinFunction;
}
wxString BOARD_NETLIST_UPDATER::getPinFunction( D_PAD* aPad )
{
if( m_isDryRun && m_padPinFunctions.count( aPad ) )
return m_padPinFunctions[ aPad ];
else
return aPad->GetPinFunction();
}
wxPoint BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition()
{
wxPoint bestPosition;
@ -299,7 +315,23 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
// At this point, the component footprint is updated. Now update the nets.
for( auto pad : aPcbComponent->Pads() )
{
COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
const COMPONENT_NET& net = aNewComponent->GetNet( pad->GetName() );
wxString pinFunction;
if( net.IsValid() ) // i.e. the pad has a name
pinFunction = net.GetPinFunction();
if( !m_isDryRun )
{
if( pad->GetPinFunction() != pinFunction )
{
changed = true;
pad->SetPinFunction( pinFunction );
}
}
else
cachePinFunction( pad, pinFunction );
// Test if new footprint pad has no net (pads not on copper layers have no net).
if( !net.IsValid() || !pad->IsOnCopperLayer() )
@ -319,10 +351,17 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
pad->GetName() );
m_reporter->Report( msg, REPORTER::RPT_WARNING);
}
if( !m_isDryRun )
{
changed = true;
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
// If the pad has no net from netlist (i.e. not in netlist
// it cannot have a pin function
if( pad->GetNetname().IsEmpty() )
pad->SetPinFunction( wxEmptyString );
}
else
cacheNetname( pad, wxEmptyString );

View File

@ -64,8 +64,9 @@ class PCB_EDIT_FRAME;
* the time stamp is updated from the #NETLIST.
* - After each footprint is added or update as described above, each footprint pad net
* name is compared and updated to the value defined in the #NETLIST.
* - After all of the footprints have been added, updated, and net names properly set,
* any extra unlock footprints are removed from the #BOARD.
* - After all of the footprints have been added, updated, and net names and
* pin function properly set, any extra unlock footprints are removed
* from the #BOARD.
*
*/
class BOARD_NETLIST_UPDATER
@ -136,6 +137,9 @@ private:
void cacheNetname( D_PAD* aPad, const wxString& aNetname );
wxString getNetname( D_PAD* aPad );
void cachePinFunction( D_PAD* aPad, const wxString& aPinFunction );
wxString getPinFunction( D_PAD* aPad );
wxPoint estimateComponentInsertionPosition();
MODULE* addNewComponent( COMPONENT* aComponent );
MODULE* replaceComponent( NETLIST& aNetlist, MODULE* aPcbComponent, COMPONENT* aNewComponent );
@ -155,6 +159,7 @@ private:
std::map< ZONE_CONTAINER*, std::vector<D_PAD*> > m_zoneConnectionsCache;
std::map< wxString, wxString> m_oldToNewNets;
std::map< D_PAD*, wxString > m_padNets;
std::map< D_PAD*, wxString > m_padPinFunctions;
std::vector<MODULE*> m_addedComponents;
std::map<wxString, NETINFO_ITEM*> m_addedNets;

View File

@ -178,16 +178,17 @@ void KICAD_NETLIST_PARSER::parseNet()
{
/* Parses a section like
* (net (code 20) (name /PC-A0)
* (node (ref BUS1) (pin 62))
* (node (ref U3) (pin 3))
* (node (ref U9) (pin M6)))
* (node (ref "BUS1") (pin "62)")
* (node (ref "U3") ("pin 3") (pin_function "clock"))
* (node (ref "U9") (pin "M6") (pin_function "reset")))
*/
COMPONENT* component = NULL;
wxString code;
wxString name;
wxString reference;
wxString pin;
wxString pin_number;
wxString pin_function;
int nodecount = 0;
// The token net was read, so the next data is (code <number>)
@ -217,6 +218,8 @@ void KICAD_NETLIST_PARSER::parseNet()
break;
case T_node:
pin_function.Clear(); // By default: no pin function.
while( (token = NextTok()) != T_EOF )
{
if( token == T_RIGHT )
@ -234,7 +237,13 @@ void KICAD_NETLIST_PARSER::parseNet()
case T_pin:
NeedSYMBOLorNUMBER();
pin = FROM_UTF8( CurText() );
pin_number = FROM_UTF8( CurText() );
NeedRIGHT();
break;
case T_pinfunction:
NeedSYMBOLorNUMBER();
pin_function = FROM_UTF8( CurText() );
NeedRIGHT();
break;
@ -257,7 +266,7 @@ void KICAD_NETLIST_PARSER::parseNet()
m_lineReader->LineNumber(), m_lineReader->Length() );
}
component->AddNet( pin, name );
component->AddNet( pin_number, name, pin_function );
nodecount++;
break;

View File

@ -207,7 +207,7 @@ void LEGACY_NETLIST_READER::loadNet( char* aText, COMPONENT* aComponent )
if( (char) netName[0] == '?' ) // ? indicates no net connected to pin.
netName = wxEmptyString;
aComponent->AddNet( pinName, netName );
aComponent->AddNet( pinName, netName, wxEmptyString );
}

View File

@ -43,24 +43,27 @@ class REPORTER;
/**
* Class COMPONENT_NET
* is used to store the component pin name to net name associations stored in a netlist.
* is used to store the component pin name to net name (and pin function)
* associations stored in a netlist.
*/
class COMPONENT_NET
{
wxString m_pinName;
wxString m_netName;
wxString m_pinFunction;
public:
COMPONENT_NET() {}
COMPONENT_NET( const wxString& aPinName, const wxString& aNetName ) :
m_pinName( aPinName ), m_netName( aNetName )
COMPONENT_NET( const wxString& aPinName, const wxString& aNetName,
const wxString& aPinFunction ) :
m_pinName( aPinName ), m_netName( aNetName ), m_pinFunction( aPinFunction )
{
}
const wxString& GetPinName() const { return m_pinName; }
const wxString& GetNetName() const { return m_netName; }
const wxString& GetPinFunction() const { return m_pinFunction; }
bool IsValid() const { return !m_pinName.IsEmpty(); }
@ -75,21 +78,20 @@ public:
typedef std::vector< COMPONENT_NET > COMPONENT_NETS;
/**
* Class COMPONENT
* is used to store components and all of their related information found in a netlist.
*/
class COMPONENT
{
COMPONENT_NETS m_nets;
wxArrayString m_footprintFilters; ///< Footprint filters found in netlist.
int m_pinCount; ///< Number of pins found in netlist.
wxString m_reference; ///< The component reference designator found in netlist.
wxString m_value; ///< The component value found in netlist.
COMPONENT_NETS m_nets; ///< list of nets shared by the component pins
wxArrayString m_footprintFilters; ///< Footprint filters found in netlist.
int m_pinCount; ///< Number of pins found in netlist.
wxString m_reference; ///< The component reference designator found in netlist.
wxString m_value; ///< The component value found in netlist.
// ZZZ This timestamp is string, not time_t
wxString m_timeStamp; ///< The component full time stamp found in netlist.
wxString m_timeStamp; ///< The component full time stamp found in netlist.
/// The name of the component in #m_library used when it was placed on the schematic..
wxString m_name;
@ -100,6 +102,7 @@ class COMPONENT
/// The #LIB_ID of the footprint assigned to the component.
LIB_ID m_fpid;
/// The alt LIB_ID of the footprint, when there are 2 different assigned footprints,
/// One from the netlist, the other from the .cmp file.
/// this one is a copy of the netlist footprint assignment
@ -129,9 +132,9 @@ public:
virtual ~COMPONENT() { };
void AddNet( const wxString& aPinName, const wxString& aNetName )
void AddNet( const wxString& aPinName, const wxString& aNetName, const wxString& aPinFunction )
{
m_nets.push_back( COMPONENT_NET( aPinName, aNetName ) );
m_nets.push_back( COMPONENT_NET( aPinName, aNetName, aPinFunction ) );
}
unsigned GetNetCount() const { return m_nets.size(); }

View File

@ -3032,6 +3032,12 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
NeedRIGHT();
break;
case T_pinfunction:
NeedSYMBOLorNUMBER();
pad->SetPinFunction( FromUTF8() );
NeedRIGHT();
break;
case T_die_length:
pad->SetPadToDieLength( parseBoardUnits( T_die_length ) );
NeedRIGHT();

View File

@ -79,7 +79,14 @@ void BRDITEMS_PLOTTER::PlotPad( D_PAD* aPad, COLOR4D aColor, EDA_DRAW_MODE_T aPl
gbr_metadata.SetCopper( true );
if( isOnExternalCopperLayer )
gbr_metadata.SetPadName( aPad->GetName() );
{
const bool useUTF8 = false;
const bool useQuoting = false;
gbr_metadata.SetPadName( aPad->GetName(), useUTF8, useQuoting );
if( !aPad->GetName().IsEmpty() )
gbr_metadata.SetPadPinFunction( aPad->GetPinFunction(), useUTF8, useQuoting );
}
gbr_metadata.SetNetName( aPad->GetNetname() );