Browse Source

Minor fix and enhancement code.

pull/15/head
jean-pierre charras 6 years ago
parent
commit
64b5e8bee2
  1. 4
      common/plotters/GERBER_plotter.cpp
  2. 15
      pcbnew/class_module.cpp
  3. 7
      pcbnew/class_module.h
  4. 20
      pcbnew/exporters/export_footprints_placefile.cpp

4
common/plotters/GERBER_plotter.cpp

@ -244,7 +244,9 @@ bool GERBER_PLOTTER::EndPlot()
{
fputs( line, outputFile );
if( strcmp( strtok( line, "\n\r" ), "G04 APERTURE LIST*" ) == 0 )
char* substr = strtok( line, "\n\r" );
if( substr && strcmp( substr, "G04 APERTURE LIST*" ) == 0 )
{
writeApertureList();
fputs( "G04 APERTURE END LIST*\n", outputFile );

15
pcbnew/class_module.cpp

@ -1393,9 +1393,24 @@ bool MODULE::BuildPolyCourtyard()
return success;
}
void MODULE::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_MODULE_T );
std::swap( *((MODULE*) this), *((MODULE*) aImage) );
}
bool MODULE::HasNonSMDPins() const
{
// returns true if the given module has at lesat one non smd pin, such as through hole
for( auto pad : Pads() )
{
if( pad->GetAttribute() != PAD_ATTRIB_SMD )
return true;
}
return false;
}

7
pcbnew/class_module.h

@ -182,6 +182,13 @@ public:
return m_drawings;
}
/**
* @return true if the given module has any non smd pins, such as through hole
* and therefore cannot be placed automatically.
* Used in Pick and Place files writers
*/
bool HasNonSMDPins() const;
std::list<MODULE_3D_SETTINGS>& Models() { return m_3D_Drawings; }
const std::list<MODULE_3D_SETTINGS>& Models() const { return m_3D_Drawings; }

20
pcbnew/exporters/export_footprints_placefile.cpp

@ -62,24 +62,6 @@ static bool sortFPlist( const LIST_MOD& ref, const LIST_MOD& tst )
}
/**
* Helper function HasNonSMDPins
* returns true if the given module has any non smd pins, such as through hole
* and therefore cannot be placed automatically.
*/
static bool HasNonSMDPins( MODULE* aModule )
{
for( auto pad : aModule->Pads() )
{
if( pad->GetAttribute() != PAD_ATTRIB_SMD )
return true;
}
return false;
}
enum SELECT_SIDE
{
PCB_NO_SIDE,
@ -150,7 +132,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
{
if( m_forceSmdItems ) // true to fix a bunch of mis-labeled footprints:
{
if( !HasNonSMDPins( footprint ) )
if( !footprint->HasNonSMDPins() )
{
// all footprint's pins are SMD, mark the part for pick and place
// Note: they are not necessary to pick and place,

Loading…
Cancel
Save