FlatCAM icon indicating copy to clipboard operation
FlatCAM copied to clipboard

Offset all the gerbers and exellon

Open ghost opened this issue 9 years ago • 1 comments

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".

I didn't use BitBucket issues as they want to "make it easier for me" by insisting I use, and set up, an Atlassian login. It's not easier it's a PITA.

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.

ghost avatar Feb 03 '17 22:02 ghost

I just noticed that Commands/TclCommandOffset.py isn't in this repo. Maybe a merge is required?

ghost avatar Feb 03 '17 23:02 ghost