Skip to content

Commit 733a771

Browse files
authored
Merge pull request #669 from ohmtech-rdi/erbui-centroid-fix-bottom-rotation-again
Fix rotation for bottom parts
2 parents df8b004 + 70cb715 commit 733a771

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

build-system/erbui/generators/front_pcb/centroid.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,14 @@ def make_pcb_parts (self, args, pcb, origin_x, origin_y, parts_sch):
152152
parts = {}
153153

154154
for footprint in pcb.footprints:
155-
rot_orientation = 1
156155
if footprint.layer == 'F.Cu':
157156
layer = layer_map ['top']
158-
rot_orientation = 1
157+
rot_mul_alt = 1
158+
rot_offset = 0
159159
elif footprint.layer == 'B.Cu':
160160
layer = layer_map ['bottom']
161-
rot_orientation = -1
161+
rot_mul_alt = -1
162+
rot_offset = 180
162163
else:
163164
assert False
164165

@@ -171,8 +172,9 @@ def make_pcb_parts (self, args, pcb, origin_x, origin_y, parts_sch):
171172
x = footprint.at.x - origin_x
172173
y = (footprint.at.y - origin_y) * y_mul
173174
rotation = footprint.at.rotation if footprint.at.rotation else 0
174-
rotation -= reel_rotation * rot_mul_offset
175-
rotation *= rot_mul * rot_orientation
175+
rotation += rot_offset
176+
rotation -= rot_mul_alt * reel_rotation * rot_mul_offset
177+
rotation *= rot_mul * rot_mul_alt
176178
if rotation < rotation_range_min:
177179
rotation += 360
178180
if rotation > rotation_range_max:

0 commit comments

Comments
 (0)