Variable Programming - Critique My Code, Please

NiCu2829

Registered
Registered
Joined
Jan 9, 2019
Messages
6
I've attached the blueprint of the part to be made and my code to machine the 5 slots in the OD. My goal is to have a program that regardless of the tool diameter, programmed radius or # of passes/DOC can be changed with relative ease. I'd like to make #527 passes where each pass is #528/#527 deep (the actual DOC is [#528/#527]/2 because the Y axis is diametrical).
I've never used variables to this extent so I'm hoping y'all will look it over and critique my code.

In the program I accounted for the key cutter tool radius when I programmed the tool path, so the R value on the offset screen=0.

I'm cutting on the minus(-) side of Y0. on a Swiss style machine(Citizen L32).

Thanks in advance!





O208()
(PROGRAM IS IN METRIC)

$1

(I'd like to make #527 passes where each pass is #528/#527 deep (the actual DOC is [#528/#527]/2 because the Y axis is diametrical))

#522=12.7(KEY CUTTER TOOL RADIUS)
#523=12.954(PROGRAMMED RADIUS FOR KEY CUTTER)
#527=10(# OF REPEATS FOR KEY CUTTER)
#528=16.154(G50V SHIFT AMOUNT)
#529=4.83(4.699)(KEY CUTTER THICKNESS)

(KEY CUTTER)
(CARBIDE TOOL)
(*R VALUE ON OFFSET SCREEN=0*)
(#522=TOOL RADIUS)
(#523=PROGRAMMED RADIUS)
(#527=# OF REPEATS)
(#528=G50V SHIFT AMOUNT)
(#529=KEY CUTTER THICKNESS)

(G10L10P7X0Y0Z15.Q0R0.)
(G11)

/MB7
G40G97G98
M5
M80S3=900
T0700
M18C0
G50W-15.
G50V#528
G0X#814+2.5Y-[[21.946+[#522*2]+31.08]]Z[[14.986-[#523-#522]]-13]T07
G0X-#529
G19
M98H100L#527
G0V-#528
G0C45.
M98H100L#527
G0V-#528
G0C90.
M98H100L#527
G0V-#528
G0C135.
M98H100L#527
G0V-#528
G0C180.
M98H100L#527
G0V-#528
G0X#814+2.5
G18
G50V-#528
G50W15.
G0Z-4.5
G0Z-4.5T0
M82
M20
M5
G18G99
/MB7
M1




N100


G0V[#528/#527]
G0G41V26.Z[14.986-[#523-#522]]
G1V21.438F201.
G3V.508Z14.986R#523
G3V-.508Z[14.986+[#523-#522]]R#523
G1(G0)V-21.438
G0G40V-26.Z[[14.986+[#523-#522]]+13]
Z[[14.986-[#523-#522]]-13]

M99
 

Attachments

  • 208.txt
    1.2 KB · Views: 5
  • DWG.pdf
    203.1 KB · Views: 11
I would start by making air cuts and see how the machine reacts to the code. Preferably with the feed speeds turned way down.

I can't even picture the tool path based on that code. I see that you have a C and Y axis but I can't exactly picture the what the configuration of the machine is. I have never had the need to use variables in G code but the general layout looks OK, as long as the controller will digest that syntax.

In my shop I would have to do the slots as a second op on the 4th axis on the mill because I have no way to get that tool into position to make that cut with my live tooling and because my lathe does not have a Y axis.

Having said all of that, when I need to change tool paths, I just do it in CAM and repost the file. Much easier than trying to manipulate the G code.
 
I would start by making air cuts and see how the machine reacts to the code. Preferably with the feed speeds turned way down.

I can't even picture the tool path based on that code. I see that you have a C and Y axis but I can't exactly picture the what the configuration of the machine is. I have never had the need to use variables in G code but the general layout looks OK, as long as the controller will digest that syntax.

In my shop I would have to do the slots as a second op on the 4th axis on the mill because I have no way to get that tool into position to make that cut with my live tooling and because my lathe does not have a Y axis.

Having said all of that, when I need to change tool paths, I just do it in CAM and repost the file. Much easier than trying to manipulate the G code.


I've dry ran it multiple times. The issue I'm having now is that if I change #527 the Y axis work coordinate # changes when at the bottom of the arc(max engagement). I want the final pass regardless of # of passes (#527) to be in the same location. My idea was that I only want the DOC to change when I change #527.

At this point in time I'm not proficient with CAM either.

Thank you for your time!



Here's my most recent code:


(PROGRAM IS IN METRIC)

$1


#522=12.249(KEY CUTTER TOOL RADIUS)
#523=12.7(ACTUAL PART RADIUS FOR KEY CUTTER)
#524=#523-#522(PROGRAMMED RADIUS FOR KEY CUTTER)
#527=10(# OF REPEATS FOR KEY CUTTER)
#528=8.179(16.358)(G50V SHIFT AMOUNT)
#529=4.83(4.699)(KEY CUTTER THICKNESS)
#540=[15.494*2]-[#523*2](DISTANCE FROM CENTERLINE OF PART TO BOTTOM OF ARC)
#541=[21.946-#540]/#527(DEPTH PER PASS)
#542=[[15.494*2]+[#541*#527]](FIRST PASS)
#543=#542




(AB TOOLS-KEY CUTTER)
(CARBIDE TOOL)
(6 FLUTES)
(DWG # )
(TOOL PROJECTION= 19.60MM-TO NUT)
(DIA= 6.28)
(*R VALUE ON OFFSET SCREEN=0*)
(#522=KEY CUTTER TOOL RADIUS)
(#523=ACTUAL PART RADIUS FOR KEY CUTTER)
(#524=PROGRAMMED RADIUS FOR KEY CUTTER)
(#527=# OF REPEATS)
(#528=G50V SHIFT AMOUNT)
(#529=KEY CUTTER THICKNESS)
(#540=DISTANCE FROM CENTERLINE OF PART TO BOTTOM OF ARC)
(#541=DEPTH PER PASS)
(#542=FIRST PASS)
(#543=#542)


(G10L10P7X0Y0Z15.Q0R0.)(R#522)
(G11)


/MB7
G40G97G98
M5
M80S3=871(=220SFM @ .9645" DIAMETER)
T0700
M18C0
G50W-15.
G50V#528
G0X#814+2.5Y-[#542+4.]Z[14.986-#524]T07
G0X-#529
G19
#543=#542
M98H100L#527
G0Y-[#542+4.]Z[14.986-#524]
G0C45.
#543=#542
M98H100L#527
G0Y-[#542+4.]Z[14.986-#524]
G0C90.
#543=#542
M98H100L#527
G0Y-[#542+4.]Z[14.986-#524]
G0C135.
#543=#542
M98H100L#527
G0Y-[#542+4.]Z[14.986-#524]
G0C180.
#543=#542
M98H100L#527
G0Y-[#542+4.]Z[14.986-#524]
G0X#814+2.5
G18
G50V-#528
G50W15.
(G50 Y0.)
G0Z-4.5
G0Z-4.5T0
M82
M20
M5
G18G99
/MB7
M1


M2
M99



N100


G1Y-#543F132.74(FEED/MINUTE)(=.001")
G3Y-#543Z[14.986+#524]R#524
G1Y-[#543+4.]
G0Z[14.986-#524]
#543=#543-#541(RECALCULATE DEPTH)


M99
 
It looks like you need to use a fixed depth for the last pass rather than calculating it. Maybe run the loop as long as Y > the final depth?
 
It looks like you need to use a fixed depth for the last pass rather than calculating it. Maybe run the loop as long as Y > the final depth?

That seems logical. The execution is the part that's holding me back...

Thank you for your time.
 
As an alternative, make the last pass as a fixed value rather than a variable, then just manually calculate the number of loops required to make sure you don't go past the final depth on the last loop pass. I do this kind of thing quite a bit.
 
Back
Top