# Thread: How to tell system to offset movement in X/Y for a part that's not square (GCODE)

1. ## How to tell system to offset movement in X/Y for a part that's not square (GCODE)

Hard to describe what I want in that subject line. I'm going to be doing a bit of PCB drilling and the biggest pain in the butt for doing it is having to square a hole pattern that is not yet there to the axis movement for X/Y when the sides of the board can't be used as a reference.

What I want to be able to do, and I think is possible is to visit two points that are designed as being a straight line and then from those let the machine figure out the slight angle that the board may be sitting at. Otherwise I have to jump back and forth between the points trying to tap the board into squareness and it's an iterative process that takes forever. I only like setting up on the mill for this just slightly better than drilling them by hand.

I know there is a way to do that but I'm not sure what it's called so I have not had much luck looking for it.

2. Most controls allow for coordinate system rotation. G68 is a common G-code to execute this. G69 cancels the G68. To find the amount of rotation, you could edge find two points along the Y axis with a known distance between in Y and obtain the X locations for those two points. Once you have the slope of the line, the angle can be known. You would also want two points along the X axis to find the intersection to have a known corner location and point of rotation. That corner becomes your part zero and point of rotation and reference position of the other features.

3. Ahhhh, rotation. I was not looking for that but makes perfect sense. Thanks! The difficulty will be in defining the origin of rotation. with the system I have it will be off the board. I guess I could use the hole in the clamp to get pretty close as that is the real pivot point. I'll need to make sure I over-size part of the hole so tapping it doesn't ruin it as a reference.

Thanks again for the info.

4. what kind of machine is it?
what control?
do you have a probe?
are all the parts a little different from each other?
how many parts are you doing?

If your control has macro capability and you have a probe, this isn't exactly trivial but it's not real hard.

Quick way to check if you controller can process macros:

Type

#1=1;

in MDI or at the top of a program, and if it doesn't alarm when you run it, you're good to go. Oh, nothing will happen and the machine won't move.

#### Posting Permissions

We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!