Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panel support #480

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions fabrication.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
except ImportError:
NO_DRILL_SHAPE = PCB_PLOT_PARAMS.NO_DRILL_SHAPE

from .helpers import get_exclude_from_pos


class Fabrication:
Expand Down Expand Up @@ -241,7 +240,7 @@ def zip_gerber_excellon(self):
continue
filePath = os.path.join(folderName, filename)
zipfile.write(filePath, os.path.basename(filePath))
self.logger.info("Finished generating ZIP file")
self.logger.info("Finished generating ZIP file %s", os.path.join(self.outputdir, zipname))

def generate_cpl(self):
"""Generate placement file (CPL)."""
Expand All @@ -258,9 +257,10 @@ def generate_cpl(self):
writer.writerow(
["Designator", "Val", "Package", "Mid X", "Mid Y", "Rotation", "Layer"]
)
for part in self.parent.store.read_pos_parts():
fp = self.board.FindFootprintByReference(part[0])
if get_exclude_from_pos(fp):
footprints = sorted(self.board.Footprints(), key = lambda x: x.GetReference())
for fp in footprints:
part = self.parent.store.get_part(fp.GetReference())
if part[6] == 1: # Exclude from POS
continue
if not add_without_lcsc and not part[3]:
continue
Expand All @@ -276,7 +276,7 @@ def generate_cpl(self):
"top" if fp.GetLayer() == 0 else "bottom",
]
)
self.logger.info("Finished generating CPL file")
self.logger.info("Finished generating CPL file %s", os.path.join(self.outputdir, cplname))

def generate_bom(self):
"""Generate BOM file."""
Expand All @@ -289,8 +289,13 @@ def generate_bom(self):
) as csvfile:
writer = csv.writer(csvfile, delimiter=",")
writer.writerow(["Comment", "Designator", "Footprint", "LCSC"])
for part in self.parent.store.read_bom_parts():
footprints = sorted(self.board.Footprints(), key = lambda x: x.GetReference())
for fp in footprints:
# for part in self.parent.store.read_bom_parts():
part = self.parent.store.get_part(fp.GetReference())
if part[5] == 1: # Exclude from BOM
continue
if not add_without_lcsc and not part[3]:
continue
writer.writerow(part)
self.logger.info("Finished generating BOM file")
self.logger.info("Finished generating BOM file %s", os.path.join(self.outputdir, bomname))