-
Notifications
You must be signed in to change notification settings - Fork 9
Drawing Functions
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.
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)
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'])