Newbie tripping on some basics

More
07 Feb 2017 23:03 #87499 by Sierra
New to LinuxCNC, new to gcode, new to CNC, in other words, struggling.

I've got a CNC router (Probotix) that I'm trying to write a piece of code for. The basics of what I'm doing:

Have 24 identical parts jigged up.
Each part gets 4 holes with 2 different bits
1st run puts 2x holes in each part
Manual tool change
2nd run puts 2x holes in each part

In trying to watch and test the code I've written it would be a massive help if I could run the code from a certain point. My approach has been to right click on the code and select "Run from here" but I keep knocking into a myriad of errors: "Linear move on line 10 would exceed X-axis's negative limit" or "Linear move on line 3 would exceed Z-axis's positive limit" or "Can't do that (EMC_TASK_PLAN_RUN) in manual mode. I believe I understand the limit errors but they don't quite make sense when I'm in the middle of the table (x,y, and z) and only asking it to move a few inches.

The other item is that my "Return to X/Y Origin" button, while clickable, does not do anything after the code has been stopped.

I'm sure these are both user induced problems so any help is greatly appreciated.

I've included my sample code in the post below but I'm sure it ain't pretty to those of you with experience.

Please Log in or Create an account to join the conversation.

More
07 Feb 2017 23:03 #87500 by Sierra
g91 g17 g20 g40 g49
f10
g99 g81 z-.25 r.25
x-3.1 y-.389
x-2.4015 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x0 y2.3 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x0 y2.3 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x0 y2.3 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x0 y2.3 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x-3.7985 y0 z-.25
x-2.4015 y0 z-.25
x0 y2.3 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
x3.7985 y0 z-.25
x2.4015 y0 z-.25
g90 g0 x0 y0 z0
g91
g99 g81 z-.25 r.25
x-3.1 y-.140 z-.25
x0 y-1.460 z-.25
x-6.2 y0 z-.25
x0 y1.46 z-.25
x-6.2 y0 z-.25
x0 y-1.46 z-.25
x-6.2 y0 z-.25
x0 y1.46 z-.25

x0 y2.3 z-.25
x0 y-1.46 z-.25
x6.2 y0 z-.25
x0 y1.46 z-.25
x6.2 y0 z-.25
x0 y-1.46 z-.25
x6.2 y0 z-.25
x0 y1.46 z-.25

g80
m2

Please Log in or Create an account to join the conversation.

More
08 Feb 2017 12:43 #87533 by andypugh
I think that your code probably wants to begin with a G90 move before switching to G91.

I am away from my CNC machines now so can't really test the code.

However, starting from a line in the G-code really does start from that line. If the line is the middle of a G81 canned cycle, the interpreter won't know that if you start-from-line. Nor will it set G91 if the mode when you click the button is G90.

Please Log in or Create an account to join the conversation.

More
08 Feb 2017 14:21 #87561 by Sierra
Andy - thanks for your input.

Mind elaborating on the code beginning with a G90 move before switching to G91?

I can begin to grasp what you're saying about starting in the middle of a canned cycle. I suppose the disconnect on my end is that I see the layout of my program in LinuxCNC. When I right click the line of code it turns the path teal and, in my ignorance, should be able to run what it is showing me in the graphical representation. Is there a better way to setup my code so that I can have it run from anywhere in the code? This will also have implications as I run the program on parts.

Please Log in or Create an account to join the conversation.

More
08 Feb 2017 16:50 #87584 by andypugh

Mind elaborating on the code beginning with a G90 move before switching to G91?


Just that the program start point is indeterminate. It will start running the holes sequence relative to wherever the tool happens to be when the program is started.
This might be exactly what you want, but I don't particularly trust relative hole depths.

I suppose the disconnect on my end is that I see the layout of my program in LinuxCNC. When I right click the line of code it turns the path teal and, in my ignorance, should be able to run what it is showing me in the graphical representation.


It is, but it isn't. When Axis loads a new file it runs it through a special version of the G-code interpreter, and creates a graphical preview. It also notes which line on the screen corresponds to which line in the G-code. But the relationship between code and display is only that, and is internal to Axis's version of the world.

(note, also, that you can click a line in the preview and see which G-code line created it, which is very useful).

Please Log in or Create an account to join the conversation.

More
09 Feb 2017 13:09 #87655 by Sierra
Andy - thanks again for your help here.

I now understand what you're saying about the G90 vs G91 start point. I had noticed this when running the code but did not know why it was happening or that I could even change it. Big step forward to writing this code the right way.

The second issue we've been talking about. I'd still like to have my code setup in such a way that I could start and stop it from any single line. Is the only way to do this by writing the code in absolute terms? Obviously, I've written it in incremental (easier for me to think through).

Thanks in advance.

Please Log in or Create an account to join the conversation.

More
09 Feb 2017 13:39 #87657 by andypugh
I think that the way I would do it, and the way I have done similar things in the past, would be to drill the holes in a subroutine, and have the main code call the sub from a number of starting points.
...normal setup codes ...

O100 SUB
G91 ; relative mode
G99 G83 X-3.... ; and the rest of the hole pattern
...
G90 ; back to absolute
O100 ENDSUB

; now all the hole starting positions
G90 G0 X1 Y1
O100 CALL
G90 G0 X0 Y2
O100 CALL
...

Then you can re-start the code from any G0 line, and it will run the complete pattern.
Or, jog the machine to a starting position, and use the MDI tab and send O100 CALL

Please Log in or Create an account to join the conversation.

More
09 Feb 2017 16:21 #87674 by Sierra
Things are becoming clear and you've been a big help. I think the sub code (O codes, uh oh) idea will get me there.

Many thanks again.

Please Log in or Create an account to join the conversation.

Time to create page: 0.073 seconds
Powered by Kunena Forum