Re: [Kicad-developers] "Make Gerbers and drills zip"

2018-07-31 Thread Wayne Stambaugh
I'm pretty sure I've commented on this before but I'll weigh in again.
My goal is to create a configurable plot manager for pcbnew (and
eventually eeschema) that meets the following criteria:

* Plot any combination of available plot outputs.
* Configurable per plot type file extensions and/or file name suffixes
(maybe prefixes as well).
* Configurable per plot type paths.
* Plot configuration would be some type of plain text config file that
would be portable between projects.
* Some type of default template system similar to the default kicad.pro.
* Possibly callable from the command line `pcbnew --plot /project.pro`.

It would be easy enough to zip some or all of these files as part of the
configuration.  When I would actually have time to work on such a
feature is anybody's guess.  I would rather we not implement parts of
this in an adhoc manner that requires a bunch of refactoring when we get
time to implement it properly.

Wayne

On 7/31/2018 12:25 PM, Jon Evans wrote:
> It would be nice if this were more formally supported instead of just
> being a thing that people figure out how to do :)  Python scripting is
> certainly one way.
> Altium has this capability -- they don't use a real script like Python,
> but more of a configuration file.
> But the key point is that it is often different for each project, so you
> want a nice way to take each script and customize it for the given PCB
> project, and then check it in with version control alongside the other
> design files.
> For example, you might have a "standard" output generation script, but
> then for a certain design you tweak it to turn off certain layers or to
> name the files a certain way.
> 
> On Tue, Jul 31, 2018 at 12:23 PM Adam Wolf
> mailto:adamw...@feelslikeburning.com>>
> wrote:
> 
> I actually worked with the OSHPark folks to do this for KiCad back in
> the V4 days so they could accept .kicad_pcb files.
> On Tue, Jul 31, 2018 at 11:20 AM jp charras  > wrote:
> >
> > Le 31/07/2018 à 16:52, Jon Evans a écrit :
> > > It would be nice to have a fully-scriptable "output job" system
> so that you can save all the Gerber
> > > generation settings, all the drill generation settings, etc
> together, and set up a workflow of
> > > generating files, naming them a certain way, packaging them in a
> ZIP, etc.
> >
> > It could be made by a Python script.
> > Attached a basic python script to create gerber and drill files
> from a board file.
> >
> > Some latest options (creating a job file or a drill file in gerber
> format) are not available for
> > python scripts, but it should be easy (famous words) to add them
> to the Python scripting stuff.
> >
> > >
> > > On Tue, Jul 31, 2018 at 10:24 AM Ben Hest    >> wrote:
> > >
> > >     I'd give that a thumbs up from as a single user's opinion.
> > >
> > >     On Tue, Jul 31, 2018 at 8:58 AM Adam Wolf
> mailto:adamw...@feelslikeburning.com>
> > >      >> wrote:
> > >
> > >         100% percent of the time when I make drill files, I also
> want to make
> > >         gerbers, and I want a zip file for uploading as well.
> > >
> > >         Is there any interest in adding some way to do this
> automatically?  It
> > >         may be a little tricky since drills and Gerbers are two
> different
> > >         windows, but if this is considered a bad idea I will
> just stop
> > >         thinking about it now.
> > >
> > >         Adam
> >
> > --
> > Jean-Pierre CHARRAS
> > ___
> > 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] "Make Gerbers and drills zip"

2018-07-31 Thread John Beard
I was working on a program to do this (over the Python API) because I
wanted to be able to drive deliverable generation from a makefile.

Code is here: https://github.com/johnbeard/kiplot

An example plot config (generates nearly all the possible outputs all
at once) is here:
https://github.com/johnbeard/kiplot/blob/master/docs/samples/generic_plot.kiplot.yaml

I got distracted by real life, but it's at least somewhat functional.

Interestingly, it can also be used to generate plots and run QA tests
on them (e.g. ensure Gerbers are sane, etc).

Cheers,

John

On Tue, Jul 31, 2018 at 5:25 PM, Jon Evans  wrote:
> It would be nice if this were more formally supported instead of just being
> a thing that people figure out how to do :)  Python scripting is certainly
> one way.
> Altium has this capability -- they don't use a real script like Python, but
> more of a configuration file.
> But the key point is that it is often different for each project, so you
> want a nice way to take each script and customize it for the given PCB
> project, and then check it in with version control alongside the other
> design files.
> For example, you might have a "standard" output generation script, but then
> for a certain design you tweak it to turn off certain layers or to name the
> files a certain way.
>
> On Tue, Jul 31, 2018 at 12:23 PM Adam Wolf 
> wrote:
>>
>> I actually worked with the OSHPark folks to do this for KiCad back in
>> the V4 days so they could accept .kicad_pcb files.
>> On Tue, Jul 31, 2018 at 11:20 AM jp charras  wrote:
>> >
>> > Le 31/07/2018 à 16:52, Jon Evans a écrit :
>> > > It would be nice to have a fully-scriptable "output job" system so
>> > > that you can save all the Gerber
>> > > generation settings, all the drill generation settings, etc together,
>> > > and set up a workflow of
>> > > generating files, naming them a certain way, packaging them in a ZIP,
>> > > etc.
>> >
>> > It could be made by a Python script.
>> > Attached a basic python script to create gerber and drill files from a
>> > board file.
>> >
>> > Some latest options (creating a job file or a drill file in gerber
>> > format) are not available for
>> > python scripts, but it should be easy (famous words) to add them to the
>> > Python scripting stuff.
>> >
>> > >
>> > > On Tue, Jul 31, 2018 at 10:24 AM Ben Hest > > > > wrote:
>> > >
>> > > I'd give that a thumbs up from as a single user's opinion.
>> > >
>> > > On Tue, Jul 31, 2018 at 8:58 AM Adam Wolf
>> > > > > > > wrote:
>> > >
>> > > 100% percent of the time when I make drill files, I also want
>> > > to make
>> > > gerbers, and I want a zip file for uploading as well.
>> > >
>> > > Is there any interest in adding some way to do this
>> > > automatically?  It
>> > > may be a little tricky since drills and Gerbers are two
>> > > different
>> > > windows, but if this is considered a bad idea I will just stop
>> > > thinking about it now.
>> > >
>> > > Adam
>> >
>> > --
>> > Jean-Pierre CHARRAS
>> > ___
>> > 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
>

___
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] "Make Gerbers and drills zip"

2018-07-31 Thread Jon Evans
It would be nice if this were more formally supported instead of just being
a thing that people figure out how to do :)  Python scripting is certainly
one way.
Altium has this capability -- they don't use a real script like Python, but
more of a configuration file.
But the key point is that it is often different for each project, so you
want a nice way to take each script and customize it for the given PCB
project, and then check it in with version control alongside the other
design files.
For example, you might have a "standard" output generation script, but then
for a certain design you tweak it to turn off certain layers or to name the
files a certain way.

On Tue, Jul 31, 2018 at 12:23 PM Adam Wolf 
wrote:

> I actually worked with the OSHPark folks to do this for KiCad back in
> the V4 days so they could accept .kicad_pcb files.
> On Tue, Jul 31, 2018 at 11:20 AM jp charras  wrote:
> >
> > Le 31/07/2018 à 16:52, Jon Evans a écrit :
> > > It would be nice to have a fully-scriptable "output job" system so
> that you can save all the Gerber
> > > generation settings, all the drill generation settings, etc together,
> and set up a workflow of
> > > generating files, naming them a certain way, packaging them in a ZIP,
> etc.
> >
> > It could be made by a Python script.
> > Attached a basic python script to create gerber and drill files from a
> board file.
> >
> > Some latest options (creating a job file or a drill file in gerber
> format) are not available for
> > python scripts, but it should be easy (famous words) to add them to the
> Python scripting stuff.
> >
> > >
> > > On Tue, Jul 31, 2018 at 10:24 AM Ben Hest  > wrote:
> > >
> > > I'd give that a thumbs up from as a single user's opinion.
> > >
> > > On Tue, Jul 31, 2018 at 8:58 AM Adam Wolf <
> adamw...@feelslikeburning.com
> > > > wrote:
> > >
> > > 100% percent of the time when I make drill files, I also want
> to make
> > > gerbers, and I want a zip file for uploading as well.
> > >
> > > Is there any interest in adding some way to do this
> automatically?  It
> > > may be a little tricky since drills and Gerbers are two
> different
> > > windows, but if this is considered a bad idea I will just stop
> > > thinking about it now.
> > >
> > > Adam
> >
> > --
> > Jean-Pierre CHARRAS
> > ___
> > 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] "Make Gerbers and drills zip"

2018-07-31 Thread Adam Wolf
I actually worked with the OSHPark folks to do this for KiCad back in
the V4 days so they could accept .kicad_pcb files.
On Tue, Jul 31, 2018 at 11:20 AM jp charras  wrote:
>
> Le 31/07/2018 à 16:52, Jon Evans a écrit :
> > It would be nice to have a fully-scriptable "output job" system so that you 
> > can save all the Gerber
> > generation settings, all the drill generation settings, etc together, and 
> > set up a workflow of
> > generating files, naming them a certain way, packaging them in a ZIP, etc.
>
> It could be made by a Python script.
> Attached a basic python script to create gerber and drill files from a board 
> file.
>
> Some latest options (creating a job file or a drill file in gerber format) 
> are not available for
> python scripts, but it should be easy (famous words) to add them to the 
> Python scripting stuff.
>
> >
> > On Tue, Jul 31, 2018 at 10:24 AM Ben Hest  > > wrote:
> >
> > I'd give that a thumbs up from as a single user's opinion.
> >
> > On Tue, Jul 31, 2018 at 8:58 AM Adam Wolf  > > wrote:
> >
> > 100% percent of the time when I make drill files, I also want to 
> > make
> > gerbers, and I want a zip file for uploading as well.
> >
> > Is there any interest in adding some way to do this automatically?  
> > It
> > may be a little tricky since drills and Gerbers are two different
> > windows, but if this is considered a bad idea I will just stop
> > thinking about it now.
> >
> > Adam
>
> --
> Jean-Pierre CHARRAS
> ___
> 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] "Make Gerbers and drills zip"

2018-07-31 Thread jp charras
Le 31/07/2018 à 16:52, Jon Evans a écrit :
> It would be nice to have a fully-scriptable "output job" system so that you 
> can save all the Gerber
> generation settings, all the drill generation settings, etc together, and set 
> up a workflow of
> generating files, naming them a certain way, packaging them in a ZIP, etc.

It could be made by a Python script.
Attached a basic python script to create gerber and drill files from a board 
file.

Some latest options (creating a job file or a drill file in gerber format) are 
not available for
python scripts, but it should be easy (famous words) to add them to the Python 
scripting stuff.

> 
> On Tue, Jul 31, 2018 at 10:24 AM Ben Hest  > wrote:
> 
> I'd give that a thumbs up from as a single user's opinion.
> 
> On Tue, Jul 31, 2018 at 8:58 AM Adam Wolf  > wrote:
> 
> 100% percent of the time when I make drill files, I also want to make
> gerbers, and I want a zip file for uploading as well.
> 
> Is there any interest in adding some way to do this automatically?  It
> may be a little tricky since drills and Gerbers are two different
> windows, but if this is considered a bad idea I will just stop
> thinking about it now.
> 
> Adam

-- 
Jean-Pierre CHARRAS
'''
A python script example to create plot files to build a board:
Gerber files
Drill files
Map dril files

Important note:
this python script does not plot frame references (page layout).
the reason is it is not yet possible from a python script because 
plotting
plot frame references needs loading the corresponding page layout file
(.wks file) or the default template.

This info (the page layout template) is not stored in the board, and 
therefore
not available.

Do not try to change SetPlotFrameRef(False) to SetPlotFrameRef(true)
the result is the pcbnew lib will crash if you try to plot
the unknown frame references template.

Anyway, in gerber and drill files the page layout is not plot
'''

import sys

from pcbnew import *
filename=sys.argv[1]

board = LoadBoard(filename)

plotDir = "plot/"

#prepare the gerber job file
gen_job_file=True

pctl = PLOT_CONTROLLER(board)

popt = pctl.GetPlotOptions()

popt.SetOutputDirectory(plotDir)

# Set some important plot options (see pcb_plot_params.h):
popt.SetPlotFrameRef(False) #do not change it
popt.SetLineWidth(FromMM(0.35))

popt.SetAutoScale(False)#do not change it
popt.SetScale(1)#do not change it
popt.SetMirror(False)
popt.SetUseGerberAttributes(True)
popt.SetIncludeGerberNetlistInfo(True)
popt.SetCreateGerberJobFile(gen_job_file)
popt.SetUseGerberProtelExtensions(False)
popt.SetExcludeEdgeLayer(False);
popt.SetScale(1)
popt.SetUseAuxOrigin(True)

# This by gerbers only
popt.SetSubtractMaskFromSilk(False)
# Disable plot pad holes
popt.SetDrillMarksType( PCB_PLOT_PARAMS.NO_DRILL_SHAPE );
# Skip plot pad NPTH when possible: when drill size and shape == pad size and 
shape
# usually sel to True for copper layers
popt.SetSkipPlotNPTH_Pads( False );


#prepare the gerber job file
gen_job_file=False
'''
gbr_job_writer = GERBER_JOBFILE_WRITER( board )
'''

# Once the defaults are set it become pretty easy...
# I have a Turing-complete programming language here: I'll use it...
# param 0 is a string added to the file base name to identify the drawing
# param 1 is the layer ID
# param 2 is a comment
plot_plan = [
( "CuTop", F_Cu, "Top layer" ),
( "CuBottom", B_Cu, "Bottom layer" ),
( "PasteBottom", B_Paste, "Paste Bottom" ),
( "PasteTop", F_Paste, "Paste top" ),
( "SilkTop", F_SilkS, "Silk top" ),
( "SilkBottom", B_SilkS, "Silk top" ),
( "MaskBottom", B_Mask, "Mask bottom" ),
( "MaskTop", F_Mask, "Mask top" ),
( "EdgeCuts", Edge_Cuts, "Edges" ),
]


for layer_info in plot_plan:
if layer_info[1] <= B_Cu:
popt.SetSkipPlotNPTH_Pads( True )
else:
popt.SetSkipPlotNPTH_Pads( False )

pctl.SetLayer(layer_info[1])
pctl.OpenPlotfile(layer_info[0], PLOT_FORMAT_GERBER, layer_info[2])
print 'plot %s' % pctl.GetPlotFileName()
if gen_job_file == True:
jobfile_writer.AddGbrFile( layer_info[1], pctl.GetPlotFileName() );
if pctl.PlotLayer() == False:
print "plot error"

#generate internal copper layers, if any
lyrcnt = board.GetCopperLayerCount();

for innerlyr in range ( 1, lyrcnt-1 ):
popt.SetSkipPlotNPTH_Pads( True );
pctl.SetLayer(innerlyr)
lyrname = 'inner%s' % innerlyr
pctl.OpenPlotfile(lyrname, PLOT_FORMAT_GERBER, "inner")
print 'plot %s' % pctl.GetPlotFileName()
if pctl.PlotLayer() == False:
print "plot error"


# At the end you have to close the last plot, otherwise you don't know when
# the object will be recycled!
pctl.ClosePlot()

# Fabricators need drill files.
# sometimes a drill map 

Re: [Kicad-developers] "Make Gerbers and drills zip"

2018-07-31 Thread Jon Evans
It would be nice to have a fully-scriptable "output job" system so that you
can save all the Gerber generation settings, all the drill generation
settings, etc together, and set up a workflow of generating files, naming
them a certain way, packaging them in a ZIP, etc.

On Tue, Jul 31, 2018 at 10:24 AM Ben Hest  wrote:

> I'd give that a thumbs up from as a single user's opinion.
>
> On Tue, Jul 31, 2018 at 8:58 AM Adam Wolf 
> wrote:
>
>> 100% percent of the time when I make drill files, I also want to make
>> gerbers, and I want a zip file for uploading as well.
>>
>> Is there any interest in adding some way to do this automatically?  It
>> may be a little tricky since drills and Gerbers are two different
>> windows, but if this is considered a bad idea I will just stop
>> thinking about it now.
>>
>> Adam
>>
>> ___
>> 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
>>
>
>
> --
>
> -Ben
> ___
> 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] "Make Gerbers and drills zip"

2018-07-31 Thread Ben Hest
I'd give that a thumbs up from as a single user's opinion.

On Tue, Jul 31, 2018 at 8:58 AM Adam Wolf 
wrote:

> 100% percent of the time when I make drill files, I also want to make
> gerbers, and I want a zip file for uploading as well.
>
> Is there any interest in adding some way to do this automatically?  It
> may be a little tricky since drills and Gerbers are two different
> windows, but if this is considered a bad idea I will just stop
> thinking about it now.
>
> Adam
>
> ___
> 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
>


-- 

-Ben
___
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