[Cryptech-Commits] [user/shatov/alpha_rev04] 06/07: Added assembly drawings support to the production package generator script.

git at cryptech.is git at cryptech.is
Mon Jun 7 10:44:36 UTC 2021


This is an automated email from the git hooks/post-receive script.

meisterpaul1 at yandex.ru pushed a commit to branch master
in repository user/shatov/alpha_rev04.

commit 64d37014ecdee65f1b0e404951fecd478bd85205
Author: Pavel V. Shatov (Meister) <meisterpaul1 at yandex.ru>
AuthorDate: Mon Jun 7 13:42:23 2021 +0300

    Added assembly drawings support to the production package generator script.
---
 prepare_production_files.py | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/prepare_production_files.py b/prepare_production_files.py
index 757164c..df5abb8 100644
--- a/prepare_production_files.py
+++ b/prepare_production_files.py
@@ -22,6 +22,7 @@ from openpyxl import Workbook
 # Stackup           | 'Stackup.xls'
 # Pick & Place Data | pcbnew: File -> Fabrication Outputs -> Footprint Position File...
 # Notes             | 'PCB_Notes.txt'
+# Assembly Drawing  | pcbnew: File -> Print... -> F.Fab, B.Fab (tick "Print mirrored" for the bottom layer!)
 #
 
 #
@@ -66,6 +67,10 @@ _DRILL_RENAME_DICT = {'PTH'  : 'Plated',
 _POS_RENAME_DICT = {'top'    : 'TopPickPlace',
                     'bottom' : 'BottomPickPlace'}
 
+_PDF_RENAME_DICT = {'F_Fab' : 'AssemblyTop',
+                    'B_Fab' : 'AssemblyBottom'}
+
+
 _STACKUP = 'Stackup'
 _NOTES   = 'PCB_Notes'
 _BOM     = 'BOM'
@@ -77,6 +82,7 @@ _XLS  = '.xls'
 _XLSX = _XLS + "x"
 _TXT  = '.txt'
 _CSV  = '.csv'
+_PDF  = '.pdf'
 
 _SKIP_REFDES = ['LOGO1']
 
@@ -295,6 +301,10 @@ def main():
     prepare_notes()
     print("  Done")
     
+    print("Step 7. Preparing assembly drawings...")
+    prepare_assembly_drawings()
+    print("  Done")
+
 
 # --------------------------------
 def create_dirs():
@@ -528,9 +538,35 @@ def prepare_pickplace():
         
     # check, that everything has been renamed
     if any(_POS_RENAME_DICT):
-        raise RuntimeError
-
+        raise RuntimeE
+        rror
 
+# --------------------------------
+def prepare_assembly_drawings():
+# --------------------------------
+    
+    # get all the pdfs
+    pdfs = []
+    for f in os.listdir("%s/%s" % (PROJECT_DIR, _KICAD_GERBER_SUBDIR)):
+        if f.startswith(PROJECT_NAME) and f.endswith(_PDF):
+            pdfs.append(f)
+            
+    # rename files
+    for p in pdfs:
+        d_old_part = p[len(PROJECT_NAME)+1:-len(_PDF)]
+        d_new_part = _PDF_RENAME_DICT[d_old_part]
+        del _PDF_RENAME_DICT[d_old_part]
+        d_from = "%s/%s/%s" % (PROJECT_DIR, _KICAD_GERBER_SUBDIR, p)
+        d_to = "%s/%s_%s%s" % (_OUT_GERBER_DIR, TARGET_PREFIX, d_new_part, _PDF)
+        print("    %s..." % d_from)
+        print("       -> %s" % d_to)
+        shutil.copyfile(d_from, d_to)
+        
+    # check, that everything has been renamed
+    if any(_PDF_RENAME_DICT):
+        raise RuntimeError
+        
+        
 # --------------------------------
 def prepare_notes():
 # --------------------------------



More information about the Commits mailing list