130    std::vector<LIST_MOD> list;
 
  161        item.
m_Reference = footprint->Reference().GetShownText( 
false );
 
  162        item.
m_Value     = footprint->Value().GetShownText( 
false );
 
  163        item.
m_Layer     = footprint->GetLayer();
 
  165        lenRefText = std::max( lenRefText, (
int) item.
m_Reference.length() );
 
  166        lenValText = std::max( lenValText, (
int) item.
m_Value.length() );
 
  169        list.push_back( std::move( item ) );
 
  172    if( list.size() > 1 )
 
  180        wxChar csv_sep = 
',';
 
  183        snprintf( line, 
sizeof(line), 
"Ref%cVal%cPackage%cPosX%cPosY%cRot%cSide\n",
 
  184                  csv_sep, csv_sep, csv_sep, csv_sep, csv_sep, csv_sep );
 
  191            footprint_pos  = list[ii].m_Footprint->GetPosition();
 
  194            int layer = list[ii].m_Footprint->GetLayer();
 
  198                footprint_pos.
x = - footprint_pos.
x;
 
  200            wxLine = wxT( 
"\"" ) + list[ii].m_Reference;
 
  201            wxLine << wxT( 
"\"" ) << csv_sep;
 
  202            wxLine << wxT( 
"\"" ) << list[ii].m_Value;
 
  203            wxLine << wxT( 
"\"" ) << csv_sep;
 
  204            wxLine << wxT( 
"\"" ) << list[ii].m_Footprint->GetFPID().GetLibItemName().wx_str();
 
  205            wxLine << wxT( 
"\"" ) << csv_sep;
 
  207            wxLine << wxString::Format( wxT( 
"%f%c%f%c%f" ),
 
  208                                        footprint_pos.
x * conv_unit,
 
  212                                        -footprint_pos.
y * conv_unit,
 
  214                                        list[ii].m_Footprint->GetOrientation().AsDegrees() );
 
  227        snprintf( line, 
sizeof(line), 
"### Footprint positions - created on %s ###\n",
 
  233        snprintf( line, 
sizeof(line), 
"### Printed by KiCad version %s\n", 
TO_UTF8( Title ) );
 
  237        buffer += 
"## Side : ";
 
  250        snprintf( line, 
sizeof(line), 
"%-*s  %-*s  %-*s  %9.9s  %9.9s  %8.8s  %s\n",
 
  253                  lenPkgText, 
"Package",
 
  254                  "PosX", 
"PosY", 
"Rot", 
"Side" );
 
  260            footprint_pos  = list[ii].m_Footprint->GetPosition();
 
  263            int layer = list[ii].m_Footprint->GetLayer();
 
  267                footprint_pos.
x = - footprint_pos.
x;
 
  269            wxString ref = list[ii].m_Reference;
 
  270            wxString val = list[ii].m_Value;
 
  271            wxString pkg = list[ii].m_Footprint->GetFPID().GetLibItemName();
 
  272            ref.Replace( wxT( 
" " ), wxT( 
"_" ) );
 
  273            val.Replace( wxT( 
" " ), wxT( 
"_" ) );
 
  274            pkg.Replace( wxT( 
" " ), wxT( 
"_" ) );
 
  275            wxLine.Printf( wxT( 
"%-*s  %-*s  %-*s  %9.4f  %9.4f  %8.4f  %s\n" ),
 
  276                           lenRefText, std::move( ref ),
 
  277                           lenValText, std::move( val ),
 
  278                           lenPkgText, std::move( pkg ),
 
  279                           footprint_pos.
x * conv_unit,
 
  281                           -footprint_pos.
y * conv_unit,
 
  282                           list[ii].m_Footprint->GetOrientation().AsDegrees(),
 
  288        buffer += 
"## End\n";
 
 
  312    buffer += fmt::format( 
"## Printed by KiCad version {}\n", 
TO_UTF8( Title ) );
 
  316    buffer += 
"\n$BeginDESCRIPTION\n";
 
  320    buffer += 
"\n$BOARD\n";
 
  322    buffer += fmt::format( 
"upper_left_corner {:9.6f} {:9.6f}\n",
 
  323              bbbox.
GetX() * conv_unit,
 
  324              bbbox.
GetY() * conv_unit );
 
  326    buffer += 
"$EndBOARD\n\n";
 
  328    std::vector<FOOTPRINT*> sortedFootprints;
 
  331        sortedFootprints.push_back( footprint );
 
  333    std::sort( sortedFootprints.begin(), sortedFootprints.end(),
 
  336                   return StrNumCmp( a->GetReference(), b->GetReference(), true ) < 0;
 
  339    for( 
FOOTPRINT* footprint : sortedFootprints )
 
  341        wxString ref = footprint->Reference().GetShownText( 
false );
 
  342        wxString value = footprint->Value().GetShownText( 
false );
 
  344        buffer += fmt::format( 
"$MODULE {}\n", 
TO_UTF8( ref ) );
 
  346        buffer += fmt::format( 
"reference {}\n", 
TO_UTF8( ref ) );
 
  347        buffer += fmt::format( 
"value {}\n", 
TO_UTF8( value ) );
 
  348        buffer += fmt::format( 
"footprint {}\n", footprint->GetFPID().Format().c_str() );
 
  350        buffer += 
"attribut";
 
  353            buffer += 
" virtual";
 
  355        if( footprint->GetAttributes() & 
FP_SMD )
 
  363        VECTOR2I footprint_pos = footprint->GetPosition();
 
  366        buffer += fmt::format( 
"position {:9.6f} {:9.6f}  orientation {:.2f}\n",
 
  367                  footprint_pos.
x * conv_unit,
 
  368                  footprint_pos.
y * conv_unit,
 
  369                  footprint->GetOrientation().AsDegrees() );
 
  371        if( footprint->GetLayer() == 
F_Cu )
 
  372            buffer += 
"layer front\n";
 
  373        else if( footprint->GetLayer() == 
B_Cu )
 
  374            buffer += 
"layer back\n";
 
  376            buffer += 
"layer other\n";
 
  378        std::vector<PAD*> sortedPads;
 
  380        for( 
PAD* 
pad : footprint->Pads() )
 
  381            sortedPads.push_back( 
pad );
 
  383        std::sort( sortedPads.begin(), sortedPads.end(),
 
  384                   []( 
PAD* a, 
PAD* b ) -> 
bool 
  386                       return StrNumCmp( a->GetNumber(), b->GetNumber(), true ) < 0;
 
  389        for( 
PAD* 
pad : sortedPads )
 
  391            buffer += fmt::format( 
"$PAD \"{}\"\n", 
TO_UTF8( 
pad->GetNumber() ) );
 
  402            static const char* layer_name[4] = { 
"nocopper", 
"back", 
"front", 
"both" };
 
  403            buffer += fmt::format( 
"Shape {} Layer {}\n",
 
  409            buffer += fmt::format( 
"position {:9.6f} {:9.6f} size {:9.6f} {:9.6f} orientation {:.2f}\n",
 
  410                      padPos.
x * conv_unit,
 
  411                      padPos.
y * conv_unit,
 
  414                      pad->GetOrientation().AsDegrees() );
 
  416            buffer += fmt::format( 
"drill {:9.6f}\n", 
pad->GetDrillSize().x * conv_unit );
 
  418            buffer += fmt::format( 
"shape_offset {:9.6f} {:9.6f}\n",
 
  422            buffer += 
"$EndPAD\n";
 
  425        buffer += fmt::format( 
"$EndMODULE {}\n\n", 
TO_UTF8( ref ) );
 
  429    buffer += 
"$EndDESCRIPTION\n";
 
 
PLACE_FILE_EXPORTER(BOARD *aBoard, bool aUnitsMM, bool aOnlySMD, bool aExcludeAllTH, bool aExcludeDNP, bool aExcludeBOM, bool aTopSide, bool aBottomSide, bool aFormatCSV, bool aUseAuxOrigin, bool aNegateBottomX)
Create a PLACE_FILE_EXPORTER.
 
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.