-
Notifications
You must be signed in to change notification settings - Fork 9
Minimum Wizard Requirements
Each footprint wizard must subclass the FootprintWizard
class which is found in the FootprintWizardBase
module.
e.g.
import FootprintWizardBase
class ExampleWizard(FootprintWizardBase.FootprintWizard):
# functions, etc
Additionally, there are six required functions that need to be implemented for the wizard:
The GetName
function simply returns the name of this footprint wizard (string type)
def GetName(self):
return "ExampleWizard"
The GetDescription
function returns a long-form description of the wizard which will be displayed in the wizard selection window within KiCad
def GetDescription(self):
return "Example wizard used to demonstrate how to make a wizard."
The GetValue
function returns the value of the generated footprint. This must be a string value and typically the value will be dependent on one (or more) of the specified parameters. As an example, consider a very simple footprint which is a box of a given width and height (specified in millimeters):
def GetValue(self):
return "SimpleBox_{w}x{h}mm".format(
w = self.parameters["Shape"]["width"],
h = self.parameters["Shape"]["height"])
This function is where the various footprint parameters are defined (see Footprint Parameters).
def GenerateParameterList(self):
self.AddParam("Shape", "width", self.uMM, 3.75)
self.AddParam("Shape", "height", self.uMM, 4.95)
self.AddParam("PageB", "param3", self.uPercent, 33.05, min_value=20)
This function is used to perform any custom parameter checking required by the wizard. As an example, a simple test where the width should be no less than half the height:
def CheckParameters(self):
h = self.parameters["Shape"]["height"]
self.CheckParam("Shape", "width", min_value=h/2)
This function is responsible for actually building the footprint based on the supplied parameter values. The available drawing tools should be used to simplify footprint specification.
Finally, after the Wizard class has been fully defined, the Wizard must be registered:
class ExampleWizard(FootprintWizardBase.FootprintWizard):
# functions, etc
ExampleWizard().register()