Minor changes: cleanup code and prepare code to add more attributes to Object Attributes (.TO)

This commit is contained in:
jean-pierre charras 2019-09-18 11:48:49 +02:00
parent 9e555cb422
commit a1fe8cfa5a
6 changed files with 50 additions and 13 deletions

View File

@ -226,7 +226,7 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu
attribute_string = "TA.AperFunction,ViaDrill"; attribute_string = "TA.AperFunction,ViaDrill";
break; break;
case GBR_APERTURE_ATTRIB_COMPONENTDRILL: // print info associated to a component case GBR_APERTURE_ATTRIB_CMP_DRILL: // print info associated to a component
// round pad hole in drill files // round pad hole in drill files
attribute_string = "TA.AperFunction,ComponentDrill"; attribute_string = "TA.AperFunction,ComponentDrill";
break; break;
@ -234,9 +234,22 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu
// print info associated to a component oblong pad hole in drill files // 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 // Same as a round pad hole, but is a specific aperture in drill file and
// a G04 comment is added to the aperture function // a G04 comment is added to the aperture function
case GBR_APERTURE_ATTRIB_COMPONENTOBLONGDRILL: case GBR_APERTURE_ATTRIB_CMP_OBLONG_DRILL:
comment_string = "aperture for slot hole"; comment_string = "aperture for slot hole";
attribute_string = "TA.AperFunction,ComponentDrill"; attribute_string = "TA.AperFunction,ComponentDrill";
break;
case GBR_APERTURE_ATTRIB_CMP_POSITION: // print info associated to a component
// flashed shape at the component position
// in placement files
attribute_string = "TA.AperFunction,ComponentMain";
break;
case GBR_APERTURE_ATTRIB_CMP_COURTYARD: // print info associated to a component
// print the component courtyard polygon
// in placement files
attribute_string = "TA.AperFunction,ComponentOutline,Courtyard";
break;
break; break;
} }

View File

@ -161,6 +161,12 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData )
if( !short_attribute_string.empty() ) if( !short_attribute_string.empty() )
fputs( short_attribute_string.c_str(), outputFile ); fputs( short_attribute_string.c_str(), outputFile );
if( m_useX2format && !aData->m_ExtraData.IsEmpty() )
{
std::string extra_data = TO_UTF8( aData->m_ExtraData );
fputs( extra_data.c_str(), outputFile );
}
} }

View File

@ -94,8 +94,11 @@ public:
GBR_APERTURE_ATTRIB_WASHERPAD, ///< aperture used for mechanical pads (NPTH) GBR_APERTURE_ATTRIB_WASHERPAD, ///< aperture used for mechanical pads (NPTH)
GBR_APERTURE_ATTRIB_HEATSINKPAD, ///< aperture used for heat sink pad (typically for SMDs) 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_VIADRILL, ///< aperture used for via holes in drill files
GBR_APERTURE_ATTRIB_COMPONENTDRILL, ///< aperture used for pad holes in drill files GBR_APERTURE_ATTRIB_CMP_DRILL, ///< aperture used for pad holes in drill files
GBR_APERTURE_ATTRIB_COMPONENTOBLONGDRILL, ///< aperture used for pads oblong holes in drill files GBR_APERTURE_ATTRIB_CMP_OBLONG_DRILL, ///< aperture used for pads oblong holes in drill files
GBR_APERTURE_ATTRIB_CMP_POSITION, ///< aperture used for flashed shape in placement files
GBR_APERTURE_ATTRIB_CMP_COURTYARD, ///< aperture used to draw component outline courtyard
///< in placement files
GBR_APERTURE_ATTRIB_END ///< sentinel: max value GBR_APERTURE_ATTRIB_END ///< sentinel: max value
}; };

View File

@ -62,10 +62,28 @@ public:
wxString m_Cmpref; ///< the component reference parent of the data wxString m_Cmpref; ///< the component reference parent of the data
wxString m_Netname; ///< for items associated to a net: the netname 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"
GBR_NETLIST_METADATA(): m_NetAttribType( GBR_NETINFO_UNSPECIFIED ), m_NotInNet( false ) GBR_NETLIST_METADATA(): m_NetAttribType( GBR_NETINFO_UNSPECIFIED ), m_NotInNet( false )
{ {
} }
/** Clear the extra data string printed at end of net attributes
*/
void ClearExtraData()
{
m_ExtraData.Clear();
}
/** Set the extra data string printed at end of net attributes
*/
void SetExtraData( const wxString& aExtraData)
{
m_ExtraData = aExtraData;
}
/** /**
* remove the net attribute specified by aName * remove the net attribute specified by aName
* If aName == NULL or empty, remove all attributes * If aName == NULL or empty, remove all attributes

View File

@ -277,7 +277,8 @@ public:
/** /**
* Function PlotPoly * Function PlotPoly
* @brief Draw a polygon ( filled or not ) * @brief Draw a polygon ( filled or not )
* @param aCornerList = corners list (a SHAPE_LINE_CHAIN) * @param aCornerList = corners list (a SHAPE_LINE_CHAIN).
* must be closed (IsClosed() == true) for a polygon. Otherwise this is a polyline
* @param aFill = type of fill * @param aFill = type of fill
* @param aWidth = line width * @param aWidth = line width
* @param aData an auxiliary info (mainly for gerber format) * @param aData an auxiliary info (mainly for gerber format)

View File

@ -195,18 +195,14 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
// Good practice of oblong pad holes (slots) is to use a specific aperture for routing, not used // Good practice of oblong pad holes (slots) is to use a specific aperture for routing, not used
// in drill commands // in drill commands
if( hole_descr.m_Hole_Shape ) if( hole_descr.m_Hole_Shape )
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_COMPONENTOBLONGDRILL ); gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_OBLONG_DRILL );
else else
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_COMPONENTDRILL ); gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_DRILL );
// Add object attribute: component reference to pads (mainly usefull for users) // Add object attribute: component reference to pads (mainly usefull for users)
const D_PAD* pad = dyn_cast<const D_PAD*>( hole_descr.m_ItemParent ); const D_PAD* pad = dyn_cast<const D_PAD*>( hole_descr.m_ItemParent );
wxString ref = pad->GetParent()->GetReference(); wxString ref = pad->GetParent()->GetReference();
#if 0 // Set to 1 to force a dummy reference for the parent pad.
if( ref.IsEmpty() )
ref = "<undefinedref>";
#endif
gbr_metadata.SetCmpReference( ref ); gbr_metadata.SetCmpReference( ref );
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP ); gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
} }