diff --git a/common/gbr_metadata.cpp b/common/gbr_metadata.cpp index 8be1349245..1cc2e54688 100644 --- a/common/gbr_metadata.cpp +++ b/common/gbr_metadata.cpp @@ -150,7 +150,8 @@ wxString GbrMakeProjectGUIDfromString( wxString& aText ) std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribute, bool aUseX1StructuredComment ) { - std::string attribute_string; + std::string attribute_string; // the specific aperture attribute (TA.xxx) + std::string comment_string; // a optional G04 comment line to write before the TA. line // generate a string to print a Gerber Aperture attribute switch( aAttribute ) @@ -226,13 +227,18 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu break; case GBR_APERTURE_ATTRIB_COMPONENTDRILL: // print info associated to a component - // round hole in drill files + // round pad hole in drill files attribute_string = "TA.AperFunction,ComponentDrill"; break; - case GBR_APERTURE_ATTRIB_SLOTDRILL: // print info associated to a oblong hole in drill files - attribute_string = "TA.AperFunction,Slot"; - break; + // print info associated to a component oblong pad hole in drill files + // Same as a round pad hole, but is a specific aperture in drill file and + // a G04 comment is added to the aperture function + case GBR_APERTURE_ATTRIB_COMPONENTOBLONGDRILL: + comment_string = "aperture for slot hole"; + attribute_string = "TA.AperFunction,ComponentDrill"; + + break; } std::string full_attribute_string; @@ -240,14 +246,19 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu if( !attribute_string.empty() ) { + if( !comment_string.empty() ) + { + full_attribute_string = "G04 " + comment_string + "*\n"; + } + if( aUseX1StructuredComment ) { - full_attribute_string = "G04 #@! "; + full_attribute_string += "G04 #@! "; eol_string = "*\n"; } else { - full_attribute_string = "%"; + full_attribute_string += "%"; eol_string = "*%\n"; } } diff --git a/include/gbr_metadata.h b/include/gbr_metadata.h index 223304b749..ef0a0c4fce 100644 --- a/include/gbr_metadata.h +++ b/include/gbr_metadata.h @@ -95,7 +95,7 @@ public: GBR_APERTURE_ATTRIB_HEATSINKPAD, ///< aperture used for heat sink pad (typically for SMDs) GBR_APERTURE_ATTRIB_VIADRILL, ///< aperture used for via holes in drill files GBR_APERTURE_ATTRIB_COMPONENTDRILL, ///< aperture used for pad holes in drill files - GBR_APERTURE_ATTRIB_SLOTDRILL, ///< aperture used for oblong holes in drill files + GBR_APERTURE_ATTRIB_COMPONENTOBLONGDRILL, ///< aperture used for pads oblong holes in drill files GBR_APERTURE_ATTRIB_END ///< sentinel: max value }; diff --git a/pcbnew/exporters/gendrill_gerber_writer.cpp b/pcbnew/exporters/gendrill_gerber_writer.cpp index 421afc6b02..e8c1dd75c3 100644 --- a/pcbnew/exporters/gendrill_gerber_writer.cpp +++ b/pcbnew/exporters/gendrill_gerber_writer.cpp @@ -192,8 +192,10 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth, { last_item_is_via = false; + // Good practice of oblong pad holes (slots) is to use a specific aperture for routing, not used + // in drill commands if( hole_descr.m_Hole_Shape ) - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_SLOTDRILL ); + gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_COMPONENTOBLONGDRILL ); else gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_COMPONENTDRILL );