DIALOG_COPPER_ZONE: add option to set the pitch of hatches around the zone outlines

This parameter exists since the beginning, but never show in this dialog
This commit is contained in:
jean-pierre charras 2022-02-12 17:37:27 +01:00
parent 81b4229e12
commit d553d620c1
9 changed files with 258 additions and 22 deletions

View File

@ -68,6 +68,7 @@ private:
int m_cornerSmoothingType;
int m_maxNetCode;
int m_currentlySelectedNetcode;
UNIT_BINDER m_outlineHatchPitch;
UNIT_BINDER m_cornerRadius;
UNIT_BINDER m_clearance;
@ -165,6 +166,8 @@ static bool sortNetsByNames( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
DIALOG_COPPER_ZONE_BASE( aParent ),
m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
m_outlineHatchPitch( aParent, m_stBorderHatchPitchText,
m_outlineHatchPitchCtrl, m_outlineHatchUnits ),
m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits ),
m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits ),
@ -225,6 +228,8 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: m_OutlineDisplayCtrl->SetSelection( 2 ); break;
}
m_outlineHatchPitch.SetValue( m_settings.m_BorderHatchPitch );
m_clearance.SetValue( m_settings.m_ZoneClearance );
m_minWidth.SetValue( m_settings.m_ZoneMinThickness );
@ -479,6 +484,12 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
case 2: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
}
if( !m_outlineHatchPitch.Validate( Millimeter2iu( ZONE_BORDER_HATCH_MINDIST_MM ),
Millimeter2iu( ZONE_BORDER_HATCH_MAXDIST_MM ) ) )
return false;
m_settings.m_BorderHatchPitch = m_outlineHatchPitch.GetValue();
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_ZoneBorderDisplayStyle );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -140,6 +140,17 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_OutlineDisplayCtrl->SetSelection( 0 );
gbSizer1->Add( m_OutlineDisplayCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_stBorderHatchPitchText = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Outline hatch dist:"), wxDefaultPosition, wxDefaultSize, 0 );
m_stBorderHatchPitchText->Wrap( -1 );
gbSizer1->Add( m_stBorderHatchPitchText, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_outlineHatchPitchCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_outlineHatchPitchCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_outlineHatchUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_outlineHatchUnits->Wrap( -1 );
gbSizer1->Add( m_outlineHatchUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticline1 = new wxStaticLine( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
gbSizer1->Add( m_staticline1, wxGBPosition( 3, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">dialog_copper_zones_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_copper_zones_base</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -50,6 +52,7 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Copper Zone Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1079,6 +1082,201 @@
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Outline hatch dist:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_stBorderHatchPitchText</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_CORNERSMOOTHINGCTRL</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_outlineHatchPitchCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">mm</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_outlineHatchUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">3</property>
@ -3895,6 +4093,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -28,10 +28,10 @@
#include <wx/choice.h>
#include <wx/statline.h>
#include <wx/gbsizer.h>
#include <wx/button.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -51,8 +51,8 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
ID_NETNAME_SELECTION,
ID_M_PRIORITYLEVELCTRL,
ID_M_OUTLINEAPPEARANCECTRL,
ID_CORNER_SMOOTHING,
ID_M_CORNERSMOOTHINGCTRL,
ID_CORNER_SMOOTHING,
ID_M_PADINZONEOPT,
wxID_ANTIPAD_SIZE,
wxID_COPPER_BRIDGE_VALUE,
@ -74,6 +74,9 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
wxCheckBox* m_cbLocked;
wxStaticText* m_staticTextStyle;
wxChoice* m_OutlineDisplayCtrl;
wxStaticText* m_stBorderHatchPitchText;
wxTextCtrl* m_outlineHatchPitchCtrl;
wxStaticText* m_outlineHatchUnits;
wxStaticLine* m_staticline1;
wxStaticText* m_staticTextSmoothing;
wxChoice* m_cornerSmoothingChoice;
@ -121,7 +124,7 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); }
@ -137,6 +140,7 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
public:
DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Copper Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_COPPER_ZONE_BASE();
};

View File

@ -797,18 +797,23 @@ int ZONE::GetBorderHatchPitch() const
}
void ZONE::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch,
bool aRebuildHatch )
void ZONE::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle,
int aBorderHatchPitch,
bool aRebuildBorderHatch )
{
SetHatchPitch( aHatchPitch );
m_borderStyle = aHatchStyle;
aBorderHatchPitch = std::max( aBorderHatchPitch,
Millimeter2iu( ZONE_BORDER_HATCH_MINDIST_MM ) );
aBorderHatchPitch = std::min( aBorderHatchPitch,
Millimeter2iu( ZONE_BORDER_HATCH_MAXDIST_MM ) );
SetBorderHatchPitch( aBorderHatchPitch );
m_borderStyle = aBorderHatchStyle;
if( aRebuildHatch )
if( aRebuildBorderHatch )
HatchBorder();
}
void ZONE::SetHatchPitch( int aPitch )
void ZONE::SetBorderHatchPitch( int aPitch )
{
m_borderHatchPitch = aPitch;
}
@ -991,7 +996,7 @@ void ZONE::HatchBorder()
int ZONE::GetDefaultHatchPitch()
{
return Mils2iu( 20 );
return Mils2iu( ZONE_BORDER_HATCH_DIST_MIL );
}

View File

@ -787,21 +787,21 @@ public:
/**
* Set all hatch parameters for the zone.
*
* @param aHatchStyle is the style of the hatch, specified as one of HATCH_STYLE possible
* values.
* @param aHatchPitch is the hatch pitch in iu.
* @param aRebuildHatch is a flag to indicate whether to re-hatch after having set the
* @param aBorderHatchStyle is the style of the hatch, specified as one of HATCH_STYLE
possible values.
* @param aBorderHatchPitch is the hatch pitch in iu.
* @param aRebuildBorderHatch is a flag to indicate whether to re-hatch after having set the
* previous parameters.
*/
void SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch,
bool aRebuildHatch );
void SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle, int aBorderHatchPitch,
bool aRebuilBorderdHatch );
/**
* Set the hatch pitch parameter for the zone.
*
* @param aPitch is the hatch pitch in iu.
*/
void SetHatchPitch( int aPitch );
void SetBorderHatchPitch( int aPitch );
/**
* Clear the zone's hatch.

View File

@ -59,6 +59,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; // Option to show the zone
// outlines only, short
// hatches or full hatches
m_BorderHatchPitch = Mils2iu( ZONE_BORDER_HATCH_DIST_MIL );
m_Layers.reset().set( F_Cu );
m_Name = wxEmptyString;
@ -104,6 +105,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE& aSource )
m_NetcodeSelection = aSource.GetNetCode();
m_Name = aSource.GetZoneName();
m_ZoneBorderDisplayStyle = aSource.GetHatchStyle();
m_BorderHatchPitch = aSource.GetBorderHatchPitch();
m_ThermalReliefGap = aSource.GetThermalReliefGap();
m_ThermalReliefSpokeWidth = aSource.GetThermalReliefSpokeWidth();
m_padConnection = aSource.GetPadConnection();
@ -166,8 +168,8 @@ void ZONE_SETTINGS::ExportSetting( ZONE& aTarget, bool aFullExport ) const
// call SetBorderDisplayStyle last, because hatch lines will be rebuilt,
// using new parameters values
aTarget.SetBorderDisplayStyle( m_ZoneBorderDisplayStyle, aTarget.GetDefaultHatchPitch(),
true );
aTarget.SetBorderDisplayStyle( m_ZoneBorderDisplayStyle,
m_BorderHatchPitch, true );
}

View File

@ -99,6 +99,7 @@ public:
/// Option to show the zone area (outlines only, short hatches or full hatches
ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle;
int m_BorderHatchPitch; // for hatched outlines: dist between 2 hatches
long m_ThermalReliefGap; // thickness of the gap in thermal reliefs
long m_ThermalReliefSpokeWidth; // thickness of the copper bridge in thermal reliefs

View File

@ -34,6 +34,9 @@
#define ZONE_THICKNESS_MIN_VALUE_MIL 1 // minimum acceptable value for ZONE_SETTINGS::m_ZoneMinThickness
#define ZONE_CLEARANCE_MIL 20 // default value for ZONE_SETTINGS::m_ZoneClearance
#define ZONE_CLEARANCE_MAX_VALUE_MIL 500 // maximum acceptable value for ZONE_SETTINGS::m_ZoneClearance
#define ZONE_BORDER_HATCH_DIST_MIL 20 // default distance between hatches to draw hatched outlines
#define ZONE_BORDER_HATCH_MINDIST_MM 0.1 // min distance between hatches to draw hatched outlines
#define ZONE_BORDER_HATCH_MAXDIST_MM 2.0 // min distance between hatches to draw hatched outlines
#define ZONE_EXPORT_VALUES 1004 // Copper zone dialog reports wxID_OK, wxID_CANCEL or