-
I'm trying to automate correcting the origin for some Choc hotswap sockets, however it seems like the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Please create a small example showing your issue. I.e. containing 2 components with different rotation. Include the schematic, PCB and KiBot config. The code takes the rotation: def apply_offset_value(self, comp, angle, pos_offset_x, pos_offset_y):
if angle:
rotation = radians(angle)
rsin = sin(rotation)
rcos = cos(rotation)
comp.pos_offset_x = pos_offset_x * rcos - pos_offset_y * rsin
comp.pos_offset_y = pos_offset_x * rsin + pos_offset_y * rcos
logger.debugl(2, f'- rotating offset {angle} degrees: {comp.pos_offset_x}, {comp.pos_offset_y} mm')
else:
comp.pos_offset_x = pos_offset_x
comp.pos_offset_y = pos_offset_y
# The signs here matches matthewlai/JLCKicadTools offsets because the database comes from this plugin
comp.pos_offset_x = -GS.from_mm(comp.pos_offset_x)
comp.pos_offset_y = GS.from_mm(comp.pos_offset_y)
logger.debugl(2, f'- final offset {comp.pos_offset_x}, {comp.pos_offset_y} KiCad IUs') But it has too many options to provide compatibility with different tools. So the combination of options is really important. |
Beta Was this translation helpful? Give feedback.
This is the computation KiBot is doing, just with the reverse angle sign. The problem is that this must work for other components. Not just this one. I'm trying with C2935951 which needs both: rotation and offset, and I can figure out how to handle it yet.
Note that you can use schematic fields to control the offset and rotation of individual components to handle cases where KiBot can solve the problem. In this case I recommend using
bennymeg_mode: false
.