parent
d9f0324e39
commit
b91c24b28e
|
|
@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [1.6.4] - UNRELEASED
|
## [1.6.4] - UNRELEASED
|
||||||
### Added
|
### Added
|
||||||
- General:
|
- General:
|
||||||
- Operations that copies the project now also copies the PRL
|
- Operations that copies the project now also copies the PRL and the DRU
|
||||||
- Command line:
|
- Command line:
|
||||||
- `--help-list-offsets` to list footprint offsets (JLCPCB)
|
- `--help-list-offsets` to list footprint offsets (JLCPCB)
|
||||||
- `--help-list-rotations` to list footprint rotations (JLCPCB)
|
- `--help-list-rotations` to list footprint rotations (JLCPCB)
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@
|
||||||
which is used by the KiBot docker images, on other OSs *your mileage may vary*.
|
which is used by the KiBot docker images, on other OSs *your mileage may vary*.
|
||||||
- ``restore_project`` :index:`: <pair: global options; restore_project>` [boolean=false] Restore the KiCad project after execution.
|
- ``restore_project`` :index:`: <pair: global options; restore_project>` [boolean=false] Restore the KiCad project after execution.
|
||||||
Note that this option will undo operations like `set_text_variables`.
|
Note that this option will undo operations like `set_text_variables`.
|
||||||
Starting with 1.6.4 it also restores the PRL (Project Local Settings) file.
|
Starting with 1.6.4 it also restores the PRL (Project Local Settings) and DRU (Design RUles) files.
|
||||||
- ``set_text_variables_before_output`` :index:`: <pair: global options; set_text_variables_before_output>` [boolean=false] Run the `set_text_variables` preflight before running each output that involves variants.
|
- ``set_text_variables_before_output`` :index:`: <pair: global options; set_text_variables_before_output>` [boolean=false] Run the `set_text_variables` preflight before running each output that involves variants.
|
||||||
This can be used when a text variable uses the variant and you want to create more than
|
This can be used when a text variable uses the variant and you want to create more than
|
||||||
one variant in the same run. Note that this could be slow because it forces a board
|
one variant in the same run. Note that this could be slow because it forces a board
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ class Globals(FiltersOptions):
|
||||||
self.restore_project = False
|
self.restore_project = False
|
||||||
""" Restore the KiCad project after execution.
|
""" Restore the KiCad project after execution.
|
||||||
Note that this option will undo operations like `set_text_variables`.
|
Note that this option will undo operations like `set_text_variables`.
|
||||||
Starting with 1.6.4 it also restores the PRL (Project Local Settings) file """
|
Starting with 1.6.4 it also restores the PRL (Project Local Settings) and DRU (Design RUles) files """
|
||||||
self.set_text_variables_before_output = False
|
self.set_text_variables_before_output = False
|
||||||
""" Run the `set_text_variables` preflight before running each output that involves variants.
|
""" Run the `set_text_variables` preflight before running each output that involves variants.
|
||||||
This can be used when a text variable uses the variant and you want to create more than
|
This can be used when a text variable uses the variant and you want to create more than
|
||||||
|
|
|
||||||
29
kibot/gs.py
29
kibot/gs.py
|
|
@ -254,7 +254,12 @@ class GS(object):
|
||||||
if os.path.isfile(prl_name):
|
if os.path.isfile(prl_name):
|
||||||
with open(prl_name, 'rb') as f:
|
with open(prl_name, 'rb') as f:
|
||||||
prl = f.read()
|
prl = f.read()
|
||||||
return (pro, prl)
|
dru_name = GS.pro_file[:-3]+'dru'
|
||||||
|
dru = None
|
||||||
|
if os.path.isfile(dru_name):
|
||||||
|
with open(dru_name, 'rb') as f:
|
||||||
|
dru = f.read()
|
||||||
|
return (pro, prl, dru)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def write_pro(data):
|
def write_pro(data):
|
||||||
|
|
@ -262,10 +267,12 @@ class GS(object):
|
||||||
return
|
return
|
||||||
with open(GS.pro_file, 'wb') as f:
|
with open(GS.pro_file, 'wb') as f:
|
||||||
f.write(data[0])
|
f.write(data[0])
|
||||||
if data[1] is None:
|
if data[1] is not None:
|
||||||
return
|
with open(GS.pro_file[:-3]+'prl', 'wb') as f:
|
||||||
with open(GS.pro_file[:-3]+'prl', 'wb') as f:
|
f.write(data[1])
|
||||||
f.write(data[1])
|
if data[2] is not None:
|
||||||
|
with open(GS.pro_file[:-3]+'dru', 'wb') as f:
|
||||||
|
f.write(data[2])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load_sch_title_block():
|
def load_sch_title_block():
|
||||||
|
|
@ -480,7 +487,7 @@ class GS(object):
|
||||||
def copy_project(new_pcb_name, dry=False):
|
def copy_project(new_pcb_name, dry=False):
|
||||||
pro_name = GS.pro_file
|
pro_name = GS.pro_file
|
||||||
if pro_name is None or not os.path.isfile(pro_name):
|
if pro_name is None or not os.path.isfile(pro_name):
|
||||||
return None, None
|
return None, None, None
|
||||||
pro_copy = new_pcb_name.replace('.kicad_pcb', GS.pro_ext)
|
pro_copy = new_pcb_name.replace('.kicad_pcb', GS.pro_ext)
|
||||||
if not dry:
|
if not dry:
|
||||||
logger.debug(f'Copying project `{pro_name}` to `{pro_copy}`')
|
logger.debug(f'Copying project `{pro_name}` to `{pro_copy}`')
|
||||||
|
|
@ -493,7 +500,15 @@ class GS(object):
|
||||||
if not dry:
|
if not dry:
|
||||||
logger.debug(f'Copying project local settings `{prl_name}` to `{prl_copy}`')
|
logger.debug(f'Copying project local settings `{prl_name}` to `{prl_copy}`')
|
||||||
copy2(prl_name, prl_copy)
|
copy2(prl_name, prl_copy)
|
||||||
return pro_copy, prl_copy
|
# ... and the DRU
|
||||||
|
dru_name = pro_name[:-3]+'dru'
|
||||||
|
dru_copy = None
|
||||||
|
if os.path.isfile(dru_name):
|
||||||
|
dru_copy = pro_copy[:-3]+'dru'
|
||||||
|
if not dry:
|
||||||
|
logger.debug(f'Copying project custom design rules `{dru_name}` to `{dru_copy}`')
|
||||||
|
copy2(dru_name, dru_copy)
|
||||||
|
return pro_copy, prl_copy, dru_copy
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def copy_project_sch(sch_dir):
|
def copy_project_sch(sch_dir):
|
||||||
|
|
|
||||||
|
|
@ -930,7 +930,7 @@ class VariantOptions(BaseOptions):
|
||||||
fname = os.path.join(pcb_dir, basename+'.kicad_pcb')
|
fname = os.path.join(pcb_dir, basename+'.kicad_pcb')
|
||||||
logger.debug('Storing modified PCB to `{}`'.format(fname))
|
logger.debug('Storing modified PCB to `{}`'.format(fname))
|
||||||
GS.board.Save(fname)
|
GS.board.Save(fname)
|
||||||
pro_name, _ = GS.copy_project(fname)
|
pro_name, _, _ = GS.copy_project(fname)
|
||||||
KiConf.fix_page_layout(pro_name)
|
KiConf.fix_page_layout(pro_name)
|
||||||
return fname, pcb_dir
|
return fname, pcb_dir
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,13 +235,15 @@ class Copy_FilesOptions(Base3DOptions):
|
||||||
self.add_sch_files(extra_files, dest_dir)
|
self.add_sch_files(extra_files, dest_dir)
|
||||||
elif mode_project:
|
elif mode_project:
|
||||||
self.add_sch_files(extra_files, dest_dir)
|
self.add_sch_files(extra_files, dest_dir)
|
||||||
prj_name, prl_name = GS.copy_project(fname, dry)
|
prj_name, prl_name, dru_name = GS.copy_project(fname, dry)
|
||||||
# Extra files that we are generating
|
# Extra files that we are generating
|
||||||
extra_files.append(fname)
|
extra_files.append(fname)
|
||||||
if prj_name:
|
if prj_name:
|
||||||
extra_files.append(prj_name)
|
extra_files.append(prj_name)
|
||||||
if prl_name:
|
if prl_name:
|
||||||
extra_files.append(prl_name)
|
extra_files.append(prl_name)
|
||||||
|
if dru_name:
|
||||||
|
extra_files.append(dru_name)
|
||||||
if mode_project:
|
if mode_project:
|
||||||
extra_files += self.copy_footprints(f.dest, dry)
|
extra_files += self.copy_footprints(f.dest, dry)
|
||||||
extra_files += self.copy_symbols(f.dest, dry)
|
extra_files += self.copy_symbols(f.dest, dry)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue