Compare commits

...

8 Commits

Author SHA1 Message Date
Benny Megidish 6255f69e4a fix: position file header 2022-08-02 15:13:07 +03:00
Benny Megidish a5a31059d0 feat: v1.1.0 - merge bom components 2022-08-02 10:28:09 +03:00
Benny Megidish 27ac789281 Merge pull request #7
merge similar parts into single entry, sort footprint
2022-08-01 21:18:12 +03:00
Ionel 3a33cfff96 handled duplicates the footprints designators (penalized PCB) 2022-08-01 09:28:08 +03:00
Ionel 0994f04d2c merge similar parts into single entry, sort footprint 2022-07-29 11:31:35 +03:00
Ionel 18b3a8074f merge similar parts into single entry, sort footprint 2022-07-29 11:10:22 +03:00
Benny Megidish 05e486d949 Update README.md 2022-07-27 21:34:42 +03:00
Benny Megidish 34318c7de0 feat: updated readme 2022-07-27 21:32:49 +03:00
4 changed files with 31 additions and 23 deletions
+5 -1
View File
@@ -34,10 +34,14 @@ Add an 'MPN'* field with the LCSC component part number to the symbol's fields p
| --- | --- | --- | --- | --- | --- | --- | --- |
### Ignore Footprint in Production Files
Select 'Exclude from position files' or 'Exclude from BOM' in the symbol's attributes property in order to ignore the footprint from the relevant file.
Select 'Exclude from board' or 'Exclude from BOM' in the symbol's attributes property in order to ignore the footprint from the relevant file.
<img src="https://github.com/bennymeg/JLC-Plugin-for-KiCad/blob/master/assets/attributes.png?raw=true" height=420>
Select 'Exclude from position files' or 'Exclude from BOM' in the footprint's fabrication attributes property in order to ignore the footprint from the relevant file.
<img src="https://github.com/bennymeg/JLC-Plugin-for-KiCad/blob/master/assets/fabrication.png?raw=true" height=505>
## Author
Benny Megidish
Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

+1 -1
View File
@@ -29,7 +29,7 @@
],
"versions": [
{
"version": "1.0.0",
"version": "1.1.1",
"status": "stable",
"kicad_version": "6.00"
}
+25 -21
View File
@@ -65,6 +65,9 @@ class ProcessManager:
else:
footprints = list(self.board.GetFootprints())
# sort footprint after designator
footprints.sort(key=lambda x: x.GetReference())
# unique designator dictionary
footprint_designators = defaultdict(int)
for i, footprint in enumerate(footprints):
@@ -115,27 +118,31 @@ class ProcessManager:
unique_id = str(bom_designators[footprint.GetReference()])
bom_designators[footprint.GetReference()] -= 1
# todo: merge similar parts into single entry
# merge similar parts into single entry
insert = True
for component in self.bom:
if component['Footprint'].upper() == footprint_name.upper() and component['Value'].upper() == footprint.GetValue().upper():
component['Designator'] += ", " + "{}{}{}".format(footprint.GetReference(), "" if unique_id == "" else "_", unique_id)
component['Quantity'] += 1
insert = False
self.bom.append({
'Designator': "{}{}{}".format(footprint.GetReference(), "" if unique_id == "" else "_", unique_id),
'Footprint': footprint_name,
'Quantity': 1,
'Value': footprint.GetValue(),
# 'Mount': mount_type,
'LCSC Part #': self._getMpnFromFootprint(footprint),
})
# add component to BOM
if insert:
self.bom.append({
'Designator': "{}{}{}".format(footprint.GetReference(), "" if unique_id == "" else "_", unique_id),
'Footprint': footprint_name,
'Quantity': 1,
'Value': footprint.GetValue(),
# 'Mount': mount_type,
'LCSC Part #': self._getMpnFromFootprint(footprint),
})
with open((os.path.join(temp_dir, placementFileName)), 'w', newline='', encoding='utf-8') as outfile:
header = True
csv_writer = csv.writer(outfile)
# writing headers of CSV file
csv_writer.writerow(self.components[0].keys())
for component in self.components:
if header:
# writing headers of CSV file
csv_writer.writerow(component.keys())
header = False
# writing data of CSV file
if ('**' not in component['Designator']):
csv_writer.writerow(component.values())
@@ -143,15 +150,12 @@ class ProcessManager:
def generate_bom(self, temp_dir):
with open((os.path.join(temp_dir, bomFileName)), 'w', newline='', encoding='utf-8') as outfile:
header = True
csv_writer = csv.writer(outfile)
# writing headers of CSV file
csv_writer.writerow(self.bom[0].keys())
# Output all of the component information
for component in self.bom:
if header:
# writing headers of CSV file
csv_writer.writerow(component.keys())
header = False
# writing data of CSV file
if ('**' not in component['Designator']):
csv_writer.writerow(component.values())