Commit 2caa72f0 authored by Александр Закамалдин's avatar Александр Закамалдин Committed by Dick Hollenbeck
Browse files

This patch implements width tuning (width correction) for PS plotting of tracks, pads and vias.

This feature is very useful for electronics hobbyists who use DIY PCB technology 
(both toner transfer and photoresist methods).
Also width correction may be useful for PCB designers who take care of track width etching.
This patch also fixes some minor PS plotting issues.
parent c3c6b9ef
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -491,16 +491,18 @@ void PS_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
                                   EDA_DRAW_MODE_T modetrace )
{
    int current_line_width;
    wxASSERT( output_file );

    set_current_line_width( -1 );
    if( current_pen_width >= diametre )
        set_current_line_width( diametre );
    current_line_width = get_current_line_width();
    if( current_line_width > diametre )
        current_line_width = diametre;

    if( modetrace == FILLED )
        circle( pos, diametre - current_pen_width, FILLED_SHAPE );
        circle( pos, diametre - current_pen_width, FILLED_SHAPE, current_line_width );
    else
        circle( pos, diametre - current_pen_width, NO_FILL );
        circle( pos, diametre - current_pen_width, NO_FILL, current_line_width );

    set_current_line_width( -1 );
}
+15 −0
Original line number Diff line number Diff line
@@ -71,6 +71,20 @@ public:
    virtual void set_color( int color )  = 0;
    virtual void set_dash( bool dashed ) = 0;

    virtual int get_current_line_width()
    {
        return current_pen_width;
    }

    virtual void set_plot_width_adj( double width )
    {
    }

    virtual double get_plot_width_adj()
    {
        return 0.;
    }

    virtual void set_creator( const wxString& _creator )
    {
        creator = _creator;
@@ -390,6 +404,7 @@ public:

protected:
    double plot_scale_adjX, plot_scale_adjY;
    double plot_width_adj;
};

/* Class to handle a D_CODE when plotting a board : */
+15 −0
Original line number Diff line number Diff line
@@ -286,6 +286,21 @@ int BOARD::GetBiggestClearanceValue()
}


int BOARD::GetSmallestClearanceValue()
{
    int clearance = m_NetClasses.GetDefault()->GetClearance();

    //Read list of Net Classes
    for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
    {
        NETCLASS* netclass = nc->second;
        clearance = MIN( clearance, netclass->GetClearance() );
    }

    return clearance;
}


int BOARD::GetCurrentMicroViaSize()
{
    NETCLASS* netclass = m_NetClasses.Find( m_CurrentNetClassName );
+6 −0
Original line number Diff line number Diff line
@@ -816,6 +816,12 @@ public:
     */
    int GetBiggestClearanceValue();

    /**
     * Function GetSmallestClearanceValue
     * @return the smallest clearance value found in NetClasses list
     */
    int GetSmallestClearanceValue();

    /**
     * Function GetCurrentTrackWidth
     * @return the current track width, according to the selected options
+14 −1
Original line number Diff line number Diff line
@@ -179,7 +179,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
	m_GerberOptionsSizer->Add( m_excludeEdgeLayerOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
	
	m_subtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Subtract soldermask from silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
	m_subtractMaskFromSilk->SetValue(true); 
	m_subtractMaskFromSilk->SetToolTip( _("Remove silkscreen from areas without soldermask") );
	
	m_GerberOptionsSizer->Add( m_subtractMaskFromSilk, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
@@ -268,6 +267,20 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
	
	bSizer17->Add( bSizer19, 1, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer191;
	bSizer191 = new wxBoxSizer( wxVERTICAL );
	
	m_textPSFineAdjustWidth = new wxStaticText( this, wxID_ANY, _("Width correction"), wxDefaultPosition, wxDefaultSize, 0 );
	m_textPSFineAdjustWidth->Wrap( -1 );
	bSizer191->Add( m_textPSFineAdjustWidth, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
	
	m_PSFineAdjustWidthOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_PSFineAdjustWidthOpt->SetToolTip( _("Set global width correction for exact width postscript output.\nThese width correction is intended to compensate tracks width and also pads and vias size errors.\nThe reasonable width correction value must be in a range of [-(MinTrackWidth-1), +(MinClearanceValue-1)] in decimils.") );
	
	bSizer191->Add( m_PSFineAdjustWidthOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
	
	bSizer17->Add( bSizer191, 1, wxEXPAND, 5 );
	
	m_PSOptionsSizer->Add( bSizer17, 1, wxEXPAND, 5 );
	
	m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
Loading