KiCAD pcbnew scripting
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
pcbnew.TRACK Class Reference
Inheritance diagram for pcbnew.TRACK:
Inheritance graph

Public Member Functions

def ClassOf (aItem)
def __init__
def Next (self)
def Back (self)
def Move (self, aMoveVector)
def Rotate (self, aRotCentre, aAngle)
def Flip (self, aCentre)
def SetPosition (self, aPos)
def GetPosition (self)
def SetWidth (self, aWidth)
def GetWidth (self)
def SetEnd (self, aEnd)
def GetEnd (self)
def SetStart (self, aStart)
def GetStart (self)
def GetEndPoint (self, aEndPoint)
def GetBoundingBox (self)
def IsLocked (self)
def SetLocked (self, aLocked)
def GetBestInsertPoint (self, aPcb)
def GetStartNetCode (self, NetCode)
def GetEndNetCode (self, NetCode)
def GetLength (self)
def Draw (self, args)
def TransformShapeWithClearanceToPolygon (self, aCornerBuffer, aClearanceValue, aCircleToSegmentsCount, aCorrectionFactor)
def IsPointOnEnds
def IsNull (self)
def GetMsgPanelInfo (self, aList)
def ShowWidth (self)
def Visit (self, inspector, testData, scanTypes)
def HitTest (self, args)
def GetVia (self, args)
def GetTrack (self, aStartTrace, aEndTrace, aEndPoint, aSameNetOnly, aSequential)
def GetEndSegments (self, NbSegm, StartTrack, EndTrack)
def GetClass (self)
def GetClearance
def GetSelectMenuText (self)
def GetMenuImage (self)
def Clone (self)
def ViewGetLayers (self, aLayers, aCount)
def ViewGetLOD (self, aLayer, aView)
- Public Member Functions inherited from pcbnew.BOARD_CONNECTED_ITEM
def __init__ (self, args, kwargs)
def ClassOf (aItem)
def IsConnected (self)
def GetNet (self)
def SetNet (self, aNetInfo)
def GetNetCode (self)
def SetNetCode
def GetSubNet (self)
def SetSubNet (self, aSubNetCode)
def GetZoneSubNet (self)
def SetZoneSubNet (self, aSubNetCode)
def GetNetname (self)
def GetShortNetname (self)
def GetClearance
def GetNetClass (self)
def GetNetClassName (self)
- Public Member Functions inherited from pcbnew.BOARD_ITEM
def __init__ (self, args, kwargs)
def GetPosition (self)
def GetCenter (self)
def SetPosition (self, aPos)
def IsConnected (self)
def Next (self)
def Back (self)
def GetParent (self)
def GetLayer (self)
def GetLayerSet (self)
def SetLayer (self, aLayer)
def Draw (self, args)
def SwapData (self, aImage)
def IsOnLayer (self, aLayer)
def IsTrack (self)
def IsLocked (self)
def SetLocked (self, aLocked)
def UnLink (self)
def DeleteStructure (self)
def ShowShape (aShape)
def Move (self, aMoveVector)
def Rotate (self, aRotCentre, aAngle)
def Flip (self, aCentre)
def GetBoard (self)
def GetLayerName (self)
def HitTest (self, args)
def FormatAngle (aAngle)
def FormatInternalUnits (args)
def ViewGetLayers (self, aLayers, aCount)
def Cast (self)
def Duplicate (self)
def SetPos (self, p)
def SetStartEnd (self, start, end)
- Public Member Functions inherited from pcbnew.EDA_ITEM
def __init__ (self, args, kwargs)
def Type (self)
def SetTimeStamp (self, aNewTimeStamp)
def GetTimeStamp (self)
def Next (self)
def Back (self)
def GetParent (self)
def GetList (self)
def SetParent (self, aParent)
def SetList (self, aList)
def IsNew (self)
def IsModified (self)
def IsMoving (self)
def IsDragging (self)
def IsWireImage (self)
def IsSelected (self)
def IsResized (self)
def IsHighlighted (self)
def IsBrightened (self)
def SetWireImage (self)
def SetSelected (self)
def SetHighlighted (self)
def SetBrightened (self)
def ClearSelected (self)
def ClearHighlighted (self)
def ClearBrightened (self)
def SetModified (self)
def GetState (self, type)
def SetState (self, type, state)
def GetStatus (self)
def SetStatus (self, aStatus)
def SetFlags (self, aMask)
def ClearFlags
def GetFlags (self)
def SetForceVisible (self, aEnable)
def GetMsgPanelInfo (self, aList)
def HitTest (self, aPosition)
def GetBoundingBox (self)
def Clone (self)
def IterateForward (listStart, inspector, testData, scanTypes)
def Visit (self, inspector, testData, scanTypes)
def GetClass (self)
def GetSelectMenuText (self)
def GetMenuImage (self)
def Matches (self, aSearchData, aAuxData, aFindLocation)
def Replace (self, args)
def IsReplaceable (self)
def __lt__ (self, aItem)
def Sort (aLeft, aRight)
def ViewBBox (self)
def ViewGetLayers (self, aLayers, aCount)

Public Attributes


Static Public Attributes

tuple ClassOf = staticmethod(ClassOf)
tuple start = _swig_property(_pcbnew.TRACK_start_get, _pcbnew.TRACK_start_set)
tuple end = _swig_property(_pcbnew.TRACK_end_get, _pcbnew.TRACK_end_set)
tuple m_Param = _swig_property(_pcbnew.TRACK_m_Param_get, _pcbnew.TRACK_m_Param_set)
- Static Public Attributes inherited from pcbnew.BOARD_CONNECTED_ITEM
tuple m_TracksConnected = _swig_property(_pcbnew.BOARD_CONNECTED_ITEM_m_TracksConnected_get, _pcbnew.BOARD_CONNECTED_ITEM_m_TracksConnected_set)
tuple m_PadsConnected = _swig_property(_pcbnew.BOARD_CONNECTED_ITEM_m_PadsConnected_get, _pcbnew.BOARD_CONNECTED_ITEM_m_PadsConnected_set)
tuple ClassOf = staticmethod(ClassOf)
- Static Public Attributes inherited from pcbnew.BOARD_ITEM
tuple ShowShape = staticmethod(ShowShape)
tuple FormatAngle = staticmethod(FormatAngle)
tuple FormatInternalUnits = staticmethod(FormatInternalUnits)
- Static Public Attributes inherited from pcbnew.EDA_ITEM
tuple IterateForward = staticmethod(IterateForward)
tuple Sort = staticmethod(Sort)

Detailed Description

C++ includes: class_track.h 

Definition at line 21230 of file

Constructor & Destructor Documentation

def pcbnew.TRACK.__init__ (   self,
  idtype = PCB_TRACE_T 
__init__(TRACK self, BOARD_ITEM aParent, KICAD_T idtype=PCB_TRACE_T) -> TRACK
__init__(TRACK self, BOARD_ITEM aParent) -> TRACK

*aParent, KICAD_T idtype=PCB_TRACE_T) 

Definition at line 21262 of file

Member Function Documentation

def pcbnew.TRACK.Back (   self)
Back(TRACK self) -> TRACK

TRACK* TRACK::Back() const 

Definition at line 21285 of file

def pcbnew.TRACK.ClassOf (   aItem)
ClassOf(EDA_ITEM aItem) -> bool

Definition at line 21242 of file

def pcbnew.TRACK.Clone (   self)
Clone(TRACK self) -> EDA_ITEM

EDA_ITEM * TRACK::Clone() const

Function Clone creates a duplicate of this item with linked list
members set to NULL.

The default version will return NULL in release builds and likely
crash the program. In debug builds, a warning message indicating the
derived class has not implemented cloning. This really should be a
pure virtual function. Due to the fact that there are so many objects
derived from EDA_ITEM, the decision was made to return NULL until all
the objects derived from EDA_ITEM implement cloning. Once that
happens, this function should be made pure.

A clone of the item. 

Definition at line 21858 of file

def pcbnew.TRACK.Draw (   self,
Draw(TRACK self, EDA_DRAW_PANEL * panel, wxDC * DC, GR_DRAWMODE aDrawMode, wxPoint aOffset)
Draw(TRACK self, EDA_DRAW_PANEL * panel, wxDC * DC, GR_DRAWMODE aDrawMode)

*panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint
&aOffset=ZeroOffset) override

Function Draw BOARD_ITEMs have their own color information. 

Definition at line 21543 of file

def pcbnew.TRACK.Flip (   self,
Flip(TRACK self, wxPoint aCentre)

void TRACK::Flip(const wxPoint
&aCentre) override

Function Flip Flip this object, i.e.

change the board side for this object


aCentre:  - the rotation point. 

Definition at line 21330 of file

def pcbnew.TRACK.GetBestInsertPoint (   self,
GetBestInsertPoint(TRACK self, BOARD aPcb) -> TRACK

TRACK::GetBestInsertPoint(BOARD *aPcb)

Function GetBestInsertPoint searches the "best" insertion point
within the track linked list.

The best point is the begging of the corresponding net code section.
(The BOARD::m_Track and BOARD::m_Zone lists are sorted by netcode.)


aPcb:  The BOARD to search for the insertion point.

TRACK* - the item found in the linked list (or NULL if no track) 

Definition at line 21485 of file

def pcbnew.TRACK.GetBoundingBox (   self)
GetBoundingBox(TRACK self) -> EDA_RECT

const EDA_RECT
TRACK::GetBoundingBox() const override

Function GetBoundingBox returns the orthogonal, bounding box of this
object for display purposes.

This box should be an enclosing perimeter for visible components of
this object, and the units should be in the pcb or schematic
coordinate system. It is OK to overestimate the size by a few counts.

Definition at line 21441 of file

def pcbnew.TRACK.GetClass (   self)
GetClass(TRACK self) -> wxString

wxString TRACK::GetClass()
const override

Function GetClass returns the class name.


Definition at line 21783 of file

def pcbnew.TRACK.GetClearance (   self,
  aItem = None 
GetClearance(TRACK self, BOARD_CONNECTED_ITEM aItem=None) -> int
GetClearance(TRACK self) -> int

TRACK::GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override

Function GetClearance returns the clearance in internal units.

If aItem is not NULL then the returned clearance is the greater of
this object's clearance and aItem's clearance. If aItem is NULL, then
this objects clearance is returned.


aItem:  is another BOARD_CONNECTED_ITEM or NULL

int - the clearance in internal units. 

Definition at line 21797 of file

def pcbnew.TRACK.GetEnd (   self)
GetEnd(TRACK self) -> wxPoint

const wxPoint& TRACK::GetEnd()

Definition at line 21399 of file

def pcbnew.TRACK.GetEndNetCode (   self,
GetEndNetCode(TRACK self, int NetCode) -> TRACK

TRACK::GetEndNetCode(int NetCode) 

Definition at line 21518 of file

def pcbnew.TRACK.GetEndPoint (   self,
GetEndPoint(TRACK self, ENDPOINT_T aEndPoint) -> wxPoint

const wxPoint&
TRACK::GetEndPoint(ENDPOINT_T aEndPoint) const

Return the selected endpoint (start or end) 

Definition at line 21429 of file

def pcbnew.TRACK.GetEndSegments (   self,
GetEndSegments(TRACK self, int NbSegm, TRACK ** StartTrack, TRACK ** EndTrack) -> int

TRACK::GetEndSegments(int NbSegm, TRACK **StartTrack, TRACK

Function GetEndSegments get the segments connected to the end point of
the track.

return 1 if OK, 0 when a track is a closed loop and the beginning and
the end of the track in *StartTrack and *EndTrack Modify *StartTrack
en *EndTrack : (*StartTrack)->m_Start coordinate is the beginning of
the track (*EndTrack)->m_End coordinate is the end of the track
Segments connected must be consecutive in list 

Definition at line 21763 of file

def pcbnew.TRACK.GetLength (   self)
GetLength(TRACK self) -> double

double TRACK::GetLength()

Function GetLength returns the length of the track using the
hypotenuse calculation.

double - the length of the track 

Definition at line 21528 of file

def pcbnew.TRACK.GetMenuImage (   self)
GetMenuImage(TRACK self) -> BITMAP_DEF

TRACK::GetMenuImage() const override

Function GetMenuImage returns a pointer to an image to be used in

The default version returns the right arrow image. Override this
function to provide object specific menu images. The menu image
associated with the item. 

Definition at line 21841 of file

def pcbnew.TRACK.GetMsgPanelInfo (   self,
GetMsgPanelInfo(TRACK self, std::vector< MSG_PANEL_ITEM,std::allocator< MSG_PANEL_ITEM > > & aList)

TRACK::GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects
with it's internal state for display purposes.

This method replaces DisplayInfo() so that KiCad objects no longer
have any knowledge of wxWidgets UI objects.


aList:  is the list to populate. 

Definition at line 21615 of file

def pcbnew.TRACK.GetPosition (   self)
GetPosition(TRACK self) -> wxPoint

const wxPoint&
TRACK::GetPosition() const override 

Definition at line 21359 of file

def pcbnew.TRACK.GetSelectMenuText (   self)
GetSelectMenuText(TRACK self) -> wxString

TRACK::GetSelectMenuText() const override

Function GetSelectMenuText returns the text to display to be used in
the selection clarification context menu when multiple items are found
at the current cursor position.

The default version of this function raises an assertion in the debug
mode and returns a string to indicate that it was not overridden to
provide the object specific text.

The menu text string. 

Definition at line 21821 of file

def pcbnew.TRACK.GetStart (   self)
GetStart(TRACK self) -> wxPoint

const wxPoint&
TRACK::GetStart() const 

Definition at line 21419 of file

def pcbnew.TRACK.GetStartNetCode (   self,
GetStartNetCode(TRACK self, int NetCode) -> TRACK

TRACK::GetStartNetCode(int NetCode) 

Definition at line 21508 of file

def pcbnew.TRACK.GetTrack (   self,
GetTrack(TRACK self, TRACK aStartTrace, TRACK aEndTrace, ENDPOINT_T aEndPoint, bool aSameNetOnly, bool aSequential) -> TRACK

*aStartTrace, TRACK *aEndTrace, ENDPOINT_T aEndPoint, bool
aSameNetOnly, bool aSequential)

Function GetTrack returns the trace segment connected to the segment
at aEndPoint from aStartTrace to aEndTrace.


aStartTrace:  A pointer to the TRACK object to begin searching.

aEndTrace:  A pointer to the TRACK object to stop the search. A NULL
value searches to the end of the list.

aEndPoint:  The start or end point of the segment to test against.

aSameNetOnly:  if true stop searching when the netcode changes

aSequential:  If true, forces a forward sequential search, which is
restartable; the default search can be faster but the position of the
returned track in the list is unpredictable

A TRACK object pointer if found otherwise NULL. 

Definition at line 21731 of file

def pcbnew.TRACK.GetVia (   self,
GetVia(TRACK self, wxPoint aPosition, PCB_LAYER_ID aLayer=UNDEFINED_LAYER) -> VIA
GetVia(TRACK self, wxPoint aPosition) -> VIA
GetVia(TRACK self, TRACK aEndTrace, wxPoint aPosition, LSET aLayerMask) -> VIA

*aEndTrace, const wxPoint &aPosition, LSET aLayerMask)

Function GetVia finds the first VIA object at aPosition on aLayer
starting at the trace and ending at aEndTrace.


aEndTrace:  Pointer to the last TRACK object to end search.

aPosition:  The wxPoint to HitTest() against.

aLayerMask:  The layers to match, pass -1 for a don't care.

A pointer to a VIA object if found, else NULL. 

Definition at line 21705 of file

def pcbnew.TRACK.GetWidth (   self)
GetWidth(TRACK self) -> int

int TRACK::GetWidth() const

Definition at line 21379 of file

def pcbnew.TRACK.HitTest (   self,
HitTest(TRACK self, wxPoint aPosition) -> bool
HitTest(TRACK self, EDA_RECT aRect, bool aContained=True, int aAccuracy=0) -> bool
HitTest(TRACK self, EDA_RECT aRect, bool aContained=True) -> bool
HitTest(TRACK self, EDA_RECT aRect) -> bool

bool TRACK::HitTest(const
EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override


aRect:  A reference to an EDA_RECT object containg the area to test.

aContained:  Test if aRect contains this object completly.

aAccuracy:  Increase the item bounding box by this amount.

bool - True if aRect contains this object completly or if aRect
intersects the object and aContained is False, otherwise false. 

Definition at line 21680 of file

Here is the caller graph for this function:

def pcbnew.TRACK.IsLocked (   self)
IsLocked(TRACK self) -> bool

bool TRACK::IsLocked() const

Function IsLocked.

bool - true if the object is locked, else false 

Definition at line 21459 of file

def pcbnew.TRACK.IsNull (   self)
IsNull(TRACK self) -> bool

bool TRACK::IsNull()

Function IsNull returns true if segment length is zero. 

Definition at line 21604 of file

def pcbnew.TRACK.IsPointOnEnds (   self,
  min_dist = 0 
IsPointOnEnds(TRACK self, wxPoint point, int min_dist=0) -> STATUS_FLAGS
IsPointOnEnds(TRACK self, wxPoint point) -> STATUS_FLAGS

TRACK::IsPointOnEnds(const wxPoint &point, int min_dist=0)

Function IsPointOnEnds returns STARTPOINT if point if near (dist =
min_dist) start point, ENDPOINT if point if near (dist = min_dist) end
point,STARTPOINT|ENDPOINT if point if near (dist = min_dist) both
ends, or 0 if none of the above.

if min_dist < 0: min_dist = track_width/2 

Definition at line 21586 of file

def pcbnew.TRACK.Move (   self,
Move(TRACK self, wxPoint aMoveVector)

virtual void TRACK::Move(const
wxPoint &aMoveVector) override

Function Move move this object.


aMoveVector:  - the move vector for this object. 

Definition at line 21294 of file

def pcbnew.TRACK.Next (   self)
Next(TRACK self) -> TRACK

TRACK* TRACK::Next() const 

Definition at line 21276 of file

def pcbnew.TRACK.Rotate (   self,
Rotate(TRACK self, wxPoint aRotCentre, double aAngle)

void TRACK::Rotate(const
wxPoint &aRotCentre, double aAngle) override

Function Rotate Rotate this object.


aRotCentre:  - the rotation point.

aAngle:  - the rotation angle in 0.1 degree. 

Definition at line 21311 of file

def pcbnew.TRACK.SetEnd (   self,
SetEnd(TRACK self, wxPoint aEnd)

void TRACK::SetEnd(const
wxPoint &aEnd) 

Definition at line 21389 of file

def pcbnew.TRACK.SetLocked (   self,
SetLocked(TRACK self, bool aLocked)

void TRACK::SetLocked(bool
aLocked) override

Function SetLocked modifies 'lock' status for of the item. 

Definition at line 21473 of file

def pcbnew.TRACK.SetPosition (   self,
SetPosition(TRACK self, wxPoint aPos)

TRACK::SetPosition(const wxPoint &aPos) override 

Definition at line 21349 of file

def pcbnew.TRACK.SetStart (   self,
SetStart(TRACK self, wxPoint aStart)

void TRACK::SetStart(const
wxPoint &aStart) 

Definition at line 21409 of file

def pcbnew.TRACK.SetWidth (   self,
SetWidth(TRACK self, int aWidth)

void TRACK::SetWidth(int

Definition at line 21369 of file

def pcbnew.TRACK.ShowWidth (   self)
ShowWidth(TRACK self) -> wxString

wxString TRACK::ShowWidth()

Function ShowWidth returns the width of the track in displayable user

Definition at line 21636 of file

def pcbnew.TRACK.TransformShapeWithClearanceToPolygon (   self,
TransformShapeWithClearanceToPolygon(TRACK self, SHAPE_POLY_SET aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor)

void TRACK::TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET
&aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount,
double aCorrectionFactor) const

Function TransformShapeWithClearanceToPolygon Convert the track shape
to a closed polygon Used in filling zones calculations Circles (vias)
and arcs (ends of tracks) are approximated by segments.


aCornerBuffer:  = a buffer to store the polygon

aClearanceValue:  = the clearance around the pad

aCircleToSegmentsCount:  = the number of segments to approximate a

aCorrectionFactor:  = the correction to apply to circles radius to
keep clearance when the circle is approximated by segment bigger or
equal to the real clearance value (usually near from 1.0) 

Definition at line 21557 of file

def pcbnew.TRACK.ViewGetLayers (   self,
ViewGetLayers(TRACK self, int [] aLayers, int & aCount)

TRACK::ViewGetLayers(int aLayers[], int &aCount) const override 

Definition at line 21881 of file

def pcbnew.TRACK.ViewGetLOD (   self,
ViewGetLOD(TRACK self, int aLayer, KIGFX::VIEW * aView) -> unsigned int

unsigned int
TRACK::ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override 

Definition at line 21891 of file

def pcbnew.TRACK.Visit (   self,
Visit(TRACK self, INSPECTOR inspector, void * testData, KICAD_T const [] scanTypes) -> SEARCH_RESULT

TRACK::Visit(INSPECTOR inspector, void *testData, const KICAD_T
scanTypes[]) override

Function Visit may be re-implemented for each derived class in order
to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in
scanTypes[], and may use IterateForward() to do so on lists of such


inspector:  An INSPECTOR instance to use in the inspection.

testData:  Arbitrary data used by the inspector.

scanTypes:  Which KICAD_T types are of interest and the order is
significant too, terminated by EOT.

SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else
SCAN_CONTINUE, and determined by the inspector. 

Definition at line 21649 of file

Member Data Documentation

tuple pcbnew.TRACK.ClassOf = staticmethod(ClassOf)

Definition at line 21247 of file

tuple pcbnew.TRACK.end = _swig_property(_pcbnew.TRACK_end_get, _pcbnew.TRACK_end_set)

Definition at line 21256 of file

tuple pcbnew.TRACK.m_Param = _swig_property(_pcbnew.TRACK_m_Param_get, _pcbnew.TRACK_m_Param_set)

Definition at line 21260 of file

tuple pcbnew.TRACK.start = _swig_property(_pcbnew.TRACK_start_get, _pcbnew.TRACK_start_set)

Definition at line 21252 of file


Definition at line 21274 of file

The documentation for this class was generated from the following file: