← Back to team overview

kicad-developers team mailing list archive

Filling Zones with the Kicad 5 python API

 

Hey!

We use the kicad python library to CAM boards for manufacturing.   One of
the big issues we see in customer uploads is they fail to fill zones before
saving the file, so we use this function:

  def __Fill_All_Zones(self):
    # Kicad doesn't refresh ground pours automatically during plotting
    # This can lead to unusual errors if minor adjustments were made,
    # and the designer didn't manually refresh.
    # This glorious function added thanks to Adam Wolf
    for zone_index in xrange(0, self.board.GetAreaCount()):
      zone = self.board.GetArea(zone_index)
      if not zone.GetIsKeepout():
        #__Fill_Zone(self.board, zone)
        zone.ClearFilledPolysList();
        zone.UnFill();
        if zone.GetIsKeepout():
            return
        zone.BuildFilledSolidAreasPolygons(self.board);
        zone.SetIsFilled(True)

It looks like zone.BuildFilledSolidAreasPolygons has been removed in the
KiCAD 5 python API.  Was it replaced with something else, or is there a new
way to do this?

Thanks!
-Laen
OSH Park

Follow ups