Offset all the gerbers and exellon
There an issue at https://bitbucket.org/jpcgt/flatcam discussing offsetting all the files. In may case the gerbers and excellon files from KiCAD are referenced to the PCB editor 0,0. This is always off the PCB and is ni use for setting up the CNC miller/router I want the ref point to be a corner of the PCB blankm so I need to fix the offset in all the files. Here's a patch of my install that "works for me".
Anyway here's the diff:
diff --git tclCommands/TclCommandOffset.py tclCommands/TclCommandOffset.py
index 17ffdaa..4cd9576 100644
--- tclCommands/TclCommandOffset.py
+++ tclCommands/TclCommandOffset.py
@@ -48,6 +48,12 @@ class TclCommandOffset(TclCommand.TclCommand):
"""
name = args['name']
- x, y = args['x'], args['y']
-
- self.app.collection.get_by_name(name).offset(x, y)
+ x, y = float(args['x']), float(args['y'])
+ if name == 'all':
+ names = self.app.collection.get_names()
+ for name in names:
+ object = self.app.collection.get_by_name(name)
+ if object.kind == 'gerber' or object.kind == "excellon":
+ object.offset((x, y))
+ else:
+ self.app.collection.get_by_name(name).offset((x, y))
I'm not sure that name == 'all' is the right trigger but, like I say, it works for me. Oh, this also fixes a bug where the shell command "offset" doesn't work at all.
I just noticed that Commands/TclCommandOffset.py isn't in this repo. Maybe a merge is required?