Gerber drill file: Modify a aperture attribute for oblong holes (slots).

Oblong holes (slots) use now a aperture attribute similar to round holes.
(The previous attribute "slot" is now deprecated)
However they have a specific aperture, and a comment is added in drill files for these apertures.
This commit is contained in:
jean-pierre charras 2019-06-20 18:23:54 +02:00
parent 70ff2e14a5
commit 29ca96cfe7
3 changed files with 22 additions and 9 deletions

View File

@ -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,12 +227,17 @@ 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";
// 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;
}
@ -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";
}
}

View File

@ -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
};

View File

@ -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 );