CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 06-19-2008, 08:34 PM
 
Join Date: Jun 2008
Location: USA
Posts: 3
johnpiero is on a distinguished road
Need Help with Basics of Macros

Hello all. I'm new here and hoping someone can help me understand Macros.
Right now, I'm totally new to them...they just seem like canned cycles (ie G81).
So here's my question:
1. What is a macro good for?
2. Can someone provide a very basic macro program which i can use to see how them work?
Thanks all!
John
Reply With Quote

  #2   Ban this user!
Old 06-19-2008, 08:46 PM
Karl_T's Avatar  
Join Date: Mar 2004
Location: Dassel,MN,USA
Posts: 1,318
Karl_T is on a distinguished road

http://www.machinetoolhelp.com/Appli...ogramming.html
Reply With Quote

  #3   Ban this user!
Old 06-20-2008, 07:47 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

macros are good if you have similar parts that require only a few changes. The program below is for turning a straight OD on a vertical turning lathe. This will pick away at the OD until reaching size. By only changing the main program variables you have control over deciding what size OD you want, what size picks, how much extra stock to remove, and what size finish pass.

O0115(MAIN PROGRAM)
G65P8002A15B.75C1Q.1D.01T10
M30

(DESCRIPTION OF VARIABLES)
A=(FINISHED OD)
B=(X-STOCK OD)
C=(RING THICKNESS)
T=(TOOL)
D=(STOCK FOR FINISH PASS)
Q=(PICK SIZE)

O8002(SUB ROUTINE)
T#20M6
IF[#2LE0]GOTO3
G0G90G54
G96S150M4
#2=#2-#17
N1IF[#2LE0]TH#2=0
G0X[#1+#2+#7]Z.1
Z.01
G1Z-[#3+.1]F.01M8
G0U.1
Z.01
IF[#2LE0]GOTO2
#2=#2-#17
GOTO1
N2G0Z.01M9
G28U0W0
N3M0
(CHECK INSERT B/4 FINISH PASS CYCLE START)
#7=0
#2=0
G0G90G95G54M41
G96S150M4
G0X#1Z.05
Z.01
G1Z-[#3+.1]
G0U.1
G0Z3.M9
G28G53U0W0M5
M99
Reply With Quote

  #4   Ban this user!
Old 06-23-2008, 12:37 PM
 
Join Date: May 2007
Location: USA
Posts: 913
g-codeguy is on a distinguished road

As you can see from Stevo's post, macros aren't all that easy to understand if you don't have any experience with them. What Stevo neglected to tell you is that A=#1, B=#2, C=#3, D=#7 (faked you out, huh?), Q=#17, T=#20. Course these are from the Fanuc manual. I have no experience with Haas controls, and so don't know if these values are standardized. I doubt Stevo is using a Fanuc control, otherwise he probably would be using the G71 cycle, and assigning values to it.

Now you can follow his program.

Since you apparently have no experience with variables, my suggestion is to NOT jump right into macro programming, but start by using variables in a standard program. Then work your way to the harder stuff. That is how I taught myself.
Reply With Quote

  #5   Ban this user!
Old 06-23-2008, 12:43 PM
 
Join Date: Apr 2006
Location: usa
Posts: 128
JWK42 is on a distinguished road

Check out this thread. It has some very good discussion about Macros.



http://www.cnczone.com/forums/showthread.php?t=20564
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 06-23-2008, 08:10 PM
jamesweed's Avatar  
Join Date: Jan 2007
Location: USA
Posts: 82
jamesweed is on a distinguished road

Macros are very powerful. This example mills a special mixer on a plastics feedscrew. It will run 14mm up to 180mm or bigger. I have 20 or so simple questions to answer, program does all the math to find the points. Its very long but a good example of the level you can take macros.

%
O0100(*** MIXER)

(ANSWER THE FOLLOWING)
(ANSWER=0 IF NOT NEEDED)


(OPPOSITE LEAD?)
#501=0
(ACTUAL O.D?)
#670=
(ACTUAL MIXER LENGTH?)
#671=
(PROGRAM LENGTH?)
#672=
(WIPING PITCH?)
#673=
(BARRIER PITCH?)
#674=
(CROSS-CUT POSITIONS?)
#675=
#676=
#677=
(WIDTH OF CROSS-CUTS?)
#678=
(POSITION OF SMALL POCKET?)
#679=
(WIPING LAND WIDTH?)
#680=
(BARRIER LAND WIDTH?)
#681=
(FLIGHT ENDMILL DIA.?)
#682=
(ROOT ENDMILL DIA.?)
#683=
(PRINT METER B DEPTH?)
#684=
(PRINT METER A DEPTH?)
#685=
(PROGRAM CHANNEL DEPTH?)
#686=
(PROGRAM UNDERCUT DEPTH?)
#687=
(FEEDRATE?)
#688=
(ENDMILL SPEED?)
#689=


(***END OF EDIT***)

#686=ABS[#686]
#687=ABS[#687]
#1=#686
#2=#687
#3=#688
#4=#689
#109=#670
#110=#671
#111=#672
#112=#673
#113=#674
#155=#675
#156=#676
#157=#677
#114=#678
#115=#679
#123=#680
#122=#681
#116=#682
#117=#683
#118=#684
#119=#685
#2=#2-.1
#502=#109-#2-#2
#502=[#502*3.142]
#503=[#109*3.142]
#198=[360/#112]
#199=[360/#113]
#112=ATAN[#112]/[#503]
#113=ATAN[#113]/[#502]
#502=#109-[#2*2]
#2=#687
N2IF[#155EQ0]GOTO8
GOTO9
N8#114=0
N9IF[#114EQ0]GOTO12
IF[#116GT#114]GOTO502
N12IF[#109GT9]GOTO1
#109=#109
GOTO2
N1#109=[#109*.03937]
N2
IF[#118GT.5]GOTO5
GOTO6
N5#118=#109-#118
#118=[#118/2]
N6IF[#119GT.5]GOTO7
GOTO8
N7#119=#109-#119
#119=[#119/2]
N8
#503=#109
#109=#502
#199=TAN[#113]*#109*3.142
#199=[360/#199]
#109=#503
#197=[#109*3.142]
#197=[#197/360]
#196=[#123+#116]
#196=#196*SIN[#112]
#195=[#123+#116]
#195=#195*COS[#112]
#196=[#196/#197]
#195=[#195*#198]
#190=[#196+#195]
#109=#502
#197=[#109*3.142]
#197=[#197/360]
#196=[#122+#116]
#196=#196*SIN[#113]
#195=[#122+#116]
#195=#195*COS[#113]
#196=[#196/#197]
#195=[#195*#199]
#191=[#196+#195]
#109=#503
#690=[#3/2]
#500=#198
#5221=#5021
#5223=#5023
#5224=#5024
G54(SET WORK COORD. ZERO XZA)
#152=[#111-#110]
#152=[#152/2]
#152=[#152+#118+#115]
#151=[#111-#110]
#151=[#151/2]
#151=[#111-#151-#119-#115]
#150=#1-#2
#150=#150*TAN[60]
#150=#151-#150
#153=#111-#150
#100=[#150*#198+360]
#101=[#151*#198+360]
#104=[#152*#198+360-#190]
#105=[#153*#198+360-#190]
#106=[#111-#153]
#106=[#106*#198]
#106=[#106+#105]
#108=[#153-#152]
#108=[#108*#199]
#108=[#104+#108]
#107=[#111-#153]
#107=[#107*#199]
#107=[#107+#108]
#103=[#111*#199]
#103=[#107-#103-#191]
#103=#103+180
#102=[#150*#199]
#102=[#102+#103]
#125=#105-#108
#126=#102-#100
#127=#103-360
#128=#106-#107
#120=[#125/2]
#120=#108+#120
#121=[#126/2]
#121=#100+#121
N1IF[#108GT#105]GOTO10
IF[#100GT#102]GOTO11
GOTO14
N10IF[#100GT#102]GOTO500
#130=[#102-#100]
#130=[#108-#105+#130]
#130=[#130/2]
GOTO80
N14IF[#126GT#125]GOTO15
#132=[#102-#100]
#132=[#105-#108-#132]
#132=[#132/2]
GOTO80
N11#131=[#105-#108]
#131=[#100-#102+#131]
#131=[#131/2]
GOTO80
N15#133=[#102-#100]
#133=#133-[#105-#108]
#133=[#133/2]
N80#100=[#150*#198+360]
#101=[#151*#198+360]
#104=[#152*#198+360-#190]
#105=[#153*#198+360-#190]
#106=[#111-#153]
#106=[#106*#198]
#106=[#106+#105]
#108=[#108-#130+#131+#132-#133]
#107=[#111-#153]
#107=[#107*#199]
#107=[#107+#108]
#103=[#111*#199]
#103=[#107-#103-#191]
#103=[#103+180]
#102=[#150*#199]
#102=[#102+#103]
#125=[#105-#108]
#125=ROUND[#125*10000]/10000
#126=[#102-#100]
#126=ROUND[#126*10000]/10000
#127=#103-360
#128=#106-#107
#514=#125
#515=#127
IF[#125NE#126]GOTO500
IF[#100GT#102]GOTO20
N20IF[#108GT#105]GOTO500
IF[#108LT#104]GOTO504
#520=#198+#199
#520=[#520/2]
#521=#112+#113
#521=[#521/2]
#528=[#109*3.142]
#528=[#528/360]
#522=#117-#116
#522=[#522/2]
#523=[#116/2]
#524=#117-.125
#530=[#522+#523]
#530=[#530*2]
#530=#530+#117
#525=#530*SIN[#521]
#526=#530*COS[#521]
#525=[#525/#528]
#526=[#526*#520]
#526=#526+#525-#126
#527=[#526/#520]
#540=[#524*3]
#540=#540+#117
#541=#540*SIN[#521]
#542=#540*COS[#521]
#541=[#541/#528]
#542=[#542*#520]
#541=[#541+#542]
#542=[#541/#520]
#135=#150-#527
#136=[#522+#523-.063]
#137=#135-#542
#138=[#117/2]
#138=#138+#136
#139=#137-#542
#140=[#117/2]
#140=#138+#140
#141=#139-#542
#142=[#117/2]
#142=#140+#142
#143=#138-#136
IF[#137LT#138]GOTO1
IF[#139LT#140]GOTO2
GOTO3
N1#137=#0
#139=#0
#141=#0
N2#139=#0
#141=#0
N3IF[#141LT#142]GOTO4
GOTO5
N4#141=#0
N5#529=[#527*#199]
#529=#102-#529
#600=[#527*#198]
#600=#100-#600
#600=#529-#600
#600=[#600/2]
#600=#529-#600
#27=[.032*#198]
#600=#600+#27
#601=#135-#136
#601=[#601*#198]
#601=#600-#601
#602=#135-#136
#602=[#602*#199]
#602=#600-#602
#603=#600-#541
#604=#137-#138
#604=[#604*#198]
#604=#603-#604
#605=#137-#138
#605=[#605*#199]
#605=#603-#605
#606=#603-#541
#607=#139-#140
#607=[#607*#198]
#607=#606-#607
#608=#139-#140
#608=[#608*#199]
#608=#606-#608
#609=#606-#541
#610=#141-#142
#610=[#610*#198]
#610=#609-#610
#611=#141-#142
#611=[#611*#199]
#611=#609-#611
IF[#603LT#604]GOTO1
IF[#606LT#607]GOTO2
GOTO3
N1#603=#0
#606=#0
#609=#0
N2#606=#0
#609=#0
N3IF[#609LT#610]GOTO4
GOTO5
N4#609=#0
N5IF[#604GT#605]GOTO6
IF[#605GT#602]GOTO7
GOTO8
N6#604=#0
N7#605=#0
N8IF[#607GT#608]GOTO9
IF[#608GT#605]GOTO10
GOTO11
N9#607=#0
N10#608=#0
N11IF[#610GT#611]GOTO12
IF[#611GT#608]GOTO13
GOTO14
N12#610=#0
N13#611=#0
N14
#165=#153+#527
#166=[#111-#522-#523+.063]
#167=#165+#542
#169=#167+#542
#171=#169+#542
#168=#166-#143
#170=#168-#143
#172=#170-#143
IF[#167GT#168]GOTO1
IF[#169GT#170]GOTO2
GOTO3
N1#167=#0
#169=#0
#171=#0
N2#169=#0
#171=#0
N3IF[#171GT#172]GOTO4
GOTO5
N4#171=#0
N5#575=[#527*#198]
#575=#105+#575
#620=[#527*#199]
#620=#108+#620
#620=#575-#620
#620=[#620/2]
#620=#575-#620
#27=[.032*#198]
#620=#620-#27
#623=#620+#541
#626=#623+#541
#629=#626+#541
#621=#166-#165
#621=[#621*#199]
#621=#620+#621
#622=#166-#165
#622=[#622*#198]
#622=#620+#622
#624=#168-#167
#624=[#624*#199]
#624=#623+#624
#625=#168-#167
#625=[#625*#198]
#625=#623+#625
#627=#170-#169
#627=[#627*#199]
#627=#626+#627
#628=#170-#169
#628=[#628*#198]
#628=#626+#628
#630=#172-#171
#630=[#630*#199]
#630=#629+#630
#631=#172-#171
#631=[#631*#198]
#631=#629+#630
IF[#624GT#622]GOTO1
IF[#625GT#622]GOTO2
GOTO3
N1#624=#0
N2#625=#0
N3IF[#627GT#625]GOTO4
IF[#628GT#625]GOTO5
GOTO6
N4#627=#0
N5#628=#0
N6IF[#630GT#628]GOTO7
IF[#631GT#628]GOTO8
GOTO9
N7#630=#0
N8#631=#0
N9IF[#623GT#625]GOTO10
IF[#626GT#628]GOTO11
GOTO12
N10#623=#0
#626=#0
#629=#0
N11#626=#0
#629=#0
N12IF[#629GT#631]GOTO13
GOTO14
N13#629=#0
N14#543=#114-#116
#544=[#543/2]
#545=#111-#110
#545=[#545/2]
#186=#155+#545
#180=#186-#544
#181=#180+#543
#550=[#180*#199]
#550=[#550+#103]
#551=#550+#191
#552=[#186*#199+#103]
#554=[#181*#199+#103]
#553=#554+#191
#565=#552+#191
#187=#156+#545
#182=#187-#544
#183=#182+#543
#555=[#182*#199+#103]
#556=#555+#191
#557=[#187*#199+#103]
#559=[#183*#199+#103]
#558=#559+#191
#566=#557+#191
#188=#157+#545
#184=#188-#544
#185=#184+#543
#560=[#184*#199+#103]
#561=#560+#191
#562=[#188*#199+#103]
#567=#562+#191
#564=[#185*#199+#103]
#563=#564+#191
#144=#117-#116
#144=[#144/2]
#145=#144*SIN[#112]
#146=#144*COS[#112]
#145=[#145/#528]
#146=[#146*#198]
#147=#145+#146
#145=#144*SIN[#113]
#146=#144*COS[#113]
#145=[#145/#528]
#146=[#146*#199]
#148=#145+#146
#149=#117-.08
#158=#149*SIN[#113]
#159=#149*COS[#113]
#158=[#158/#528]
#159=[#159*#199]
#160=#158+#159
#581=#105-#147
#580=[#153*#198]
#580=#581-#580
#582=#108+#148
#582=#582-#160
#583=[#153*#199]
#583=#582-#583
#584=[#111*#199]
#584=#584+#583
#586=#100+#147
#585=[#153*#198]
#585=#585+#586
#587=#102-#148
#587=#587+#160
#588=[#153*#199]
#588=#587+#588
#589=[#111*#199]
#589=#588-#589
#585=#585-180
#586=#586-180
#587=#587-180
#588=#588-180
#589=#589-180
IF[#583GT#580]GOTO1
GOTO2
N1#583=#580
N2IF[#588LT#584]GOTO3
GOTO399
N3#588=#584
N399#510=1
IF[#604EQ#605]GOTO401
GOTO402
N401GOTO405
N402IF[#604EQ#0]GOTO403
GOTO404
N403IF[#605NE#0]GOTO507
N404IF[#605EQ#0]GOTO507
#510=[#510+1]
N405IF[#607EQ#608]GOTO411
GOTO412
N411GOTO415
N412IF[#607EQ#0]GOTO413
GOTO414
N413IF[#608NE#0]GOTO507
N414IF[#608EQ#0]GOTO507
#510=[#510+1]
N415IF[#610EQ#611]GOTO421
GOTO422
N421GOTO425
N422IF[#610EQ#0]GOTO423
GOTO424
N423IF[#611NE#0]GOTO507
N424IF[#611EQ#0]GOTO507
#510=[#510+1]
N425IF[#624EQ#625]GOTO431
GOTO432
N431GOTO435
N432IF[#624EQ#0]GOTO433
GOTO434
N433IF[#625NE#0]GOTO507
N434IF[#625EQ#0]GOTO507
N435IF[#627EQ#628]GOTO441
GOTO442
N441GOTO445
N442IF[#627EQ#0]GOTO443
GOTO444
N443IF[#628NE#0]GOTO507
N444IF[#628EQ#0]GOTO507
N445IF[#630EQ#631]GOTO451
GOTO452
N451GOTO455
N452IF[#630EQ#0]GOTO453
GOTO454
N453IF[#631NE#0]GOTO507
N454IF[#631EQ#0]GOTO507
N455#511=#117
#512=#112
#513=#113
#514=#125
#515=#127
GOTO501

N100G04P1000
N101G9
N102M3S#689
N103G0X-#151A#101Z-.09
N104G1F2Z-#687
N105F#690X-#150A#100Z-#686
N106F#688X0A360
N107A#103
N108X-#150A#102
N109X-#151A#101Z-#687
N110G0Z0
N111X-#152A#104
N113Z-.09
N114G1F2Z-#687
N115F#690X-#153A#105Z-#686
N116F#688X-#111A#106
N117A#107
N118X-#153A#108
N119X-#152A#104Z-#687
N120G0Z0
N121X-#151A[#101+180]
N122Z-.1
N123G1F2Z-#687
N124F#690X-#150A[#100+180]Z-#686
N125F#688X0A540
N126A[#103+180]
N127X-#150A[#102+180]
N128X-#151A[#101+180]Z-#687
N129G0Z0
N130G0X-#152A[#104+180]
N132Z-.1
N133G1F2Z-#687
N134F#690X-#153A[#105+180]Z-#686
N135F#688X-#111A[#106+180]
N136A[#107+180]
N137X-#153A[#108+180]
N138X-#152A[#104+180]Z-#687
N139G0Z0
IF[#155EQ0]GOTO176
(CROSS-CUTS)
N141X-#180A#550
N142G1F10Z-#686
N143F#688A#551
N144X-#181A#553
N145F[#688+50]A#554
N146G0Z0
N147X-#182A#555
N148G1F10Z-#686
N149F#688A#556
N150X-#183A#558
N151F[#688+50]A#559
N152G0Z0
IF[#157EQ0]GOTO159
N153X-#184A#560
N154G1F10Z-#686
N155F#688A#561
N156X-#185A#563
N157F[#688+50]A#564
N158G0Z0
N159X-#180A[#550+180]
N160G1F10Z-#686
N161F#688A[#551+180]
N162X-#181A[#553+180]
N163F[#688+50]A[#554+180]
N164G0Z0
N165X-#182A[#555+180]
N166G1F10Z-#686
N167F#688A[#556+180]
N168X-#183A[#558+180]
N169F[#688+50]A[#559+180]
N170G0Z0
IF[#157EQ0]GOTO176
N171X-#184A[#560+180]
N172G1F10Z-#686
N173F#688A[#561+180]
N174X-#185A[#563+180]
N175F[#688+50]A[#564+180]
N176G0Z0M5
N178G0X0A0M9
N498M00(** TOOL CHANGE FOR ROOT **)
#5223=#5023
M7
M3S#4119
(BARRIER UNDERCUT)
N179G0A#580
N180Z-.09
N181G1F2Z-#687
N182F#688X-#153A#581
N183A#582
N184X0A#583
N185X-#153A#582
N186X-#111A#584
N187A#585
N189X-#150A#586
N190F[#688+100]A#587
N191X-#111A#588
N192X-#150A#587
N193X0A#589
N194G0Z0
(BARRIER UNDERCUT 180)
N195A[#580+180]
N196Z-.09
N197G1F2Z-#687
N198F#688X-#153A[#581+180]
N199A[#582+180]
N200X0A[#583+180]
N201X-#153A[#582+180]
N202X-#111A[#584+180]
N203A[#585+180]
N205X-#150A[#586+180]
N206F[#688+100]A[#587+180]
N207X-#111A[#588+180]
N208X-#150A[#587+180]
N209X0A[#589+180]
N210G0Z0
N211X-#135A#600
(ROOT OUTLET CHANNEL)
N212Z-.1M7
N213G1F2Z-#686
N214F#688X-#136A#602
N215A#601
N216X-#135A#600
IF[#603EQ#0]GOTO229
N217X-#137A#603
N218X-#138A#605
N219A#604
N220X-#137A#603
IF[#606EQ#0]GOTO229
N221X-#139A#606
N222X-#140A#608
N223A#607
N224X-#139A#606
IF[#609EQ#0]GOTO229
N225X-#141A#609
N226X-#142A#611
N227A#610
N228X-#141A#609
N229G0Z0
N231X-#165A#620
(INLET CHANNEL)
N232Z-.1
N233G1F2Z-#686
N234F#688X-#166A#621
N235A#622
N236X-#165A#620
IF[#623EQ#0]GOTO249
N237X-#167A#623
N238X-#168A#624
N239A#625
N240X-#167A#623
IF[#626EQ#0]GOTO249
N241X-#169A#626
N242X-#170A#627
N243A#628
N244X-#169A#626
IF[#629EQ#0]GOTO249
N245X-#171A#629
N246X-#172A#630
N247A#631
N248X-#171A#629
N249G0Z0
N251X-#135A[#600+180]
(OUTLET CHANNEL 180)
N252Z-.1
N253G1F2Z-#686
N254F#688X-#136A[#602+180]
N255A[#601+180]
N256X-#135A[#600+180]
IF[#603EQ#0]GOTO269
N257X-#137A[#603+180]
N258X-#138A[#605+180]
N259A[#604+180]
N260X-#137A[#603+180]
IF[#606EQ#0]GOTO269
N261X-#139A[#606+180]
N262X-#140A[#608+180]
N263A[#607+180]
N264X-#139A[#606+180]
IF[#609EQ#0]GOTO269
N265X-#141A[#609+180]
N266X-#142A[#611+180]
N267A[#610+180]
N268X-#141A[#609+180]
N269G0Z0
N271X-#165A[#620+180]
(INLET CHANNEL 180)
N272Z-.1
N273G1F2Z-#686
N274F#688X-#166A[#621+180]
N275A[#622+180]
N276X-#165A[#620+180]
IF[#623EQ#0]GOTO289
N277X-#167A[#623+180]
N278X-#168A[#624+180]
N279A[#625+180]
N280X-#167A[#623+180]
IF[#626EQ#0]GOTO289
N281X-#169A[#626+180]
N282X-#170A[#627+180]
N283A[#628+180]
N284X-#169A[#626+180]
IF[#629EQ#0]GOTO289
N285X-#171A[#629+180]
N286X-#172A[#630+180]
N287A[#631+180]
N288X-#171A[#629+180]
N289G0Z0M5M9
N290X0A0
GOTO505
N499
M5
#33=100
WHILE[#33LE199]DO1
#[#33]=#0
#33=#33+1
END1
#33=500
WHILE[#33LE690]DO2
#[#33]=#0
#33=#33+1
END2
M30

N500M0

(FLIGHT ENDMILL IS TOO LARGE)

GOTO499

N501M0

(CYCLE START TO FLY WITH AN ****)

M7
IF[#501EQ1]GOTO899
GOTO100

N502M0

(ENDMILL DIA. TOO BIG FOR CROSSCUTS)

M30

N504M0

(FLIGHT ENDMILL IS TOO SMALL)

GOTO499

N507M0

(**CANNOT CORRECTLY PROGRAM ROOT**)
(CHECK PROGRAM MACRO VALUES)

M2

N505G04P3000

(** MIXER IS FINISHED **)

M9
GOTO499
%
Reply With Quote

  #7   Ban this user!
Old 06-24-2008, 06:36 PM
 
Join Date: May 2007
Location: USA
Posts: 913
g-codeguy is on a distinguished road

This is a simple stud. No where near as complicated as Mr. Weed's program. The 4 OD diameters are the same for each family of studs. There are 4 possible variables along its length. It may or may not get an internal configuration (depths vary also). It may or may not get cross holes drilled in the thread and/or the raceway. Material may vary from 5/8 to 7/8 in 1/16 increments. Originally had 4 programs because of stock size varying.

The rough turn may or may not turn in two sections depending on the length to the first shoulder. Program needs to be changed to complete the rough turn with the Lead Angle turning tool, and only face shoulders and the face with the 80 deg. profile tool. We are trying to get more use out of the inserts. I did it quick and dirty to get the program written using the 5/8 stock size master program I already had.

All diameters can be controlled by 500 series macros. Thread has to be held close so it has a variable on both ends. The diameter behind the thread might be 1/4 inch or over 2 inches long so it also gets a variable on each end. Ones that long have separate programs, tho.

You will see what appears to be 2 definitions for the same dimensions. Vast majority of the time they are...but every now and then the dimensions to the shoulders are slightly different between the blank drawing and the finish drawing. Apparently the shoulders get ground on ocassion.

These are only a couple of the notes in the header.

MUST CHANGE #149 TO ZERO IF GOING FROM PARTS OF THE SAME LENGTH BUT HAVING DIFFERENT HOLE CONFIGURATIONS, OR IF YOU HAVE TO MODIFY A VARIABLE AFTER RUNNING THE 1ST PART.

PART DESCRIPTION:
.391/.389, .460/.455, AND .614/.610 DIAMETERS
.290 x 90 DEG. INCL FRONT, .592 x 90 DEG. INCL REAR
.035/.025 x 30, .360/.350 U-CUT, .01 x 45 DEG. CHAMFER

Part description hopefully alerts operator to a stud that may have been modified from the standard for some reason.

You may wonder why the G50/G96 is set by the rough turn calc. (Sometimes it isn't, depending on the job.) No matter how many times I tell some operators that G50 sets the max RPM and G96 sets the SFM, I still get called because of chatter only to find that they have been changing my starting spindle speed. Telling them that S650 sets the SFM and M3000 sets the maximum RPM seems to help them understand much better what and where they have to make changes to get rid of chatter.

My rough turn calc subprogram also sets the feedrate based on the depth of cut as specified by the G65 macro call.

#124 is loaded with a 3 because it is used to set the workshift which is also changed from normal if there is a cross hole in the raceway. Needs to set furnther from the collet to clear the live tool holder. This way it alarms if the operator doesn't set it correctly. (Well...he could still put the wrong number in. )


:0857 (3/8-24UNJF 8620 MASTER)

#115=0 (STOCK SIZE)
IF[#115GT.62]GOTO1
#3000=1 (SET STOCK SIZE)

(PART MACROS)
N1#110=0 (FACE TO 1ST SHOULDER)
IF[#110GT.35]GOTO2
#3000=2 (SET #110)
N2IF[#149EQ#110]GOTO200 (SKIPS VARIABLES ONCE SET)
#111=0 (END OF THREAD TO 1ST SHOULDER)
#112=0 (1ST SHOULDER TO END OF PART)
#113=0 (RACEWAY LENGTH)
#114=#110-#111 (THREAD LENGTH)
#120=3000 (RPM FINISH TURN FRONT)
#101=.125+#110+#112 (C-O Z-AXIS)
#149=#110

(FRONT I.D. WORK)
#121=0 (7/64 IN. DRILL DEPTH, MUST BE 0 IF NONE)
#122=0 (DEPTH OF .1250/.1265 HOLE)
#109=.19 (CONTROLS C-DRILL DEPTH)

(CROSS DRILLS)
#123=0 (0 FOR NO DRILL IN THREADS, 1 IF YES)
#124=3 (0 IF NO X-DRILL NEXT TO HEAD 1 IF YES)
#125=0 (0 IF NO X-DRILL IN SHANK, 1 IF YES)

(7/64 IN. THREAD CROSS DRILL)
#130=0 (RPM-5000 FOR CARBIDE, 3300 FOR HSS)
#131=.0012 (FEEDRATE IN IPR)
#132=0 (FACE TO 1ST SHOULDER)
#133=0 (CENTERLINE OF CROSS HOLE TO 1ST SHOULDER)
(#134 FIGURES IPM FEEDRATE FOR ALL X-DRILLS)

(1/16 IN. HEAD CROSS DRILL)
#135=0 (RPM-5000 FOR CARBIDE, 4200 FOR HSS)
#136=.0007 (FEEDRATE)
#137=0 (1ST SHOULDER TO 2ND SHOULDER)
#138=0 (2ND SHOULDER TO DRILL CENTER LINE)

(SET WORKSHIFT)
IF[#124EQ0]GOTO50
IF[#124EQ1]GOTO51
#3000=3 (SET #124 CORRECTLY)
N50IF[#101GE1.3]THEN#530=#101+.4
IF[#101LT1.3]THEN#530=1.7
GOTO54
N51IF[#101GE1.8]THEN#530=#101+.9
IF[#101LT1.8]THEN#530=2.2
N54M1

N200G10P0Z-#530 (BARSTOP)
G200
M1

N400M91 (L.A. TOOL/TURN .625)
IF[#115LE.625]GOTO100
G65P9017X.625F.01C.012U.055U.075S900M3000 (ROUGH TURN CALC)
T0404S[3.82*#119/#115]M13
X#115Z-.05
G50S#118
G96S#119
G1Z-.08F.008
G71U#116R.01
G71P11Q12F#117
N11G1X.625
U#518Z-[#101+.17]
N12X#115W-[[#115-.625]*.15]
M92
M1

N100M91 (ROUGH TURN)
T0101S3000M13
X.65Z.005
G1X.2F.01
X-.065F.005
G0X.49Z.02
IF[#110LE1.]GOTO19
G1Z-[#110/2+.005]F.011
U.02
G0Z.02
G1X[.356+#510]F.015
Z-.03F.01
Z.02F.015
X[.228+#510]
U.08Z-.02F.01
U.048Z-.062 (X.356)
X[.356+#511]Z-[#114-.003]F.011
X[.4+#512]W-.022
X[.4+#513]Z-[#110/2]
X.512F.015
Z-[#110+#113-.005]F.012
U.02
G0Z-[#110/2-.03]
G1X[.4+#514]W-.025
GOTO20
N19G1Z-#110F.011
U.02
G0Z.02S#118
G1X[.356+#510]F.015
Z-.03F.01
Z.02F.015
X[.228+#510]
U.08Z-.02F.01
U.048Z-.062 (X.356)
X[.356+#511]Z-[#114-.003]F.011
X[.4+#512]W-.022
N20X[.4+#515]Z-[#110-.005]F.012
X[.468+#516]
Z-[#110+#113-.005]
X[.557+#517]
U.068W-.0589
M92
M1

N800M91 (FINISH TURN)
T0808S#120M13
X.34Z.02
G1Z0F.006
X-.035F.0035
G0X.24Z.01
G1X[.2538+#500]Z0F.002
G3U.0296Z-.0062R.021
G1U.018W-.009
G3U.0068W-.0044R.021
G1U.0327W-.0283
G3U.0051W-.0095R.019 (X.346)
G1U#501Z-[#114-.0126]
X[.3788+#502]W-.0164F.003
G3U.0112W-.0134R.019 (X.390)
G1X[.39+#503]Z-[#110-.01]F.006
X.48S3000
W-.009
G1X[.42+#503]
W.03F.008
U-.06W-.03F.002
U.06F.006
G0X.62W.02
Z-[#110+#113-.02]
G1W-.019F.006
X[.49+#504]F.003
W.035
G0Z-[#110-.036]
G1X.4F.015
X[.39+#503]W-.0107F.004
G3U-.0112W-.0134R.019F.002S3000
G1U-.0238W-.0119
G4U.02
X[.4031+#504]F.0035
G3U.0268W-.0056R.019F.002
G1U.0164W-.0082
G3U.0112W-.0134R.019 (X.4575)
G1Z-[#110+#113]F.006
G4U.02
X[.5419+#505]
G3U.0329W-.0095R.019F.003
G1U.0321W-.0278
G3U.0051W-.0095R.019 (X.612)
G1Z-[#110+#112+.0048]
G3U-.0112W-.0134R.019
G1U-.0286W-.0143
G97X.63F.01
G0Z.5S500
M91
M1

N1100M91 (THREAD ROLL)
T1111S500M13
M26
X0Z.5
Z-[#114+.22]
M25
G4U.9
M92
M1

N820M91 (RE-FACE)
T0808S#120M13
X.33Z.02
G1Z.0005F.006
X-.035F.0035
M92
M1

N500 (5/64 IN. CROSS DRILL THREAD)
IF[#123EQ0]GOTO62
M98P2102
M1

N62 (CROSS DRILL HEAD)
IF[#124EQ0]GOTO65
M98P5101 (SUBPROGRAM)
M1

N65IF[#121EQ0]GOTO900

N700M91 (CENTER DRILL)
T0707S2400M13
X0Z.5
Z.03
G1Z.01F.01
Z-#109F.002 (ADJUST #109 TO MAINTAIN CHAMFER SIZE)
M92
M1

N2700M91 (11/64 DRILL)
T0727S1550M13
X0Z.5
Z0
G1Z-.094F.002
M92
M1

N2600M91 (#32 DRILL)
T0626S2300M13
X0Z.5
Z-.075
G1Z-[#122+.035]F.002
M92
M1

N1000M91 (7/64 IN. DRILL)
T1010S2440M13
X0Z.5
G65P9136K-[#121+.025]B.02F.0015W.3C.12Z-[#122+.035]
M91
M1

N600M91 (BORE)
T0606S3000M13
X.1255Z.5
Z-.04
G1Z-[#122+.002]F.002
U-.006W-.001
M92
M1

N900 (CUT-OFF)
G65P9019X.67Z-#101F.002T909S500M3000E0
M30
%

Edit: No cross drill sub for the one in the shank because I haven't had a stud requiring this hole yet since writing the program. It will get added, tho.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help!- X3 CNC macros trainfred Syil Products 6 05-20-2008 07:42 PM
Help with macros afterburn25 Haas Mills 4 04-09-2007 08:19 AM
Macros cncfreak General CAM Discussion 24 05-06-2005 05:04 PM
macros toyoda General CAM Discussion 0 05-30-2004 04:56 AM
Macros MachineSMM General CAM Discussion 2 06-20-2003 12:41 PM




All times are GMT -5. The time now is 10:13 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361