Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Drawing Functions

Oliver edited this page Sep 27, 2016 · 2 revisions

The FootprintWizardBase module defines the FootprintWizardDrawingAids class which provides many helpful functions for adding pads, text, and shapes to a footprint.

The drawing functions are too numerous to detail here. Examination of some of the existing footprint wizards, or reading the source code available within FootprintWizardBase.py should provide ample understanding of the available functions.

The Draw Object

When the BuildThisFootprint function is called, a local object self.draw is available - this is an instance of the FootprintWizardDrawingsAids class. This object is used for all drawing functions - the following simple example sets the current drawing layer to the front silkscreen:

self.draw.SetLayer(pcbnew.F_SilkS)

Internal Units

The drawing functions which have distance measurements passed as parameters use the KiCad internal units (nanometers). Any constant values used must be converted to nanometers. Below is a simple example:

self.draw.SetLineThickness(pcbnew.FromMM(0.05))

It is important to note that parameter values (as specified from within the KiCad wizard interface) are automatically converted to internal units when accessed in the Python script. The conversion takes into account the units of the given parameter (mm or mils). For example:

self.AddParam("Line", "thickness", self.uMM, 0.05)
...
...
self.draw.SetLineThickness(self.parameters['Line']['thickness'])