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

Footprints without pads fix #133 #138

Merged
merged 2 commits into from
Mar 12, 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
20 changes: 13 additions & 7 deletions plugins/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ def _get_footprint_position(self, footprint):
return footprint.GetPosition()
if footprint.GetAttributes() & pcbnew.FP_THROUGH_HOLE:
return footprint.GetBoundingBox(False, False).GetCenter()

# handle Unspecified footprint type
pads = footprint.Pads()
#get bounding box based on pads only to ignore non-copper layers, e.g. silkscreen
bbox = pads[0].GetBoundingBox()
# get bounding box based on pads only to ignore non-copper layers, e.g. silkscreen
bbox = pads[0].GetBoundingBox() # start with small bounding box
for pad in pads:
bbox.Merge(pad.GetBoundingBox())
bbox.Merge(pad.GetBoundingBox()) # expand bounding box
return bbox.GetCenter()

def generate_tables(self, temp_dir, auto_translate, exclude_dnp):
Expand Down Expand Up @@ -155,11 +157,15 @@ def generate_tables(self, temp_dir, auto_translate, exclude_dnp):
# 2: 'unspecified'
# }.get(footprint.GetAttributes())

skip_footprint = exclude_dnp and (footprint_has_field(footprint, 'dnp')
or footprint.GetValue().upper() == 'DNP'
or getattr(footprint, 'IsDNP', bool)())
skip_footprint = ((footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_POS_FILES)
or footprint.GetPadCount() == 0
or exclude_dnp
and (footprint_has_field(footprint, 'dnp')
or (footprint.GetValue().upper() == 'DNP')
or getattr(footprint, 'IsDNP', bool))
)

if not (footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_POS_FILES) and not skip_footprint:
if not skip_footprint:
# append unique ID if duplicate footprint designator
unique_id = ""
if footprint_designators[footprint.GetReference()] > 1:
Expand Down