Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-12-03 Thread Seth Hillbrand
Hi Laen (and others interested)-

There was a recent bug report (https://bugs.launchpad.net/kicad/+bug/1806506)
that showed an issue with the proposed minimal script below.  Specifically,
this did not include net classes in the data before filling.  This can lead
to incorrect boards when generating from kicad_pcb files.

To correct the script, you will need to load the net classes prior to
filling like this:

import pcbnew
board = pcbnew.GetBoard()
board.BuildListOfNets()
board.SynchronizeNetsAndNetClasses()
filler = pcbnew.ZONE_FILLER(board)
zones = board.Zones()
filler.Fill(zones)

This will be done automatically in 5.1 but will need to be explicitly
called in 5.0.1

Best-
Seth

Am Mi., 8. Aug. 2018 um 14:15 Uhr schrieb James Neal :

> Building now!  Thanks!!
>
> On Wed, Aug 8, 2018 at 1:27 PM Seth Hillbrand  wrote:
>
>> 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 :
>>
>>> 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 
>>> 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 >>> >:

> 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@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-08-08 Thread James Neal
Building now!  Thanks!!

On Wed, Aug 8, 2018 at 1:27 PM Seth Hillbrand  wrote:

> 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 :
>
>> 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 
>> 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 :
>>>
 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@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~kicad-developers
 More help   : https://help.launchpad.net/ListHelp

>>>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-08-08 Thread Adam Wolf
Thanks Seth for getting this resolved quickly :)

Adam
On Wed, Aug 8, 2018 at 3:27 PM Seth Hillbrand  wrote:
>
> 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 :
>>
>> 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  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 :

 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@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~kicad-developers
 More help   : https://help.launchpad.net/ListHelp
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-08-08 Thread Seth Hillbrand
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 :

> 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  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 :
>>
>>> 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@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-08-08 Thread James Neal
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  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 :
>
>> 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@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-08-08 Thread Frank Severinsen
And now I remember you use KiCad files instead of gerbers Sendt fra min Samsung Galaxy-smartphone. Oprindelig besked Fra: James Neal  Dato: 08/08/2018  20.29  (GMT+01:00) Til: kicad-developers@lists.launchpad.net Emne: [Kicad-developers] 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!-LaenOSH Park

___Mailing list: https://launchpad.net/~kicad-developersPost to : kicad-developers@lists.launchpad.netUnsubscribe : https://launchpad.net/~kicad-developersMore help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-08-08 Thread Frank Severinsen
Hi James V5 checks the zones by default when plotting, so this issue should hopefully be reduced by itself :) Sendt fra min Samsung Galaxy-smartphone. Oprindelig besked Fra: James Neal  Dato: 08/08/2018  20.29  (GMT+01:00) Til: kicad-developers@lists.launchpad.net Emne: [Kicad-developers] 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!-LaenOSH Park

___Mailing list: https://launchpad.net/~kicad-developersPost to : kicad-developers@lists.launchpad.netUnsubscribe : https://launchpad.net/~kicad-developersMore help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Filling Zones with the Kicad 5 python API

2018-08-08 Thread Seth Hillbrand
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 :

> 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@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp