Skip to content

Commit

Permalink
Merge pull request #669 from ohmtech-rdi/erbui-centroid-fix-bottom-ro…
Browse files Browse the repository at this point in the history
…tation-again

Fix rotation for bottom parts
  • Loading branch information
ohmtech-rdi authored Feb 28, 2024
2 parents df8b004 + 70cb715 commit 733a771
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions build-system/erbui/generators/front_pcb/centroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,14 @@ def make_pcb_parts (self, args, pcb, origin_x, origin_y, parts_sch):
parts = {}

for footprint in pcb.footprints:
rot_orientation = 1
if footprint.layer == 'F.Cu':
layer = layer_map ['top']
rot_orientation = 1
rot_mul_alt = 1
rot_offset = 0
elif footprint.layer == 'B.Cu':
layer = layer_map ['bottom']
rot_orientation = -1
rot_mul_alt = -1
rot_offset = 180
else:
assert False

Expand All @@ -171,8 +172,9 @@ def make_pcb_parts (self, args, pcb, origin_x, origin_y, parts_sch):
x = footprint.at.x - origin_x
y = (footprint.at.y - origin_y) * y_mul
rotation = footprint.at.rotation if footprint.at.rotation else 0
rotation -= reel_rotation * rot_mul_offset
rotation *= rot_mul * rot_orientation
rotation += rot_offset
rotation -= rot_mul_alt * reel_rotation * rot_mul_offset
rotation *= rot_mul * rot_mul_alt
if rotation < rotation_range_min:
rotation += 360
if rotation > rotation_range_max:
Expand Down

0 comments on commit 733a771

Please sign in to comment.