Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offset all the gerbers and exellon #1

Open
ghost opened this issue Feb 3, 2017 · 1 comment
Open

Offset all the gerbers and exellon #1

ghost opened this issue Feb 3, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 3, 2017

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
Copy link
Author

ghost commented Feb 3, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants