mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
python3 print fix to scripts examples
Print function needs to use brackets to be compatible both with the python2 and python3. Without this fix following error was generated with flags -DKICAD_SCRIPTING_MODULES=ON -DKICAD_SCRIPTING_PYTHON3=ON /usr/share/kicad/demos/python_scripts_examples/gen_gerber_and_drill_files_board.py", line 95 print 'plot %s' % pctl.GetPlotFileName() ^ SyntaxError: invalid syntax Fixes https://gitlab.com/kicad/code/kicad/-/issues/8303 Signed-off-by: Mika Laitio <lamikr@gmail.com>
This commit is contained in:
parent
de2f60fe4c
commit
d13fb85d7f
@ -92,11 +92,11 @@ for layer_info in plot_plan:
|
|||||||
|
|
||||||
pctl.SetLayer(layer_info[1])
|
pctl.SetLayer(layer_info[1])
|
||||||
pctl.OpenPlotfile(layer_info[0], PLOT_FORMAT_GERBER, layer_info[2])
|
pctl.OpenPlotfile(layer_info[0], PLOT_FORMAT_GERBER, layer_info[2])
|
||||||
print 'plot %s' % pctl.GetPlotFileName()
|
print('plot %s' % pctl.GetPlotFileName())
|
||||||
if gen_job_file == True:
|
if gen_job_file == True:
|
||||||
jobfile_writer.AddGbrFile( layer_info[1], os.path.basename(pctl.GetPlotFileName()) );
|
jobfile_writer.AddGbrFile( layer_info[1], os.path.basename(pctl.GetPlotFileName()) );
|
||||||
if pctl.PlotLayer() == False:
|
if pctl.PlotLayer() == False:
|
||||||
print "plot error"
|
print("plot error")
|
||||||
|
|
||||||
#generate internal copper layers, if any
|
#generate internal copper layers, if any
|
||||||
lyrcnt = board.GetCopperLayerCount();
|
lyrcnt = board.GetCopperLayerCount();
|
||||||
@ -106,9 +106,9 @@ for innerlyr in range ( 1, lyrcnt-1 ):
|
|||||||
pctl.SetLayer(innerlyr)
|
pctl.SetLayer(innerlyr)
|
||||||
lyrname = 'inner%s' % innerlyr
|
lyrname = 'inner%s' % innerlyr
|
||||||
pctl.OpenPlotfile(lyrname, PLOT_FORMAT_GERBER, "inner")
|
pctl.OpenPlotfile(lyrname, PLOT_FORMAT_GERBER, "inner")
|
||||||
print 'plot %s' % pctl.GetPlotFileName()
|
print('plot %s' % pctl.GetPlotFileName())
|
||||||
if pctl.PlotLayer() == False:
|
if pctl.PlotLayer() == False:
|
||||||
print "plot error"
|
print("plot error")
|
||||||
|
|
||||||
|
|
||||||
# At the end you have to close the last plot, otherwise you don't know when
|
# At the end you have to close the last plot, otherwise you don't know when
|
||||||
@ -133,18 +133,18 @@ drlwriter.SetFormat( metricFmt )
|
|||||||
|
|
||||||
genDrl = True
|
genDrl = True
|
||||||
genMap = True
|
genMap = True
|
||||||
print 'create drill and map files in %s' % pctl.GetPlotDirName()
|
print('create drill and map files in %s' % pctl.GetPlotDirName())
|
||||||
drlwriter.CreateDrillandMapFilesSet( pctl.GetPlotDirName(), genDrl, genMap );
|
drlwriter.CreateDrillandMapFilesSet( pctl.GetPlotDirName(), genDrl, genMap );
|
||||||
|
|
||||||
# One can create a text file to report drill statistics
|
# One can create a text file to report drill statistics
|
||||||
rptfn = pctl.GetPlotDirName() + 'drill_report.rpt'
|
rptfn = pctl.GetPlotDirName() + 'drill_report.rpt'
|
||||||
print 'report: %s' % rptfn
|
print('report: %s' % rptfn)
|
||||||
drlwriter.GenDrillReportFile( rptfn );
|
drlwriter.GenDrillReportFile( rptfn );
|
||||||
|
|
||||||
if gen_job_file == True:
|
if gen_job_file == True:
|
||||||
#job_fn=os.path.splitext(pctl.GetPlotFileName())[0] + '.gbrjob'
|
#job_fn=os.path.splitext(pctl.GetPlotFileName())[0] + '.gbrjob'
|
||||||
job_fn=os.path.dirname(pctl.GetPlotFileName()) + '/' + os.path.basename(filename)
|
job_fn=os.path.dirname(pctl.GetPlotFileName()) + '/' + os.path.basename(filename)
|
||||||
job_fn=os.path.splitext(job_fn)[0] + '.gbrjob'
|
job_fn=os.path.splitext(job_fn)[0] + '.gbrjob'
|
||||||
print 'create job file %s' % job_fn
|
print('create job file %s' % job_fn)
|
||||||
jobfile_writer.CreateJobFile( job_fn )
|
jobfile_writer.CreateJobFile( job_fn )
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ plot_plan = [
|
|||||||
for layer_info in plot_plan:
|
for layer_info in plot_plan:
|
||||||
pctl.SetLayer(layer_info[1])
|
pctl.SetLayer(layer_info[1])
|
||||||
pctl.OpenPlotfile(layer_info[0], PLOT_FORMAT_GERBER, layer_info[2])
|
pctl.OpenPlotfile(layer_info[0], PLOT_FORMAT_GERBER, layer_info[2])
|
||||||
print layer_info[0]
|
print(layer_info[0])
|
||||||
pctl.PlotLayer()
|
pctl.PlotLayer()
|
||||||
|
|
||||||
# Our fabricators want two additional gerbers:
|
# Our fabricators want two additional gerbers:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user