kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #37083
Re: Filling Zones with the Kicad 5 python API
Hi Laen-
If you are compiling yourself, you can grab the v5 branch here:
git clone -b 5.0 https://git.launchpad.net/kicad
The latest commit should have re-
enabled zone filling as I described.
Best-
Seth
Am Mi., 8. Aug. 2018 um 13:22 Uhr schrieb James Neal <laen@xxxxxxxxxxx>:
> Awesome! This is the last thing standing in the way of us supporting
> Native Kicad 5 uploads. :)
>
> We'll take a stab at adding it to the python SWIG.
>
> -Laen
>
> On Wed, Aug 8, 2018 at 12:25 PM Seth Hillbrand <seth@xxxxxxxxxxxxx> wrote:
>
>> Hi Laen-
>>
>> Unfortunately, zone filling was factored out into a second file in Dec
>> 2017 and it looks like you are the first person to note that the python
>> SWIG includes did not update with it. So, at the moment, KiCad v5 doesn't
>> have a zone fill command in python. I'll see about updating that for
>> v5.0.1.
>>
>> Once we fix this, the python command will change as we now have a
>> dedicated zone_filler class. The calling structure will also change. The
>> following will be the new routine to achieve this:
>>
>> import pcbnew
>> board = pcbnew.GetBoard()
>> filler = pcbnew.ZONE_FILLER(board)
>> zones = board.Zones()
>> filler.Fill(zones)
>>
>>
>> -Seth
>>
>> Am Mi., 8. Aug. 2018 um 11:30 Uhr schrieb James Neal <laen@xxxxxxxxxxx>:
>>
>>> 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
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help : https://help.launchpad.net/ListHelp
>>>
>>
Follow ups
References