Fanuc 3000C HS D197 12


{Change Comments ***********************************************************}

{5/12/89
Copied & modified; Fanuc 3000C M013.53, for Grand Valley.
Machine is a Hitachi Seiki 60 Horizantal with Fanuc 3000C control.
Change G43 G46 for OfstOn.
Change G28 to G46 for OfstOff and literal 'Z400000' with tool offset.
Move tool change to same line as tool call. Add PreTool.
If OptionalStops, SameTool like NewTool exept for tool change.
Add SetHome to beginnig of prog if ToolChangeAtHome.
Change Home at end of prog to FirstHome. Delete RunTimeComments.
Jim Radcliffe}

{7/24/90, Added InitProg globally to posts with this remark, DWB}
{1/16/91, Updated "Fanuc 3000C HS M197.56" to ".76.1", JR}

{10/10/91
Copied & modified: Fanuc 3000C HS M197.76.1
For: Grand Valley
Updated to .80 format
Commented out CRC vector information. It cannot be fully implemented and is not
required if CRC ToolPath is used and the path created is all tangent with no sharp corners.
Modified tool changes:
NOTES:
a T code puts a tool in the Stand By position
an M6 puts the tool from the Stand By position into the spindle
going from tool<13 to tool>13 must put T13 in spindle 1st & visa versa
CHANGES:
changed to First Tool In Spindle format
deleted "OpToolID ToolChng" from FirstOp
changed "OpToolID ToolChng" in NewTool to "PreTool ToolChng"
added GetPreTool sub to handle special requirements
added a blank line between tools
Modified SameTool to go home if ToolChangeAtHome.
Changed 'Z400000' to 'Z' TCZ# and added SetTCZ('28.0') for the default value added PSComment.
Jim Radcliffe}

{12/14/94
Format: Fanuc 3000C HS D197.00
Updated to D style .00 format per Fanuc 6M (PW) C001.00.02
TH}

{
Format: Fanuc 3000C HS D197.00.01
1/11/95
Added ClearCSOffset to OpenMP: CloseMP: and SubCSMP:
Added if AChange? OR BChange? to home postition call-out in SameToolOp1
Started using Flag('3') to determine toggle between incrementing through MPs and decrementing through MPs
Changed CloseMP to check Flag('3'). If true, the WFOs will increment from first to last. If false, the WFOs will
decrement from last to first.
Example:
TRUE for 4 parts: G54P1, G54P2, G54P3, G54P4
FALSE for 4 parts: G54P4, G54P3, G54P2, G54P1
This is most useful for tombstone machining on rotary tables. With this method, the code will machine part1, rotate, part2,
rotate, part3, rotate, part4, tool change, part4, part3, part2, part1, toolchange, etc. It minimizes the rotation and also
stops the machine from "winding up".
To do this a new sub was created called ToggleIncDecWFO. The flag is set to true in ProgStart and toggled inside CloseMP
after running through the parts

This post does not use WFO's for MP so the above will have no effect unless the WFOCS check in ProgStart is changed.

Replaced SetZRepInc and RestoreAbsOrInc with one sub called DoAbsOrInc. Any line with SetZRepInc now
has DoAbsOrInc as the first command after the SeqC.
NewToolOp3 now has an AbsOrInc on the line that calls out the Plane 'G80' CRCOff
NewToolOp5 no longer has the AbsOrInc command
NewToolOp5b has been created and has the AbsOrInc command
Changed MP1ToollAllPfu to call NewToolOp5b
Added AbsOrInc and Rapid to the FirstOperation? section of MP1ToollAllPXcp
Added Rapid to the NewTool? section of MP1ToollAllPXcp
Started using Flag ('4') to turn on Inc/Dec WFO's (See above). True means use Inc/Dec WFO's.
MP1ToollAllPXcp, MP1ToollAllPFU, and MPallTools1P now output WFO if NOT WorkFixtureOffsets?
TH}

{
Format: Fanuc 3000C HS D197.00.02
1/13/95
Formatted TrackZNO# to #4
}

{ Added ClearCSOffset to SubCSMP TH}

{8/22/95
Format: Fanuc 3000C HS D197.10
For: Gibbs & Associates
Versions: ncCad 4.33.01/ncCAM 4.33.01/ncPost 4.33.06/Catalyst v2.22/Compost 4.21.32/1.0a
Changes made per Tom Hubina
Fixed problem with Tagging.
Changed literal 'M98P' to SubCall CallLabB at StdSub.
Added TagDown prior to CloseSub at FinishSubG92.
Added TagUp to TagInc at OpenMP.
Deleted NewProg at OpenMP.
Changed literal 'M98P' to SubCall CallLabB at OpenMP.
Changed CSSubID# RepLab OnePart to 'ł' Tag# four places at CloseMP.
Added TagDown two places at CloseSub.
Changed NewProg to TagInc at SubCSMP.
Changed literal 'M98P' to SubCall CallLabB at ToolPath PointFeat AutoCycle.
Added IF NOT FirstFeat? condition at ToolPath PointFeat.
This assures that forced SeqLab at StartSub is output on FIRST block of Drill Sub.
Added TagUp to TagInc at Milling Sub.
Added TagDown at Milling Sub.
Added TagUp to TagInc at ZonlyRepAutoCycle.
Changed literal 'M98P' to SubCall CallLabB at ZonlyRepAutoCycle.
Added TagDown at ZonlyRepAutoCycle.
Changed literal 'M98P' to SubCall CallLabB at ZonlyRep.
Added TagDown at ZonlyRep.
Added TagInit at ProgStart.
Added TagUp to TagInc at OpGuts IF Milling.
Added TagUp to TagInc at OpGuts IF Drilling Repeats.
Changed 'M98Pł' Tag# 'R' Repeats# to SubCall CallLabB 'ł' CallMasterNum# at OpGuts IF Drilling
CallMasterOp.
Added TagUp to NewMasterTag at OpGuts IF Drilling MasterOp.
Changed 'M98Pł' Tag# 'R' Repeats# to SubCall CallLabB 'ł' Tag# at OpGuts IF Drilling MasterOp.
Added TagDown at OpGuts IF Drilling MasterOp.
Fixed problem with Flag(2).
Added SetFlagF(5) at ProgStart.
Changed SetFlagF(2) to SetFlagF(5) at GetPreTool.
Changed SetFlag(2) to SetFlag(5) two places at GetPreTool.
Added SetFlagF(5) at ProgStart.
Changed IF Flag(2) to IF Flag(5) two places at NewToolOp3.
Changed IF Flag(2) to IF Flag(5) at End2.
Flag(2) was originally Flag(1) in M197.80 and used with regards to PreTooling.
.10 format requires uses of Flags(1) to (4), for ZReps, Drill Subs and MultipleParts, thus
PreTool must use next available Flag.
DWB}

{1/17/96, Updated .10 to .11 version, MPK}

{3/25/96, Tested ZOnlyRepAutoCycle, Changed version # to .12, MPK}

{Prog Numeric Format Definitions ****}

#1 = '#.00'
#2 = '###^##0'
#3 = '*###^##0'
#4 = '####.####;0.'
#5 = '#######0'
#6 = '####^##0'
#7 = '###^###0'
#8 = '00'
#9 = '*###^##0'

FORMAT(FileFeet#,1)
FORMAT(FileMeters#,1)
FORMAT(ToolDiameter#,4) {.72}
FORMAT(Tag#,5)
FORMAT(Operation#,5) {.72}
FORMAT(Tool#,5) {.72}
FORMAT(Parts#,5) {.72}
FORMAT(CallMasterNum#,5)
FORMAT(Dwell#,6) {.72}
FORMAT(CRCNormalVectorX#,7)
FORMAT(CRCNormalVectorY#,7)
FORMAT(ToolOffset#,8)
FORMAT(TCZ#,7)

FORMAT(CSOffsetX#,4)
FORMAT(CSOffsetY#,4)
FORMAT(CSOffsetZ#,4)
FORMAT(ADD#,5)
FORMAT(CS#,5)
FORMAT(CSOffsetA#,9)
FORMAT(CSOffsetB#,9)
FORMAT(TrackZNO#,4)

{Prog Subroutines ****}

RestoreScale:
IF Metric? {CAM file is in Metric, tools and tool path}
SetScale('.03937007874') { change to English, this is an English post}
END
RETURN

DoSubComment:
IF UseComments? AND SubComment?
'( SUB NUMBER: ' Tag# ' )' EOL
END
RETURN

DoOpComments:
IF UseComments?
SetScale('1')
IF OperationIDComment?
'( OPERATION ' Operation# ': ' OperationType$ ' )' EOL
END
IF OperationComment?
'( ' OperationComment$ ' )' EOL
END
IF WorkGroupComment?
'( ' WorkGroupComment$ ' )' EOL
END
IF ToolTypeComment?
'( TOOL ' Tool# ': ' ToolDiameter# ' ' ToolType$ ' )' EOL
END
IF ToolComment?
'( ' ToolComment$ ' )' EOL
END
RestoreScale
END
RETURN

CSWFO:
'G' ADD# CS# SUB# NewWFO# Num#('1')
RETURN

CalcCSWFO: {(iPart-1)*NumOfCS#)}
'G' ADD# MUL# NumOfCS# SUB# PartNum# Num#('1') ADD# CS# SUB# NewWFO# Num#('1')
RETURN

CSAngleA:
IF AAxisAvail?
'A' CSOffsetA#
END
RETURN

CSAngleAC:
IF AChange?
CSAngleA
END
RETURN

CSAngleB:
IF BAxisAvail?
'B' CSOffsetB#
END
RETURN

CSAngleBC:
IF BChange?
CSAngleB
END
RETURN

DoCSWFOComment:
'( CS#' CS# ' - ' CSComment$ ' )' EOL
'( ' CalcCSWFO '= X' CSOffsetX# ' Y' CSOffsetY# ' Z' CSOffsetZ# ' )' EOL
RETURN

DoCSG52Comment:
'( CS#' CS# ' - ' CSComment$ ' )' EOL
RETURN

PSInit:
MasterOpF
CallMasterOpF
RETURN

PSStuff:
RETURN

DoPostScript:
PSInit
EachPS
SeqLabC PostScript EOL
PSStuff
NextPS
RETURN

DoEndOpPS:
PSInit
EachEOPS
SeqLabC EndOpPS EOL
PSStuff
NextPS
RETURN

EntryMove:
IF FeedEntry?
SeqLabC Feed ZIn FeedEnt EOL
ELSE
SeqLabC RapidC ZIn EOL
END
RETURN

StartSub:
OpenSub
DoSubComment
'>' Tag# EOL
SeqLab {drop unconditional for proper tagging}
RETURN

SubWarning:
IF NOT FeedConnect?
IF AnyZshift?
' ' EOL
'( WARNING Z CLEARANCE WILL CHANGE WITH EACH CYCLE OF SUB REPEAT )' EOL
' ' EOL
END
END
RETURN

StdSub:
SeqLabC SubCall CallLabB 'ł' Tag# 'R' Repeats# EOL
StartSub
RETURN

FinishSub1: {part 1}
UnSkipZ
IF FeedConnect?
SeqLabC CRCOffC EOL
ELSE
SeqLabC RapidC ZCP3C EOL
SeqLabC CRCOffC
IF NOT EmptyLine?
LastFeatExtend
END
EOL
END
RETURN

FinishSubG92: {part 2}
SeqLabC Preset ShiftRC EOL
SeqLabC EndSub EOL
TagDown
CloseSub
SeqLabC Preset UnshftRC EOL
RETURN

ToggleIncDecWFO:
IF Flag?('3')
SetFlagF('3')
ELSE
SetFlag('3')
END
RETURN

OpenMP:
TagUp TagInc
IF WFOCS? OR Flag?('2')
StartSub
SaveCSProg
SaveCSOpStart
ClearCSOffset
ELSE
SeqLabC SubCall CallLabB 'ł' Tag# 'R' Parts# EOL
StartSub
END
RETURN

CloseMP:
IF WFOCS? OR Flag?('2')
SeqLabC EndSub EOL
CloseSub
IF Flag?('3')
NewWFO
EachWFO {simple eachPart}
IF Flag?('2')
SeqLabC SetWFO EOL
EachCSOp
DoCSG52Comment
ClearCSOffset
SeqLabC 'G52X' CSOffsetX# 'Y' CSOffsetY# 'Z' CSOffsetZ# EOL
SeqLabC SubCall CallLabB 'ł' Tag# EOL
NextCSOp
ELSE
EachCSOp
DoCSWFOComment
ClearCSOffset
SeqLabC CalcCSWFO EOL
SeqLabC SubCall CallLabB 'ł' Tag# EOL
NextCSOp
END
ClearCSOffset
IncWFO
NextWFO {simple NextPart}
ELSE
LastWFO
EachWFO {simple eachPart}
IF Flag?('2')
SeqLabC SetWFO EOL
EachCSOp
DoCSG52Comment
ClearCSOffset
SeqLabC 'G52X' CSOffsetX# 'Y' CSOffsetY# 'Z' CSOffsetZ# EOL
SeqLabC SubCall CallLabB 'ł' Tag# EOL
NextCSOp
ELSE
EachCSOp
DoCSWFOComment
ClearCSOffset
SeqLabC CalcCSWFO EOL
SeqLabC SubCall CallLabB 'ł' Tag# EOL
NextCSOp
END
ClearCSOffset
DecWFO
NextPrevWFO {simple NextPart}
END
IF Flag?('4')
ToggleIncDecWFO
END
TagDown
ELSE
SeqLabC Preset ShiftPC EOL
SeqLabC EndSub EOL
TagDown
CloseSub
SeqLabC Preset UnshftPC EOL
END
RETURN

SubCSMP:
IF WFOCS?
IF ChangeCS?
SeqLabC EndSub EOL
CloseSub
TagInc
StartSub
SaveCSProg
END
ClearCSOffset
END
RETURN

DoAbsOrInc:
IF Flag?('1') AND AbsoluteMoves?
IF ZMove? AND AbsValue?
IncValue
ELSE
IF NOT ZMove? AND NOT AbsValue?
AbsValue
END
END
END
RETURN

DoDrillAbsOrInc:
IF Flag?('1') AND AbsoluteMoves?
IF SPZMove? AND AbsValue?
IncValue
ELSE
IF NOT SPZMove? AND NOT AbsValue?
AbsValue
END
END
END
RETURN

RestoreAbsOrInc:
IF Flag?('1') AND AbsoluteMoves? AND NOT AbsValue?
SeqLabC AbsValue EOL
END
RETURN

FormatArc:
DoAbsOrInc
IF ArcCW?
CWArcC
ELSE
CCWArcC
END
MoveXYZC
IF ArcIJFormat?
ArcIJC
ELSE
ArcRC
END
RETURN

CkCRC: { 4.2 }
IF XMove? OR YMove? { Approach Length Feature and Multiple Pockets }
IF NOT ZMove?
CRCOnC
IF NOT EmptyLine?
ResetCRCNum
END
END
END
IF LastFeat? AND EmptyLine? { Exit Length Feature }
CRCOffC
END
RETURN

StdLine: {enables CRC on first call, .70}
IF Decelerate?
IF RoomToDecel?
DecelMove1
SeqLabC CkCRC
IF EmptyLine? {no CRC used or its already activated}
FeedC DoAbsOrInc MoveXYZC FeedRateC EOL
ELSE {need vectors}
FeedC DoAbsOrInc MoveXYZC {'I' CRCNormalVectorX# 'J' CRCNormalVectorY#} CRCOfst FeedRateC EOL
END
DecelMove2
END
SeqLabC CRCOnC
IF EmptyLine? {no CRC used or its already activated}
FeedC DoAbsOrInc MoveXYZC DecelFeed EOL
ELSE {need vectors}
FeedC DoAbsOrInc MoveXYZC {'I' CRCNormalVectorX# 'J' CRCNormalVectorY#} CRCOfst DecelFeed EOL
END
ELSE
IF XMove? OR YMove? OR ZMove?
SeqLabC CkCRC
IF EmptyLine? {no CRC used or its already activated}
FeedC DoAbsOrInc MoveXYZC FeedRateC EOL
ELSE {CRC needed and not yet activated, need vectors & offset}
FeedC DoAbsOrInc MoveXYZC {'I' CRCNormalVectorX# 'J' CRCNormalVectorY#} CRCOfst FeedRateC EOL
END
END
END
RETURN

ToolPath:
EACHFeat
IF PointFeat?
IF AutoCycle?
SeqLabC MoveSXYC EOL
SeqLabC SubCall CallLabB 'ł' Tag# EOL
CalcACSRXY {calc tool position after sub call, CalcAutoCycleStatusRecordXY}
ELSE
IF NOT FirstFeat?
SeqLabC DoDrillAbsOrInc MoveSXYZC EOL
END
END
ELSE
IF RapidFeat?
IF LastFeat? AND AutoCycle? {.70}
SeqLabC DoAbsOrInc CRCOffC RapidC MoveXYZC EOL
ELSE
IF XMove? OR YMove? OR ZMove?
SeqLabC DoAbsOrInc RapidC MoveXYZC EOL
END
END
ELSE
IF LineFeat?
IF AutoCycle? {.70}
IF LastFeat?
SeqLabC DoAbsOrInc CRCOffC FeedC MoveXYZC FeedRateC EOL
ELSE
IF ZMove? {skip CRCOn until first non-Z move line, skipping ramps}
SeqLabC DoAbsOrInc FeedC MoveXYZC FeedRateC EOL
ELSE
StdLine {enables CRC on first call}
END
END
ELSE
StdLine
END
ELSE
IF ArcFeat?
EACHQuadrant
IF LastQuadrant? AND Decelerate?
IF RoomToDecel?
DecelMove1
SeqLabC FormatArc ArcFeedC EOL
DecelMove2
END
SeqLabC FormatArc DecelFeed EOL
ELSE
SeqLabC FormatArc ArcFeedC EOL
END
NEXTQuadrant
END
END
END
END
NEXTFeat
RestoreAbsOrInc
RETURN

AutoCycCutSub1: {part 1}
SaveSubStatus {save tool position}
SetPass1 {element cut moves}
StartSub
SetSRXYtoSP
SeqLabC IncValue EOL
RETURN

AutoCycCutSub2: {part 2}
ToolPath
IF Repeats? AND FeedConnect? AND ZshiftOnly?
SeqLabC AbsOrInc EOL {.69 removed RapidC} {.71.2 removed CRCOffC, gets turned off in ToolPath}
ELSE
SeqLabC AbsOrInc RapidC ZCP2 EOL {.71.2 removed CRCOffC, gets turned off in ToolPath}
END
SeqLabC EndSub EOL
CloseSub
SetSRSubXY {restore SR to 1st position value}
SetSRSubMove
RETURN

AutoCycPat:
SetPass2 {position pattern}
ToolPath {call after TagInc for correct sub calls}
SetPass1 {reset}
RETURN

Milling:
IF AutoCycle?
TagUp TagInc
AutoCycCutSub1
EntryMove
AutoCycCutSub2
AutoCycPat
TagDown
ELSE
EntryMove
ToolPath
END
RETURN

G92Sub:
SubWarning
StdSub
SeqLabC AbsOrInc Connect StrtPos EOL
Milling
FinishSub1
FinishSubG92
RETURN

ZonlyRepAutoCycle:
AutoCycPat {write pattern moves and main calls}
StartSub
TagUp TagInc
EachCycle
SetSRXYtoEP
IF FeedConnect?
IF NOT FirstCycle?
IF SPXMove? OR SPYMove?
SeqLabC Feed IncValue StrtPosC EOL
SeqLabC AbsOrInc
ELSE
SeqLabC Feed
END
ELSE
SeqLabC Feed
END
ZInPlusInc FeedEnt EOL
ELSE
IF NOT FirstCycle?
IF SPXMove? OR SPYMove?
SeqLabC Rapid IncValue StrtPosC EOL
IF FeedEntry?
SeqLabC AbsOrInc ZCP2PlusInc EOL
SeqLabC Feed ZInPlusInc FeedEnt EOL
ELSE
SeqLabC AbsOrInc ZInPlusInc EOL
END
ELSE
IF FeedEntry?
SeqLabC Rapid ZCP2PlusInc EOL
SeqLabC Feed ZInPlusInc FeedEnt EOL
ELSE
SeqLabC Rapid ZInPlusInc EOL
END
END
ELSE
IF FeedEntry?
SeqLabC Feed ZInPlusInc FeedEnt EOL
ELSE
SeqLabC Rapid ZInPlusInc EOL
END
END
END
IF FirstCycle?
SetStatusOff {protect Z position for incremental sub}
END
SeqLabC SubCall CallLabB 'ł' Tag# EOL
NextCycle
SetStatusOn
AutoCycCutSub1 {build element sub}
AutoCycCutSub2
{.69, removed FinishSub1}
IF FeedConnect? {there is no Z up in the sub, .69}
SeqLabC Rapid ZCP2 EOL {.69}
END {.69}
SeqLabC EndSub EOL
TagDown
CloseSub
{Element shift, not pattern}
RETURN

ZonlyRep:
EachCycle
IF NOT FirstCycle?
SeqLabC Connect StrtPos EOL {.71.2, added Connect}
END
IF FeedConnect?
SeqLabC FeedC ZInPlusInc FeedEnt EOL {.71.2, changed to FeedC}
ELSE {Entry/Exit Connect}
IF FeedEntry?
IF NOT FirstCycle?
SeqLabC RapidC ZCP2PlusIncC EOL {can't call for cycle =1} {.69 added Rapid, reads better} {.71.2, changed to RapidC, reads better}
END
SeqLabC Feed ZInPlusInc FeedEnt EOL
ELSE
SeqLabC RapidC ZInPlusInc EOL {.69 added Rapid, reads better} {.71.2, changed to RapidC, reads better}
END
END
SeqLabC SubCall CallLabB 'ł' Tag# EOL
NextCycle
StartSub
TrackZNO# FIRST SPZ#
ToolPath
FinishSub1
SeqLabC EndSub EOL
TagDown
CloseSub
RETURN

CheckPass:
IF AutoCycle? {use the correct StrtPos}
SetPass2
ELSE
SetPass1
END
RETURN

GetPreTool:
SetFlagF('5')
IF Equal? Tool# Num#('13') {tool = 13}
PreTool
ELSE
IF Equal? NextTool# Num#('13') {next tool = 13}
PreTool
ELSE
IF ToolOver?('13')
IF GreaterThan? NextTool# Num#('13') {tool & next tool > 13}
PreTool
ELSE {tool > 13 next tool < 13}
'T13' SetFlag('5')
END
ELSE
IF GreaterThan? NextTool# Num#('13') {tool < 13 next tool > 13}
'T13' SetFlag('5')
ELSE {tool & next tool < 13}
PreTool
END
END
END
END
RETURN

ProgStart:
InitProg
TagInit
ReverseXZArcs
SetFlood
SetFlagF('1') {not std sep sub Zreps in effect} {rep change 2}
SetFlagF('2') {not using G52's for multiple parts }
SetFlag('3') {True = incrementing WFO numbers for MP. False = decrementing WFO numebrs for MP}
SetFlagF('4') {True = toggle between incrementing/decrementing WFO's }
SetFlagF('5') {True = T13 in spindle per GetPreTool }
UseSeparateSubCalls
SetMaxSeparateSubCalls ('50') {?}
SetMaxRPM('10000') {?}
SetMaxFeed('500') {?}
SetTCZ('28.0')
IF PSComment? AND UseComments?
'PostScript:' EOL
' Literals: put between single or double quotes.' EOL
' Separate commands and literals with at least one space.' EOL
' A CR ( RETURN key ) will start a new line.' EOL
' Commands: may be capital and/or lower case letters. Separate commands with a space.' EOL
' EndOP -' EOL
' all literals and commands before an ENDOP command' EOL
' will appear at the beginning of the operation. All ' EOL
' literals and commands after an ENDOP command will appear' EOL
' at the end of the operation. ' EOL
' ToolChangeZ(28.0), TCZ(28.0) -' EOL
' The value in parenthese establishes the value the spindle will retract to.' EOL
' Its is Modal and 280000 is the default.' EOL
END

IF MultipleParts?
IF WorkFixtureOffsets?
IF LTEqual? MUL# Parts# NumOfCS# Num#('0')
SetWFOCS { use WFO for CS changes }
ELSE
SetFlag('2')
END
END
ELSE
IF LTEqual? NumOfCS# Num#('0') {****}
SetWFOCS { use WFO for CS changes }
ELSE
SetFlag('2')
END
END
RETURN

SkipToLastFeat:
EachFeat
IF LastFeat?
TrackXNO# SPX#
TrackYNO# SPY#
END
NextFeat
RETURN

SetDrillEndOpZ:
IF RetractToCP1?
TrackZNO# ClearancePlane1#
ELSE
TrackZNO# ClearancePlane2#
END
RETURN

OpGuts:
IF Milling?
SeqLabC ZCP2C EOL
IF Repeats?
TagUp TagInc
IF ZshiftOnly?
IF AutoCycle? {incremental Autocycle sub can have Z moves}
ZonlyRepAutoCycle
ELSE {Z shift only, NOT Auto Cycle}
IF UseSeparateSubCalls? AND CyclesLessThanMaxSubCalls?
SetFlag('1') {std sep sub Zreps are in effect} {rep change 2}
ZonlyRep {rep change 1}
SetFlagF('1') {not std sep sub Zreps in effect} {rep change 3}
ELSE {no sep subs desired}
G92Sub
END
END {end Auto Cycle IF}
ELSE {not Z only}
G92Sub
END {end Z only IF}
ELSE {no repeat OPs}
Milling
END
SeqLabC RapidC ZCP3C EOL
SeqLabC CRCOffC
IF NOT EmptyLine?
LastFeatExtend
END
EOL
ELSE
IF Drilling?
IF Repeats?
TagUp TagInc
StdSub
SeqLabC AbsOrInc Rapid StrtPos EOL
END
SeqLabC DrillCP EOL
GetCycle
SeqLabC Cycle FromCP StrtPos ZDepth RLevel Dwell Peck Retract FeedEnt EOL
IF CallMasterOp?
SeqLabC SubCall CallLabB 'ł' CallMasterNum# EOL
SkipToLastFeat
ELSE
TrackZNO# FIRST SPZ#
IF MasterOp?
SetFlag('1') {std sep sub Zreps in effect}
TagUp NewMasterTag
SeqLabC SubCall CallLabB 'ł' Tag# EOL
StartSub
ToolPath
SeqLabC EndSub EOL
TagDown
CloseSub
SetFlagF('1') {not std sep sub Zreps in effect}
ELSE
ToolPath
END
END
SetDrillEndOpZ
SeqLabC Rapid 'G80' ZCP3 EOL
IF Repeats?
FinishSubG92
END
END
END
RETURN

NotSameToolWFO:
IF WFOCS?
IF ChangeCS?
DoCSWFOComment
SeqLabC CSWFO EOL
ELSE
SeqLabC 'G' NewWFO# EOL
END
ELSE
IF ChangeCS?
DoCSG52Comment
SeqLabC 'G52X' CSOffsetX# 'Y' CSOffsetY# 'Z' CSOffsetZ# EOL
END
END
ClearCSOffset
RETURN

SameToolWFO:
IF WFOCS?
IF ChangeCS?
DoCSWFOComment
SeqLabC CSWFO EOL
END
ELSE
IF ChangeCS?
DoCSG52Comment
SeqLabC 'G52X' CSOffsetX# 'Y' CSOffsetY# 'Z' CSOffsetZ# EOL
END
END
ClearCSOffset
RETURN

InitOp:
EOR EOL
IF UseComments?
IF ProgramNameComment?
'( PROGRAM: ' ProgramName$ ' )' EOL
END
IF ProgramComment?
'( ' ProgramComment$ ' )' EOL
END
IF FormatNameComment?
'( FORMAT: ' FormatName$ ' )' EOL
END
IF TimeComment?
'( ' Date$ ' AT ' Time$ ' )' EOL
END
IF MovesComment?
'( OUTPUT IN ' MoveType$ ' INCHES )' EOL
END
IF PartsComment?
'( PARTS PROGRAMMED: ' Parts# ' )' EOL
END
IF StartToolComment?
'( FIRST TOOL IN SPINDLE )' EOL
END
END
IF ToolChangeAtHome?
SetHome
END
OpenSub
RestoreScale
RETURN

FirstOp1:
IF NOT LastTool?
SeqLabC GetPreTool EOL
END
DoOpComments
DoPostScript
RETURN

FirstOp2:
SeqLabC Plane DrillOff CRCOff EOL
SeqLabC Speed SpinOn EOL
RETURN

FirstOp3:
CheckPass
SeqLabC AbsOrInc Rapid StrtPos CSAngleA CSAngleB EOL
SeqLabC OfstOn EOL
SeqLabC CoolOn EOL
RETURN

FirstOp3a: {can't XY position before WFO}
CheckPass
SeqLabC OfstOn EOL
SeqLabC CoolOn EOL
RETURN

NewToolOp1:
SeqLabC CoolOff EOL
SeqLabC DrillOff OfstOff 'Z' TCZ# LastToolOffset EOL
RETURN

NewToolOp2:
DoEndOpPS
IF ToolChangeAtHome?
SeqLabC AbsOrInc Rapid Home SpinOff EOL
ELSE
SeqLabC SpinOff EOL
END
RETURN

NewToolOp3: {Start new Operation}
IF LAST ProgStop?
SeqLabC 'M00' EOL
ELSE
SeqLabC ProgStop EOL
END
IF FirstTool? AND LastTool?
IF Flag?('5')
SeqLabC OpToolID ToolChng EOL
END
SeqLabC ToolChng EOL
ELSE
IF Flag?('5')
SeqLabC OpToolID ToolChng EOL
END
SeqLabC GetPreTool ToolChng EOL
END
' ' EOL
DoOpComments
SeqLabC AbsOrInc Plane DrillOff CRCOff EOL
DoPostScript
RETURN

NewToolOp4:
SeqLabC Speed SpinOn EOL
RETURN

NewToolOp5:
CheckPass
SeqLabC Rapid StrtPos CSAngleA CSAngleB EOL
SeqLabC OfstOn EOL
SeqLabC CoolOn EOL
RETURN

NewToolOp5a:
CheckPass
SeqLabC OfstOn EOL
SeqLabC CoolOn EOL
RETURN

NewToolOp5b:
CheckPass
SeqLabC AbsOrInc Rapid StrtPos CSAngleA CSAngleB EOL
SeqLabC OfstOn EOL
SeqLabC CoolOn EOL
RETURN

SameToolOp1:
DoEndOpPS
IF LAST ProgStop?
SeqLabC CoolOff EOL
SeqLabC DrillOff OfstOff 'Z' TCZ# LastToolOffset EOL
IF ToolChangeAtHome?
SeqLabC AbsOrInc Rapid Home SpinOff EOL
ELSE
SeqLabC SpinOff EOL
END
SeqLabC 'M00' EOL
ELSE
IF ToolChangeAtHome?
SeqLabC DrillOff OfstOff 'Z' TCZ# LastToolOffset EOL
SeqLabC AbsOrInc Rapid Home EOL
SeqLabC ProgStop EOL
ELSE
IF CoolOff? AND LAST NOT CoolOff?
SeqLabC CoolOff EOL
END
IF NewToolOffset? OR ChangeCS?
SeqLabC DrillOff OfstOff 'Z' TCZ# LastToolOffset EOL
END
END
END
RETURN

SameToolOp2: {Start new Operation}
DoOpComments
DoPostScript
CheckPass
RETURN

SameToolOp3: {Start new Operation}
IF LAST ProgStop?
' ' EOL
SeqLabC Plane DrillOff CRCOff EOL
SeqLabC Speed SpinOn EOL
SeqLabC AbsOrInc Rapid StrtPos CSAngleA CSAngleB EOL
SeqLabC OfstOn EOL
SeqLabC CoolOn EOL
ELSE
IF ToolChangeAtHome?
' ' EOL
SeqLabC Plane DrillOff CRCOff EOL
SeqLabC SpeedC SpinOn EOL
SeqLabC AbsOrInc Rapid StrtPos CSAngleA CSAngleB EOL
SeqLabC OfstOn EOL
SeqLabC CoolOn EOL
ELSE
IF NewToolOffset?
SeqLabC PlaneC AbsOrInc Rapid StrtPos CSAngleA CSAngleB SpeedC EOL
SeqLabC OfstOn EOL
ELSE
SeqLabC PlaneC AbsOrInc Rapid StrtPos CSAngleA CSAngleB SpeedC EOL
END
END
IF NOT CoolOff? AND LAST CoolOff?
SeqLabC CoolOn EOL
END
END
RETURN

End1:
SeqLabC CoolOff EOL
SeqLabC DrillOff OfstOff 'Z' TCZ# ToolOfst EOL
RETURN

End2:
DoEndOpPS
IF FIRST ToolChangeAtHome? {.71.2 added FIRST modifier}
SeqLabC AbsOrInc Rapid FirstHome SpinOff EOL
ELSE
SeqLabC SpinOff EOL
END
IF NOT Equal? CSOffsetA# Num#('0') OR NOT Equal? CSOffsetB# Num#('0')
IF AAxisAvail?
SeqLabC CSAngleA
END
IF BAxisAvail?
SeqLabC CSAngleB
END
EOL

SeqLabC 'G92'
IF AAxisAvail?
'A0'
END
IF BAxisAvail?
'B0'
END
EOL
END
IF ProgStop?
SeqLabC 'M00' EOL
END
IF NOT FirstTool?
EachOp
IF FirstOperation?
IF Flag?('5') {T13 is in Stand By}
SeqLabC OpToolID ToolChng EOL
END
SeqLabC GetPreTool ToolChng EOL {puts 1st tool in spindle and calls 2nd to to Stand By}
END
NextOp
END
RETURN

End3:
SeqLabC 'M30' EOL
EOR EOL
NullFoot EOL
EOR EOL
Post
EOR EOL
Close
Retag
IF UseComments?
Reopen
SetScale('1')
IF FileBytesComment?
'( FILE LENGTH: ' FileBytes# ' CHARACTERS )' EOL
END
IF FileFeetComment?
'( FILE LENGTH: ' FileFeet# ' FEET )' EOL
END
IF FileMetersComment?
'( FILE LENGTH: ' FileMeters# ' METERS )' EOL
END
Close
END
RETURN

MPallTools1P: {Multiple Parts, All Tools 1 Part}
EachOp {Start of post processing}
IF FirstOperation?
InitOp
OpenMP
FirstOp1
IF NOT WorkFixtureOffsets?
SeqLabC WFO1 EOL
END
FirstOp2
FirstOp3
ELSE
IF NewTool?
NewToolOp1
NewToolOp2 {to tool change, CS problem}
SubCSMP
NewToolOp3
IF NOT WorkFixtureOffsets?
SeqLabC WFO1 EOL
END
NewToolOp4
NewToolOp5
ELSE {implied SameTool?}
SameToolOp1
SubCSMP
SameToolOp2
SameToolOp3
END
END {common point for all operations}
OpGuts
NextOp {loops back to EachOP until last Operation}
End1 {End of program}
End2
CloseMP
End3
RETURN

MP1ToollAllPfu: {Multiple Parts, 1 Tool all Parts, full up}
EachOp {Start of post processing}
IF FirstOperation?
InitOp
FirstOp1
IF NOT WorkFixtureOffsets?
SeqLabC WFO1 EOL
END
FirstOp2
OpenMP
FirstOp3
ELSE
IF NewTool?
NewToolOp1
CloseMP
NewToolOp2 {to tool change, CS problem}
NewToolOp3
IF NOT WorkFixtureOffsets?
SeqLabC WFO1 EOL
END
NewToolOp4
OpenMP
NewToolOp5b
ELSE {implied SameTool?}
SameToolOp1
SubCSMP
SameToolOp2
SameToolOp3
END
END {common point for all operations}
OpGuts
NextOp {loops back to EachOP until last Operation}
End1 {End of program}
CloseMP
End2
End3
RETURN

MP1ToollAllPXcp: {Multiple Parts, 1 Tool all Parts, exit Clearance plane}
EachOp {Start of post processing}
IF FirstOperation?
InitOp
FirstOp1
IF NOT WorkFixtureOffsets?
SeqLabC WFO1 EOL
END
FirstOp2
FirstOp3a
OpenMP
SeqLabC AbsOrInc Rapid StrtPos EOL
ELSE
IF NewTool?
CloseMP
NewToolOp1
NewToolOp2 {to tool change, CS problem}
NewToolOp3
IF NOT WorkFixtureOffsets?
SeqLabC WFO1 EOL
END
NewToolOp4
NewToolOp5a
OpenMP
SeqLabC Rapid StrtPos EOL
ELSE {implied SameTool?}
SameToolOp1
SubCSMP
SameToolOp2
SameToolOp3
END
END {common point for all operations}
OpGuts
NextOp {loops back to EachOP until last Operation}
CloseMP {End of program}
End1
End2
End3
RETURN

NoMPs: {no multiple parts}
EachOp {Start of post processing}
IF FirstOperation?
InitOp
FirstOp1
NotSameToolWFO
FirstOp2
FirstOp3
ELSE
IF NewTool?
NewToolOp1
NewToolOp2
NewToolOp3
NotSameToolWFO
NewToolOp4
NewToolOp5
ELSE {implied SameTool?}
SameToolOp1
SameToolOp2
SameToolWFO
SameToolOp3
END
END {common point for all operations}
OpGuts
NextOp {loops back to EachOP until last Operation}
End1 {End of program}
End2
End3
RETURN

{Start of executable Prog, top level ****}

ProgStart {setup and initializations}

IF MultipleParts?
IF AllToolsOnePart?
MPallTools1P
ELSE {implied OneToolAllParts?}
IF FullUp?
MP1ToollAllPfu
ELSE {implied ExitClearancePlane?}
MP1ToollAllPXcp
END
END
ELSE
NoMPs
END


Wyszukiwarka