Skip to content

Commit

Permalink
[PCB Print][Fixed] When no WKS is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Oct 18, 2024
1 parent 5291b11 commit a5f99fc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions kibot/out_pcb_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,22 +612,24 @@ def plot_frame_ki8_external(self, dir_name, p, page, pages, color):
# Original worksheet
wks = KiConf.fix_page_layout(os.path.join(pcb_dir, GS.pro_fname))
wks = wks[1]
logger.debugl(1, ' - Worksheet: '+wks)
# Expand the variables in the copied worksheet
tb_vars = self.fill_kicad_vars(page, pages, p)
with open(wks) as f:
wks_text = f.read()
wks_text = GS.expand_text_variables(wks_text, tb_vars)
with open(wks, "w") as f:
f.write(wks_text)
if wks:
logger.debugl(1, ' - Worksheet: '+wks)
# Expand the variables in the copied worksheet
tb_vars = self.fill_kicad_vars(page, pages, p)
with open(wks) as f:
wks_text = f.read()
logger.error(tb_vars)
wks_text = GS.expand_text_variables(wks_text, tb_vars)
with open(wks, "w") as f:
f.write(wks_text)
# Plot the frame using a helper script
script = os.path.join(GS.get_resource_path('tools'), 'frame_plotter')
c_rgb = hex_to_rgb(color)[0]
res = run_command([sys.executable, script, pcb_name, str(c_rgb[0]), str(c_rgb[1]), str(c_rgb[2])])
# Copy the result
copy2(os.path.join(pcb_dir, GS.pcb_basename+'-frame.svg'), os.path.join(dir_name, GS.pcb_basename+"-frame.svg"))
rmtree(pcb_dir)
if 'Unknown image data format' in res:
if wks and 'Unknown image data format' in res:
# But ... looks like KiCad fails on images
# Do a manual draw, just to collect any image
logger.debugl(1, ' - Fixing images')
Expand Down

0 comments on commit a5f99fc

Please sign in to comment.