Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: SinteredFuzz on May 04, 2017, 05:12:55 PM

I'm at a loss to solve this need. I have to repeat a pattern progressively deeper for many passes.
I cannot see a solution because I'm using G02, G03 and G91 which seems to be keeping me from being able to advance my cutter in a stepwise fashion.
Maybe someone will see an easy solution they could explain.
Below is my attempt with subprograms. (simplified)
I have noted it with what I think should happen.
When this is run however, it makes all passes at the same depth.
And, yes, I'm quite new to this hobby.
Thanks for any help.
%
G57
F80
M98 P0007 L10 (Contour cut looped X times)
M30
O0007
G91 Z0.001 (step down 0.001 per pass)
G00 X0.250409 Z1.500977
G90
G02 X0.345606 Z1.545902 I0.223100 J0.349431
G02 X0.441300 Z1.561173 I0.096590 J0.297807
G02 X0.483004 Z1.557447 I0.000688 J0.227562
G02 X0.518809 Z1.546791 I0.031222 J0.170392
G02 X0.551489 Z1.528719 I0.067127 J0.159972
G02 X0.584016 Z1.500977 I0.132151 J0.187885
G02 X0.679831 Z1.545974 I0.221958 J0.348116
G02 X0.776035 Z1.561173 I0.097114 J0.302645
G02 X0.817642 Z1.557412 I0.000679 J0.224555
G02 X0.852856 Z1.546784 I0.030578 J0.164957
G02 X0.884939 Z1.528760 I0.066419 J0.155802
G02 X0.917148 Z1.500977 I0.135972 J0.190188
G02 X1.011512 Z1.545818 I0.223459 J0.348539
G02 X1.106670 Z1.561173 I0.096038 J0.292648
G02 X1.184168 Z1.546001 I0.000612 J0.202402
G02 X1.250329 Z1.501026 I0.073801 J0.179716
G02 X1.344999 Z1.545965 I0.220420 J0.342157
G02 X1.440764 Z1.561270 I0.096660 J0.297546
G02 X1.482468 Z1.557545 I0.000688 J0.227565
G02 X1.518274 Z1.546888 I0.031222 J0.170392
G02 X1.550954 Z1.528817 I0.067127 J0.159971
G02 X1.583480 Z1.501075 I0.132152 J0.187886
G02 X1.679295 Z1.546072 I0.221957 J0.348112
G02 X1.775500 Z1.561270 I0.097113 J0.302645
G02 X1.817107 Z1.557510 I0.000679 J0.224556
G02 X1.852320 Z1.546882 I0.030578 J0.164957
G02 X1.884404 Z1.528858 I0.066419 J0.155803
G02 X1.916612 Z1.501075 I0.135970 J0.190186
G02 X2.010976 Z1.545916 I0.223459 J0.348539
G02 X2.106134 Z1.561270 I0.096037 J0.292646
G02 X2.183594 Z1.546133 I0.000612 J0.202624
G02 X2.250252 Z1.501135 I0.074990 J0.182954
G02 X2.345463 Z1.546114 I0.222937 J0.348648
G02 X2.441145 Z1.561390 I0.096577 J0.297633
G02 X2.482849 Z1.557664 I0.000688 J0.227562
G02 X2.518654 Z1.547008 I0.031222 J0.170391
G02 X2.551334 Z1.528936 I0.067127 J0.159971
G02 X2.583861 Z1.501194 I0.132152 J0.187885
G02 X2.679676 Z1.546192 I0.221958 J0.348114
G02 X2.775881 Z1.561390 I0.097114 J0.302646
G02 X2.817487 Z1.557629 I0.000679 J0.224555
G02 X2.852701 Z1.547001 I0.030578 J0.164957
G02 X2.884785 Z1.528978 I0.066420 J0.155802
G02 X2.916993 Z1.501194 I0.135972 J0.190188
G02 X3.011357 Z1.546035 I0.223459 J0.348537
G02 X3.106515 Z1.561390 I0.096038 J0.292648
G02 X3.184013 Z1.546219 I0.000612 J0.202402
G02 X3.250174 Z1.501243 I0.073800 J0.179715
G02 X3.344844 Z1.546182 I0.220417 J0.342150
G02 X3.440610 Z1.561488 I0.096660 J0.297548
G02 X3.482313 Z1.557762 I0.000688 J0.227564
G02 X3.518119 Z1.547106 I0.031222 J0.170392
G02 X3.550799 Z1.529034 I0.067127 J0.159971
G02 X3.583325 Z1.501292 I0.132151 J0.187884
G02 X3.679140 Z1.546290 I0.221959 J0.348117
G02 X3.775345 Z1.561488 I0.097113 J0.302645
G02 X3.816952 Z1.557727 I0.000679 J0.224555
G02 X3.852165 Z1.547099 I0.030578 J0.164957
G02 X3.884249 Z1.529076 I0.066419 J0.155802
G02 X3.916457 Z1.501292 I0.135969 J0.190184
G02 X4.010822 Z1.546133 I0.223459 J0.348537
G02 X4.105979 Z1.561488 I0.096037 J0.292647
G02 X4.147790 Z1.557792 I0.000697 J0.230492
G02 X4.184194 Z1.547090 I0.031808 J0.175464
G02 X4.217446 Z1.528924 I0.067559 J0.163183
G02 X4.250144 Z1.501167 I0.127208 J0.182989
G02 X4.345376 Z1.545980 I0.223769 J0.351936
G02 X4.441085 Z1.561237 I0.096606 J0.298189
G02 X4.482789 Z1.557511 I0.000688 J0.227562
G02 X4.518594 Z1.546855 I0.031222 J0.170391
G02 X4.551274 Z1.528783 I0.067127 J0.159972
G02 X4.583801 Z1.501042 I0.132153 J0.187887
G02 X4.679616 Z1.546039 I0.221958 J0.348116
G02 X4.775821 Z1.561237 I0.097114 J0.302646
G02 X4.817428 Z1.557477 I0.000679 J0.224555
G02 X4.852641 Z1.546848 I0.030578 J0.164957
G02 X4.884725 Z1.528825 I0.066419 J0.155802
G02 X4.916933 Z1.501042 I0.135972 J0.190188
G02 X5.011297 Z1.545883 I0.223458 J0.348535
G90 X5.00 Z1.51
M98 P0008
M99
O0008
G91 G00 Z0.200000 (raise z above workpiece)
G90 G00 X0.250409 Z1.500977 (return to start)
G91 G00 Z0.200000 (lower cutter back to cut height)
M99
%

Is there a way to count passes in a loop that then could be used to change the Z depth by adding that count to to the position?
Is this something that will require Lua scripting to get done?

Why not just download fusion360 it's free for a startup/hobbyist
And draw up your part cam it and set it to do mutiple step downs utilities the part is done
Just my two cents

Fusion360 tackles this by working at each contour at a time. However this is not a rotating cutter and I need the tool path to travel from one end to the other before picking up and making a second pass.

so its not a rotating cutter
then make up a cutter in fusion that has 0 spindle speed that may do it
please provide as much info in your question I miss understood and thought it was a milling cutter you were using
sorry for the mistake

wefinish
you have a good start, you just need to learn to use pound variables to increment the steps down
here is an example of one I posted years ago of how to increment.
http://www.machsupport.com/forum/index.php/topic,16372.msg147299.html#msg147299
all my gcode other than some profiles and 3d contours are all variable based
as most routines are repetitions of whittling away material. (really sweet for lathe routines, turning facing, threading)
cleaner shorter code and easier for me to write and edit for the next similar routine.
so the path "like you have" is a call with M98 from the main routine and the first thing it does is add the step increment down variable for the Z position variable
ever time it reenters the loop it computes the new Z depth variable.
just remember to set the Z increment position variable to zero before calling the loop
good luck have fun

Thanks. That looks like the solution. I'll be working to understand this. I haven't heard of pound variables. it's a workweekend but I'll have some time after that.

I've figured out a few things that don't work!
Although I've been able to use #vars to implement stepwise advancement it still seems that I can't affect the repeating section of curves.
I believe it is the nature of the G02 and G03 commands whereby the centers are fixed and the arcs are relative. Does that seem right?
I'll need to offset the centers as if using a tool length offset and yet somehow keep the arcs relative to each of its center.
Could a #var somehow be used to implement an adjustment in a tool length each pass?
I'm modestly able to write in C++ where vars are common. How/when do vars update in this gcode usage? Each time they are looped?
See below what semiworks.
%
#100=0.001 (need 1 decrement)
#101=0.100
#102=0.000(starting depth)
F80
G00 Z#101
M98 P0007 L10
M30
O0007
#101=[#101#100]
G00 X0.34560
G00 Z#101
G90
G02 X0.345606 Z1.545902 I0.223100 J0.349431
G02 X0.441300 Z1.561173 I0.096590 J0.297807
G02 X0.483004 Z1.557447 I0.000688 J0.227562
G02 X0.518809 Z1.546791 I0.031222 J0.170392
G02 X0.551489 Z1.528719 I0.067127 J0.159972
G02 X0.584016 Z1.500977 I0.132151 J0.187885
G02 X0.679831 Z1.545974 I0.221958 J0.348116
G02 X0.776035 Z1.561173 I0.097114 J0.302645
G02 X0.817642 Z1.557412 I0.000679 J0.224555
G02 X0.852856 Z1.546784 I0.030578 J0.164957
G02 X0.884939 Z1.528760 I0.066419 J0.155802
G02 X0.917148 Z1.500977 I0.135972 J0.190188
G02 X1.011512 Z1.545818 I0.223459 J0.348539
G02 X1.106670 Z1.561173 I0.096038 J0.292648
G02 X1.184168 Z1.546001 I0.000612 J0.202402
G02 X1.250329 Z1.501026 I0.073801 J0.179716
G02 X1.344999 Z1.545965 I0.220420 J0.342157
G02 X1.440764 Z1.561270 I0.096660 J0.297546
G02 X1.482468 Z1.557545 I0.000688 J0.227565
G02 X1.518274 Z1.546888 I0.031222 J0.170392
G02 X1.550954 Z1.528817 I0.067127 J0.159971
G02 X1.583480 Z1.501075 I0.132152 J0.187886
G02 X1.679295 Z1.546072 I0.221957 J0.348112
G02 X1.775500 Z1.561270 I0.097113 J0.302645
G02 X1.817107 Z1.557510 I0.000679 J0.224556
G02 X1.852320 Z1.546882 I0.030578 J0.164957
G02 X1.884404 Z1.528858 I0.066419 J0.155803
G02 X1.916612 Z1.501075 I0.135970 J0.190186
G02 X2.010976 Z1.545916 I0.223459 J0.348539
G90 X2.010
M98 P0008
M99
O0008
G91 G00 Z0.200000
G90 G00 X0.34560
G91 G00 Z0.200000
M99
%

you would have to increment all your Z's to move down the same amount, correct?
#103=0 (make sure this is done too in the main)
#103=[#103#100] (add a step down just for the arcs)
example Z[1.545902+#103]
thou I have to admit I don't remember creating 3d arcs like your trying
but if it runs your one loop fine now, then I see no reason that adding the step down should not work.
your original code;
G91 Z0.001 (step down 0.001 per pass)
G00 X0.250409 Z1.500977 "This is an incremental move too, but to where ????? from where ?????"
G90 "set it back to absolute moves"
I thought your original start depth was Z1.500977 now its 0
but admit I did not look close and notice that was an incremental position from who knows where, as there was no reference position move before it.
So not sure wtf your up too really or where your starting at.
Scary code, as your original code started, going vertical then step back down.
Rethink your approach
always look one line at a time and say to yourself "from where I'm at, what setting & position do I need to get me to the place I want to be next"

Yes. Increment all Z's. I was hoping there was a way to do that as a chunk which I think would be a rather advanced maneuver and I'm still familiarizing myself with some pretty basic stuff.
As rookie with little experience just blasting away at this I'm not surprised someone with good understanding finds my attempts scary.
Another approach might be implementing tool offsets however I don't think I can call a new "tool" each pass to advance the cutter. Also it appears that I'm limited to 99 tools and this will require about 250 passes at 0.001 per pass.
Maybe a work offset? However they seem more like a use it once per part thing.
There are other many arc patterns to "drop into" this solution when I get it worked out. This is why I'd like to use the vars to somewhat automate the tool advance.
I fixed that incremental move that caused you to break out the ??? faces. :)
As far as looking at one line at a time... I'm improving. I just don't see the moves well when I look at the code yet.

Set your max tools in the mach4 config I have mine at 200

You might be better off learning about G50 and work offset shifts
Increment the whole work offset Z #variable position.
Screw around with tool length offsets is subject to a whole new set of "what the hell happened there"
You might beable to write to the tool length variable then call it with an H offset but resetting it and knowing where your at any one time is going to be suspect too.
Being new to this I advise to learn the basic before you crash, burn then :'(

YaNvrNo
I have it running quite well with your earlier suggestion of offsetting each and every call for Z. It only takes a couple strokes of copy/replace.
"You might be better off learning about G50 and work offset shifts
Increment the whole work offset Z #variable position."
I should look into how that offset can be adjusted per pass with a var..