KiCad PCB EDA Suite
Loading...
Searching...
No Matches
router_tool.cpp File Reference
#include <wx/hyperlink.h>
#include <advanced_config.h>
#include <functional>
#include <iomanip>
#include <utility>
#include <sstream>
#include <board.h>
#include <board_design_settings.h>
#include <board_item.h>
#include <footprint.h>
#include <pad.h>
#include <zone.h>
#include <pcb_edit_frame.h>
#include <pcbnew_id.h>
#include <dialogs/dialog_pns_settings.h>
#include <dialogs/dialog_pns_diff_pair_dimensions.h>
#include <dialogs/dialog_track_via_size.h>
#include <math/vector2wx.h>
#include <widgets/wx_infobar.h>
#include <widgets/appearance_controls.h>
#include <connectivity/connectivity_data.h>
#include <connectivity/connectivity_algo.h>
#include <confirm.h>
#include <bitmaps.h>
#include <string_utils.h>
#include <painter.h>
#include <tool/action_menu.h>
#include <tool/tool_manager.h>
#include <tool/tool_menu.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_grid_helper.h>
#include <tools/drc_tool.h>
#include <tools/zone_filler_tool.h>
#include <drc/drc_interactive_courtyard_clearance.h>
#include <project.h>
#include <project/project_file.h>
#include "router_tool.h"
#include "pns_segment.h"
#include "pns_router.h"
#include "pns_itemset.h"
#include "pns_logger.h"
#include "pns_placement_algo.h"
#include "pns_line_placer.h"
#include "pns_topology.h"
#include "pns_kicad_iface.h"
#include <ratsnest/ratsnest_data.h>
#include <plugins/kicad/pcb_plugin.h>

Go to the source code of this file.

Classes

class  TRACK_WIDTH_MENU
 
class  DIFF_PAIR_MENU
 

Macros

#define _(s)   s
 
#define _(s)   wxGetTranslation((s))
 
#define FORMAT_VALUE(x)   frame()->MessageTextFromValue( x )
 

Enumerations

enum  VIA_ACTION_FLAGS {
  VIA_MASK = 0x03 , VIA = 0x00 , BLIND_VIA = 0x01 , MICROVIA = 0x02 ,
  SELECT_LAYER = VIA_MASK + 1
}
 Flags used by via tool actions. More...
 

Functions

static VIATYPE getViaTypeFromFlags (int aFlags)
 
static PCB_LAYER_ID getTargetLayerFromEvent (const TOOL_EVENT &aEvent)
 

Variables

static const TOOL_ACTION ACT_EndTrack ("pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END, "", _("Finish Track"), _("Stops laying the current track."), BITMAPS::checked_ok)
 
static const TOOL_ACTION ACT_PlaceThroughVia ("pcbnew.InteractiveRouter.PlaceVia", AS_CONTEXT, 'V', LEGACY_HK_NAME("Add Through Via"), _("Place Through Via"), _("Adds a through-hole via at the end of currently routed track."), BITMAPS::via, AF_NONE,(void *) VIA_ACTION_FLAGS::VIA)
 
static const TOOL_ACTION ACT_PlaceBlindVia ("pcbnew.InteractiveRouter.PlaceBlindVia", AS_CONTEXT, MD_ALT+MD_SHIFT+ 'V', LEGACY_HK_NAME("Add Blind/Buried Via"), _("Place Blind/Buried Via"), _("Adds a blind or buried via at the end of currently routed track."), BITMAPS::via_buried, AF_NONE,(void *) VIA_ACTION_FLAGS::BLIND_VIA)
 
static const TOOL_ACTION ACT_PlaceMicroVia ("pcbnew.InteractiveRouter.PlaceMicroVia", AS_CONTEXT, MD_CTRL+ 'V', LEGACY_HK_NAME("Add MicroVia"), _("Place Microvia"), _("Adds a microvia at the end of currently routed track."), BITMAPS::via_microvia, AF_NONE,(void *) VIA_ACTION_FLAGS::MICROVIA)
 
static const TOOL_ACTION ACT_SelLayerAndPlaceThroughVia ("pcbnew.InteractiveRouter.SelLayerAndPlaceVia", AS_CONTEXT, '<', LEGACY_HK_NAME("Select Layer and Add Through Via"), _("Select Layer and Place Through Via..."), _("Select a layer, then add a through-hole via at the end of currently routed track."), BITMAPS::select_w_layer, AF_NONE,(void *)(VIA_ACTION_FLAGS::VIA|VIA_ACTION_FLAGS::SELECT_LAYER))
 
static const TOOL_ACTION ACT_SelLayerAndPlaceBlindVia ("pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia", AS_CONTEXT, MD_ALT+'<', LEGACY_HK_NAME("Select Layer and Add Blind/Buried Via"), _("Select Layer and Place Blind/Buried Via..."), _("Select a layer, then add a blind or buried via at the end of currently routed track."), BITMAPS::select_w_layer, AF_NONE,(void *)(VIA_ACTION_FLAGS::BLIND_VIA|VIA_ACTION_FLAGS::SELECT_LAYER))
 
static const TOOL_ACTION ACT_SelLayerAndPlaceMicroVia ("pcbnew.InteractiveRouter.SelLayerAndPlaceMicroVia", AS_CONTEXT, 0, "", _("Select Layer and Place Micro Via..."), _("Select a layer, then add a micro via at the end of currently routed track."), BITMAPS::select_w_layer, AF_NONE,(void *)(VIA_ACTION_FLAGS::MICROVIA|VIA_ACTION_FLAGS::SELECT_LAYER))
 
static const TOOL_ACTION ACT_CustomTrackWidth ("pcbnew.InteractiveRouter.CustomTrackViaSize", AS_CONTEXT, 'Q', LEGACY_HK_NAME("Custom Track/Via Size"), _("Custom Track/Via Size..."), _("Shows a dialog for changing the track width and via size."), BITMAPS::width_track)
 
static const TOOL_ACTION ACT_SwitchPosture ("pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT, '/', LEGACY_HK_NAME("Switch Track Posture"), _("Switch Track Posture"), _("Switches posture of the currently routed track."), BITMAPS::change_entry_orient)
 
static const TOOL_ACTION ACT_SwitchCornerMode ("pcbnew.InteractiveRouter.SwitchRounding", AS_CONTEXT, MD_CTRL+'/', "", _("Track Corner Mode"), _("Switches between sharp/rounded and 45°/90° corners when routing tracks."), BITMAPS::switch_corner_rounding_shape)
 

Macro Definition Documentation

◆ _ [1/2]

#define _ (   s)    s

Definition at line 180 of file router_tool.cpp.

◆ _ [2/2]

#define _ (   s)    wxGetTranslation((s))

Definition at line 180 of file router_tool.cpp.

◆ FORMAT_VALUE

#define FORMAT_VALUE (   x)    frame()->MessageTextFromValue( x )

Enumeration Type Documentation

◆ VIA_ACTION_FLAGS

Flags used by via tool actions.

Enumerator
VIA_MASK 
VIA 

Normal via.

BLIND_VIA 

blind/buried via

MICROVIA 

Microvia.

SELECT_LAYER 

Ask user to select layer before adding via.

Definition at line 85 of file router_tool.cpp.

Function Documentation

◆ getTargetLayerFromEvent()

◆ getViaTypeFromFlags()

static VIATYPE getViaTypeFromFlags ( int  aFlags)
static

Definition at line 776 of file router_tool.cpp.

References BLIND_BURIED, BLIND_VIA, MICROVIA, THROUGH, VIA, and VIA_MASK.

Referenced by ROUTER_TOOL::handleLayerSwitch().

Variable Documentation

◆ ACT_CustomTrackWidth

const TOOL_ACTION ACT_CustomTrackWidth("pcbnew.InteractiveRouter.CustomTrackViaSize", AS_CONTEXT, 'Q', LEGACY_HK_NAME("Custom Track/Via Size"), _("Custom Track/Via Size..."), _("Shows a dialog for changing the track width and via size."), BITMAPS::width_track) ( "pcbnew.InteractiveRouter.CustomTrackViaSize"  ,
AS_CONTEXT  ,
'Q'  ,
LEGACY_HK_NAME("Custom Track/Via Size")  ,
_("Custom Track/Via Size...")  ,
_("Shows a dialog for changing the track width and via size.")  ,
BITMAPS::width_track   
)
static

◆ ACT_EndTrack

const TOOL_ACTION ACT_EndTrack("pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END, "", _("Finish Track"), _("Stops laying the current track."), BITMAPS::checked_ok) ( "pcbnew.InteractiveRouter.EndTrack"  ,
AS_CONTEXT  ,
WXK_END  ,
""  ,
_("Finish Track")  ,
_("Stops laying the current track.")  ,
BITMAPS::checked_ok   
)
static

◆ ACT_PlaceBlindVia

const TOOL_ACTION ACT_PlaceBlindVia("pcbnew.InteractiveRouter.PlaceBlindVia", AS_CONTEXT, MD_ALT+MD_SHIFT+'V', LEGACY_HK_NAME("Add Blind/Buried Via"), _("Place Blind/Buried Via"), _("Adds a blind or buried via at the end of currently routed track."), BITMAPS::via_buried, AF_NONE,(void *) VIA_ACTION_FLAGS::BLIND_VIA) ( "pcbnew.InteractiveRouter.PlaceBlindVia"  ,
AS_CONTEXT  ,
MD_ALT+MD_SHIFT+ 'V'  ,
LEGACY_HK_NAME("Add Blind/Buried Via")  ,
_("Place Blind/Buried Via")  ,
_("Adds a blind or buried via at the end of currently routed track.")  ,
BITMAPS::via_buried  ,
AF_NONE  ,
(void *) VIA_ACTION_FLAGS::BLIND_VIA   
)
static

◆ ACT_PlaceMicroVia

const TOOL_ACTION ACT_PlaceMicroVia("pcbnew.InteractiveRouter.PlaceMicroVia", AS_CONTEXT, MD_CTRL+'V', LEGACY_HK_NAME("Add MicroVia"), _("Place Microvia"), _("Adds a microvia at the end of currently routed track."), BITMAPS::via_microvia, AF_NONE,(void *) VIA_ACTION_FLAGS::MICROVIA) ( "pcbnew.InteractiveRouter.PlaceMicroVia"  ,
AS_CONTEXT  ,
MD_CTRL+ 'V'  ,
LEGACY_HK_NAME("Add MicroVia")  ,
_("Place Microvia")  ,
_("Adds a microvia at the end of currently routed track.")  ,
BITMAPS::via_microvia  ,
AF_NONE  ,
(void *) VIA_ACTION_FLAGS::MICROVIA   
)
static

◆ ACT_PlaceThroughVia

const TOOL_ACTION ACT_PlaceThroughVia("pcbnew.InteractiveRouter.PlaceVia", AS_CONTEXT, 'V', LEGACY_HK_NAME("Add Through Via"), _("Place Through Via"), _("Adds a through-hole via at the end of currently routed track."), BITMAPS::via, AF_NONE,(void *) VIA_ACTION_FLAGS::VIA) ( "pcbnew.InteractiveRouter.PlaceVia"  ,
AS_CONTEXT  ,
'V'  ,
LEGACY_HK_NAME("Add Through Via")  ,
_("Place Through Via")  ,
_("Adds a through-hole via at the end of currently routed track.")  ,
BITMAPS::via  ,
AF_NONE  ,
(void *) VIA_ACTION_FLAGS::VIA   
)
static

◆ ACT_SelLayerAndPlaceBlindVia

const TOOL_ACTION ACT_SelLayerAndPlaceBlindVia("pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia", AS_CONTEXT, MD_ALT+'<', LEGACY_HK_NAME("Select Layer and Add Blind/Buried Via"), _("Select Layer and Place Blind/Buried Via..."), _("Select a layer, then add a blind or buried via at the end of currently routed track."), BITMAPS::select_w_layer, AF_NONE,(void *)(VIA_ACTION_FLAGS::BLIND_VIA|VIA_ACTION_FLAGS::SELECT_LAYER)) ( "pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia"  ,
AS_CONTEXT   
)
static

◆ ACT_SelLayerAndPlaceMicroVia

const TOOL_ACTION ACT_SelLayerAndPlaceMicroVia("pcbnew.InteractiveRouter.SelLayerAndPlaceMicroVia", AS_CONTEXT, 0, "", _("Select Layer and Place Micro Via..."), _("Select a layer, then add a micro via at the end of currently routed track."), BITMAPS::select_w_layer, AF_NONE,(void *)(VIA_ACTION_FLAGS::MICROVIA|VIA_ACTION_FLAGS::SELECT_LAYER)) ( "pcbnew.InteractiveRouter.SelLayerAndPlaceMicroVia"  ,
AS_CONTEXT  ,
,
""  ,
_("Select Layer and Place Micro Via...")  ,
_("Select a layer, then add a micro via at the end of currently routed track.")  ,
BITMAPS::select_w_layer  ,
AF_NONE  ,
(void *)(VIA_ACTION_FLAGS::MICROVIA|VIA_ACTION_FLAGS::SELECT_LAYER  
)
static

◆ ACT_SelLayerAndPlaceThroughVia

const TOOL_ACTION ACT_SelLayerAndPlaceThroughVia("pcbnew.InteractiveRouter.SelLayerAndPlaceVia", AS_CONTEXT, '<', LEGACY_HK_NAME("Select Layer and Add Through Via"), _("Select Layer and Place Through Via..."), _("Select a layer, then add a through-hole via at the end of currently routed track."), BITMAPS::select_w_layer, AF_NONE,(void *)(VIA_ACTION_FLAGS::VIA|VIA_ACTION_FLAGS::SELECT_LAYER)) ( "pcbnew.InteractiveRouter.SelLayerAndPlaceVia"  ,
AS_CONTEXT   
)
static

◆ ACT_SwitchCornerMode

const TOOL_ACTION ACT_SwitchCornerMode("pcbnew.InteractiveRouter.SwitchRounding", AS_CONTEXT, MD_CTRL+'/', "", _("Track Corner Mode"), _("Switches between sharp/rounded and 45°/90° corners when routing tracks."), BITMAPS::switch_corner_rounding_shape) ( "pcbnew.InteractiveRouter.SwitchRounding"  ,
AS_CONTEXT  ,
MD_CTRL+'/'  ,
""  ,
_("Track Corner Mode")  ,
_("Switches between sharp/rounded and 45°/90° corners when routing tracks.")  ,
BITMAPS::switch_corner_rounding_shape   
)
static

◆ ACT_SwitchPosture

const TOOL_ACTION ACT_SwitchPosture("pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT, '/', LEGACY_HK_NAME("Switch Track Posture"), _("Switch Track Posture"), _("Switches posture of the currently routed track."), BITMAPS::change_entry_orient) ( "pcbnew.InteractiveRouter.SwitchPosture"  ,
AS_CONTEXT  ,
'/'  ,
LEGACY_HK_NAME("Switch Track Posture")  ,
_("Switch Track Posture")  ,
_("Switches posture of the currently routed track.")  ,
BITMAPS::change_entry_orient   
)
static