Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: Sage on July 16, 2008, 01:56:47 PM

Title: Help with multiple passes
Post by: Sage on July 16, 2008, 01:56:47 PM
I'm just geting started with this so I hope it's not a silly question but...

I have been quite sucessfull in transferring a file from AutoCad to DXF and getting it set up with LazyCam. I transferred it to Mach3 to demo it just watcing it on the screen for now. The file cuts a short small arc 1/4"wide with a 1/4" cutter. The material is 1/2" thick so I have the parameters set up to do only .010 deep per pass. I have the tool lift to 0.1" above the work piece and I have the plunge speed set pretty slow at the start of each pass because it's a small enough cutter I don't want to get too agressive. It all looks pretty good as it runs except:
 After it does the tool lift and the rapid to the start of the arc again the plunge speed is used to get back to the un-cut material again which is pretty slow considering there is nothing there to cut more and more with each pass until it gets as deep as it was in the last pass.
 I don't think I can have no tool lift becasue I assume it does a straight line back to the beginning of the arc which would be a disaster. So the question is, is there a way to either rapid plunge the first bit of the depth to the new material or perhaps trace back along the arc to the beginning without a tool lift and then plunge from there?

I know zero about G-code. I'm just using LazyCam to generate it (so far)


Sage
Title: Re: Help with multiple passes
Post by: Chip on July 16, 2008, 04:06:20 PM
Hi, Sage

LazyCam is lazy and still a Bata version.

You'll need to edit the G-code, Edit G-code Button will open the g-code to a text editor.

Put a ; in front of the ;G00 Z.1 within the pockets Only, It won't be seen when running the G-code file .

Or just take a brake and let the machine do it's Work.


Each Pocket will have repetitive code.

Prog. Start,

G00 Z.1
G00 X## Y## ; move to first pocket location.....

G01 Z-.01 ; first cut depth

G-code follows to end of first pass then you'll have a

;G00 Z.1 ;rapid hight Put a ; in front of the ;G00 Z.1

G01 Z-.02 ; second cut depth

G-code follows to end of second pass then you'll have a

;G00 Z.1 ;rapid hight Put a ; in front of the ;G00 Z.1

G01 Z-.01 ; third cut........this will continue till pocket is finished.


Then you'll have a,

G00 Z.1 ;rapid hight, Don't put one hear, your moving to the next pocket location

G00 X## Y## ; to next pocket to be cut.


G01 Z-.01 ; first cut depth

G-code follows to end of first pass then you'll have a

;G00 Z.1 ;rapid hight Put a ; in front of the ;G00 Z.1

G01 Z-.02 ; second cut depth

G-code follows to end of second pass then you'll have a

;G00 Z.1 ;rapid hight Put a ; in front of the ;G00 Z.1

G01 Z-.01 ; third cut........this will continue till pocket is finished.

and so-on.................

Hope this Helps, Chip
Title: Re: Help with multiple passes
Post by: jimpinder on July 17, 2008, 03:31:42 AM
Chip - I was going to suggest a macro - but I saw your post.

Can you explain how the ; in front of a line works - you say it is repetative.

What Sage was saying - and is is a fairly common thing - is having cut a groove, and then moved the tool up to go to the start again, how do you G00 the tool back down through what you have already cut, to get to the meat again.

I have looked at your code, but I can't see how it works, and I'd love to find out, because it iwould be so useful. I would have thought GCode catered for this becasue it is a very common thing.
Title: Re: Help with multiple passes
Post by: Graham Waterworth on July 17, 2008, 04:25:10 AM
Hi Sage,

post your g-code, I will have a look.

Graham.
Title: Re: Help with multiple passes
Post by: Sage on July 17, 2008, 07:58:52 AM
Attached is the G-code with the repeditive passes to make a 1/4" sloted arcs through a 1/2" plate.

It's actually the whole code to cut a Z-axis motor mount plate for my mill-drill CNC conversion. Best run it in MACH3 to see what' s going on becasue the first part drills a bunch of 1/4" holes in the plate including one at the each end of the arcs. I figured this would be a good way to make the ends of the arcs clean - well really they were in the DXF and I didn't now what else to do with them.
Then comes several hundred lines of code to do the three arcs.
I'm not claiming it's the best Gcode. I just took what I got from LazyCam.

And you are correct. Maybe I shouldn't care what it does. After all I can walk away and do sometihng else. I'm not turning the handles anymore. But I'm also using this as a learning tool. I'm almost ready to turn on my machine. I have the X&Y axis done and sort of got carried away with the excitement and neglected to make the Z-motor mount. I plan to figure out enough about G-code to put a pause in for tool changes and adjustment of the Z-feed manually on this code enough to get the plate done. If not I'll just do it manually. I still have handles on the machine.


Sage

Title: Re: Help with multiple passes
Post by: Sage on July 17, 2008, 03:02:24 PM
Chip:

Thanks for your suggestion, but putting in the semi-colon (which I guess comments out the line eliminating it from the code) did not work. MACH3 didi not like it and even the tool path display does not completely load when the G-code is loaded. It seems to stop loading with the highlight bar in the gcode display window on the first line after the modified line.

It may be becasue the generated code uses a G2 to do the arcs. I'm not sure. Perhaps you can figure it out from the code attached to my previous post with the explaination. The arc code starts at N130 where it says it changes to a 1/4 center cut endmill.

Thanks so far.

Sage
Title: Re: Help with multiple passes
Post by: Graham Waterworth on July 17, 2008, 04:25:07 PM
Sage,

this is how I would do the same program.

Use Lazycam to give you the cutter path and then use subs to repeat the moves as many times as you like.

Graham.
Title: Re: Help with multiple passes
Post by: Chip on July 17, 2008, 04:38:46 PM
Hi, Sage

Try loading the Post below, You need to put it in your C:\Mach3 Folder and load it as the lazycam post to use.

Post your dxf file for this part.

Hi, Jim

Nothing repetitive or automatic, Just editing out the G00 Z0.1000 as needed.

I've asked Brian for the Post "default" var. list's used in LazyCam so we can modify them as needed.

The LazyCam examples and master document (Postvar List) is not complete and outdated.

Thanks, Chip
Title: Re: Help with multiple passes
Post by: Sage on July 18, 2008, 03:06:22 PM
Graham:

You're the man. I guess that's why they made you administrator !!
Your code seems to do exactly what I wanted. Rapids down to the old depth, adds a bit more depth and off it goes!!
Now all I have to do is figure out what you did. I'll have to study the code. A good learning exercise.


Chip:

Sorry if I misunderstood what you were asking me to do - and I'm not sure who Jim is you were "talking" to, but I put the file you attached in MACH3 folder and went into LayCam  Setup/Posting Options/Set Post Processor and browsed to and set as default the file you sent. I loaded by DXF and did the "Post Code" again. I loaded the reulting file into MACH3 again. The action looks exactly the same to me. The code also still has the lines in it that you suggest needed to be commented out - I think. I've attached the file again for what it's worth.

Sage
Title: Re: Help with multiple passes
Post by: Sage on July 18, 2008, 03:30:39 PM
Graham:

I notice when your code gets to doing the circles it does not do a rapid up and then down again before doing the next depth pass like it does for the arcs. I assume this is because the code used is dedicated circle code and it knows how to repeat efficiently - is that correct? It seems to repeat the same two lines of code. I can see the one line has the Z increment of -.1 but where is the parameter how many times to do it? I would have thought, like the arc code it would have to return from the subroutine to be told to go back and do it again.
I have a lot to learn. It may help me if you give me your take on this action.

Thanks

Sage
Title: Re: Help with multiple passes
Post by: Graham Waterworth on July 18, 2008, 04:43:26 PM
Hi Sage,

the circle code starts and finishes at the same point so it has no need to rapid up and down, the line M98 P0005 L51 tells the main program to call the sub program O0005 51 times.

Here is a commented snippet of your code.

N2 M6 T2(TOOL Change 1/4 centercut endmill)
G43 H2
G0
M3
 (1ST SLOT)
X4.7834 Y4.0789 (move to start of slot)
Z.600                 (move clear of part by 600 thou)
M98 P0002 L51    (call sub O0002 51 times)
G00 G90 Z.6       (change to absolute and rapid clear)
 (2ND SLOT)
(code removed)
........
M1
M30

O0002 (FIRST SUB)
G00 G91 Z-.6         (set to incremental and rapid to -600 thou)
G1 Z-.01  F.50       (feed into job)
G90                      (set to absolute)
G2 X4.2265 Y3.6499 I-1.9342 J1.9351 F4.00 (create arc)
G0 G91 Z.6           (set to incremental and rapid up 600 thou)
G90 X4.7834 Y4.0789 (rapid back to start of arc)
M99                     (go back to main program)

Any questions just ask.

Graham.
Title: Re: Help with multiple passes
Post by: ger21 on July 18, 2008, 06:38:19 PM
If your using AutoCAD 2002 or newer, I wrote a macro that exports g-code directly from AutoCAD. Far easier than trying to figure out LazyCAM, imo. :)

http://home.comcast.net/~cncwoodworker/acad/downloads/AC2GCv039.zip

There's more info on it at CNC Zone.
http://www.cnczone.com/forums/showthread.php?t=8226
Title: Re: Help with multiple passes
Post by: Sage on July 21, 2008, 01:46:20 PM
Graham:

Just to be sure I understand your code, and in the interest of understand the action of the G codes presented:
Do I detect a problem with your approach if the material is greater than 0.6" thick?

It appears you raise the tool a fixed distance of 0.6 inches from it's current depth at the end of each pass which is getting increasingly deaper with each pass. For this example the material is only 0.5" thick so you will be raising it 0.6" above the work surface at the start and only 0.1" on the last pass. Not a problem in this case but I'd lke to understand the codes fully. Perhaps there is something in the absolute / relative feature that makes this non-issue ?

 Am I missing something?

Thanks


Sage
 
Title: Re: Help with multiple passes
Post by: Sage on July 21, 2008, 01:50:43 PM
ger21:

I'll check out your macro

Thanks


Sage
Title: Re: Help with multiple passes
Post by: Graham Waterworth on July 21, 2008, 02:21:10 PM
Hi Sage,

you are correct in what you say, that is the main problem of incremental code, as the code is written to do that job then the code is safe, if it is to be adapted for other jobs then all the rapid moves have to be checked and adjusted for safe movement.

If this was going to be a regular problem then the g-code can be written using # codes to allow the code to be altered by the changing of a variable.

CNC is about repetition, we write a g-code program and prove it works, we then save it for the next time we make the same part, if the code worked the first time it will work time and again. 

As with lots of things in this world there are many ways to do a job, finding a way that suites your way of working is the hard bit.

You have learned a lot from this exercise already, just think what you may learn tomorrow.

Graham.