Fanuc 6M IncSubs M001 89


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

{10/12/93
Copied & modified: Fanuc 6M M001.81.2
Created incremental subs master. Well, first release anyway!
Known Bugs:
None! Well, I dont know of any!
Known Problems:
ZCP1 does not output in incremental, using ClearancePlane1#
DrillCP does not output ZCP1 in incremental, using logic to work around, may have redundancies
ZDepth outputs depth from ZCP1 when in incremental and RetractToCP1, using logic to work around
ZDepth# outputs absolute values only when MachSpec Boolean Absolute Drill Depths is true
There is a redundancy in the usage of IncValue and AbsOrInc commands.
Jim Radcliffe}

{11/30/94
Modified: Fanuc 6M IncSubs M001.81.2
Changed DrillCP to DrillClearancePlane in Drilling Repeats.
Modified DrillClearancePlane sub to suppress output of ZCP1 unless it is needed.
Jim Radcliffe}

{9/22/95, Updated Fanuc 6M IncSubs M001.81.3 to .85 format per Fanuc 6M M001.85.01.03, JR}

{3/22/96, Tested ZOnlyRepAutoCycle, Changed version # to .89, MPK}

{Prog Numeric Format Definitions *******************************************}

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

FORMAT(FileFeet#,1)
FORMAT(FileMeters#,1)
FORMAT(ToolDiameter#,4) {.72}
FORMAT(ClearancePlane1#,4)
FORMAT(SUB#,4)
FORMAT(Program#,5) {.72}
FORMAT(Program2#,5)
FORMAT(CallMasterNum#,5)
FORMAT(Operation#,5) {.72}
FORMAT(Tool#,5) {.72}
FORMAT(NewWFO#,5) {.72}
FORMAT(Parts#,5) {.72}
FORMAT(Dwell#,6) {.72}

{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: ' Program# ' )' 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

PSInit: {reset flags}
NewWFOF
RotateF
OptCyc1F
MasterOpF
CallMasterOpF
RETURN

PSStuff: {revised.72}
IF FourthCW?
FORMAT(FourthDegree#,2)
SeqC 'A' FourthDegree# EOL
FourthCWF {reset flag}
END
IF FourthCCW?
FORMAT(FourthDegree#,3)
SeqC 'A' FourthDegree# EOL
FourthCCWF {reset flag}
END
IF FifthCW?
FORMAT(FifthDegree#,2)
SeqC 'B' FifthDegree# EOL
FifthCWF {reset flag}
END
IF FifthCCW?
FORMAT(FifthDegree#,3)
SeqC 'B' FifthDegree# EOL
FifthCCWF {reset flag}
END
RETURN

DoPostScript:
PSInit
EachPS
SeqC PostScript EOL {literals}
PSStuff {commands}
NextPS
RETURN

DoEndOpPS:
PSInit
EachEOPS
SeqC EndOpPS EOL {literals}
PSStuff {commands}
NextPS
RETURN

CheckAbsOrInc:
IF Flag?('1') {we are in a MultipleParts sub}
IncValue
ELSE
IF Flag?('2') {we are in a Repeats sub}
IncValue
ELSE {we are not in a sub}
AbsOrInc
END
END
RETURN

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

StartSub:
OpenSub
SubID EOL
DoSubComment
RETURN

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

FinishSub1: {part 1}
SeqC CRCOffC
IF NOT FeedConnect?
IF AutoCycle?
ZCP3C
ELSE
IF FIFO? {.81}
FeedC ZCP3C FeedEntC
ELSE
RapidC ZCP3C
END
END
END
EOL
RETURN

HomeOrStrtPos:
IF AllToolsOnePart?
Home
ELSE {OneToolAllParts}
StrtPos
END
RETURN

DrillClearancePlane:
IF RetractToCP1?
IF SameTool?
IF NotEqual? LAST ClearancePlane3# ClearancePlane1#
SeqC 'Z' ClearancePlane1# EOL {ZCP1 does not output in incremental}
END
END
ELSE
SeqC ZCP2C EOL
END
RETURN

ECPZmove:
IF OneToolAllParts? AND ExitClearancePlane?
IF Milling?
SeqC ZCP2 EOL
ELSE {Drilling}
IF RetractToCP1?
SeqC ZCP1 EOL
ELSE
SeqC ZCP2 EOL
END
END
END
RETURN

OpenMP:
NewProg
IF WorkFixtureOffsets?
NewWFO
EachWFO
SeqC SetWFO AbsOrInc Rapid HomeOrStrtPos EOL
ECPZmove
SeqC SubCall CallLab EOL
IncWFO
NextWFO
ELSE
EachPart
SeqC AbsOrInc Rapid HomeOrStrtPos EOL
ECPZmove
SeqC SubCall CallLab EOL
IF FirstPart?
SetStatusOff
END
NextPart
SetStatusOn
END
StartSub
SeqC IncValue EOL
SetFlag('1') {set true, we are in a MP sub}
RETURN

CloseMP:
SeqC EndSub EOL
CloseSub
SetFlagF('1')
IF WorkFixtureOffsets?
SeqC WFO1 AbsOrInc EOL
ELSE
SeqC AbsOrInc EOL
END
RETURN

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

ToolPath:
ResetCRCNum {.72}
EACHFeat
IF PointFeat?
IF AutoCycle?
SeqC MoveSXYC EOL
SeqC SubCall CallLab EOL
CalcACSRXY {calc tool position after sub call, CalcAutoCycleStatusRecordXY}
ELSE
SeqC MoveSXYZC EOL {.80.01}
END
ELSE
IF RapidFeat?
IF LastFeat?
SeqC CRCOffC RapidC MoveXYZC EOL
ELSE
IF ZMove? {skip CRCOn until first non-Z move line, skipping ramps}
SeqC RapidC MoveXYZC EOL
ELSE
IF XMove? OR YMove? OR ZMove?
SeqC CRCOnC RapidC MoveXYZC CRCOffsetC EOL
END
END
END
ELSE
IF LineFeat?
IF LastFeat?
SeqC CRCOffC FeedC MoveXYZC FeedRateC EOL
ELSE
IF ZMove? {skip CRCOn until first non-Z move line, skipping ramps}
SeqC FeedC MoveXYZC FeedRateC EOL
ELSE
IF Decelerate?
IF RoomToDecel?
DecelMove1
SeqC CRCOnC FeedC MoveXYZC FeedRateC CRCOffsetC EOL
DecelMove2
END
SeqC CRCOnC FeedC MoveXYZC DecelFeed CRCOffsetC EOL
ELSE
IF XMove? OR YMove? OR ZMove?
SeqC CRCOnC FeedC MoveXYZC FeedRateC CRCOffsetC EOL
END
END
END
END
ELSE
IF ArcFeat?
EACHQuadrant { Do not use NOT, FIRST, LAST or NEXT modifiers in this loop }
IF LastQuadrant? AND Decelerate?
IF RoomToDecel?
DecelMove1
SeqC FormatArc ArcFeedC EOL
DecelMove2
END
SeqC FormatArc DecelFeed EOL
ELSE
SeqC FormatArc ArcFeedC EOL
END
NEXTQuadrant
END
END
END
END
NEXTFeat
RETURN

WFOStuff:
IF NewWFO?
IF MultipleParts?
'*** WARNING *** DO NOT USE NEWWFO() WITH NCPOST MULTIPLE PARTS' EOL
ELSE
SeqC 'G' NewWFO# EOL
END
ELSE
IF NOT SameTool?
IF NeedWFO1?
SeqC 'G' NewWFO# EOL
END
END
END
RETURN

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

AutoCycCutSub2: {part 2}
ToolPath
SeqC CheckAbsOrInc
IF Repeats? AND FeedConnect? AND ZshiftOnly?
ELSE
IF FIFO? {.81}
FeedC ZCP2 FeedEntC
ELSE
RapidC ZCP2
END
END
EOL
SeqC EndSub EOL
CloseSub
SetSRSubXY {restore SR to 1st position value}
SetSRSubMove
RETURN

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

NoReps:
IF AutoCycle?
NewProg
AutoCycCutSub1
EntryMove
AutoCycCutSub2
AutoCycPat
ELSE
EntryMove
ToolPath
END
RETURN

RepAutoCycle:
EachRep
IF FirstCycle?
SeqC SubCall CallLab EOL
SaveProgNum2
StartSub
SetFlag('2') {set true, we are in a Repeats sub}
SeqC IncValue EOL
NewProg
AutoCycPat
AutoCycCutSub1
EntryMove
AutoCycCutSub2
SeqC EndSub EOL
CloseSub
SetFlagF('2')
ELSE
ResetPass2
SeqC CheckAbsOrInc StrtPos EOL
SeqC SubCall 'P' Program2# EOL
SetSRSubXYRC
END
NextRep
RETURN

RepZOnlyAutoCycle:
AutoCycPat
StartSub
SetFlag('2') {set true, we are in a Repeats sub}
SeqC IncValue EOL
NewProg
EachRep
SetSRXYtoEP
IF FeedConnect?
IF NOT FirstCycle?
IF SPXMove? OR SPYMove?
SeqC Feed StrtPosC EOL
ELSE
SeqC
END
ELSE
SeqC Feed
END
ZIn FeedEnt EOL
ELSE
IF NOT FirstCycle?
IF SPXMove? OR SPYMove?
SeqC Rapid StrtPosC EOL
END
END
IF FeedEntry?
SeqC ZCP2C EOL
SeqC Feed ZIn FeedEnt EOL
ELSE
SeqC ZIn EOL
END
END
SeqC SubCall CallLab EOL
IF FirstCycle?
AutoCycCutSub1 {save substatus at Z depth}
AutoCycCutSub2 {goes to ZCP2}
ELSE
IF NOT FeedConnect?
TrackZNo# ClearancePlane2#
END
END
NextRep
SeqC
IF NOT MultipleParts?
AbsOrInc
END
RapidC ZCP2C EOL
SeqC EndSub EOL
CloseSub
SetFlagF('2')
IF NOT FeedConnect?
SetStatusRapid
END
RETURN

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

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

DrillStuff:
GetCycle
SeqC Cycle FromCP
{ZDepth outputs incorrectly when in incremental and retract from 1st clearance plane}
{ZDepth# will only output absolute values}
IF MultipleParts? OR Repeats?
SetAbs
'Z' SUB# ZDepth# ClearancePlane2# {calculate incremental depth}
SetInc
ELSE
ZDepth
END
RLevel Dwell Peck Retract FeedEnt EOL
IF CallMasterOp?
SeqC SubCall CallLabB CallMasterNum# EOL
SkipToLastFeat
ELSE
TrackZNO# FIRST SPZ#
IF MasterOp?
NewMasterProg
SeqC SubCall CallLab EOL
StartSub
SeqC IncValue EOL
ToolPath
IF NOT Repeats? AND NOT MultipleParts?
SeqC AbsOrInc EOL
END
SeqC EndSub EOL
CloseSub
ELSE
ToolPath
END
END
SetDrillEndOpZ
RETURN

StdRep:
EachRep
IF FirstCycle?
SubWarning
EntryMove
SeqC SubCall CallLab EOL
StartSub
SetFlag('2') {set true, we are in a Repeats sub}
SeqC IncValue EOL
ToolPath
FinishSub1
SaveSubStatus
SeqC EndSub EOL
CloseSub
SetFlagF('2')
ELSE
SeqC CheckAbsOrInc Connect StrtPos EOL
IF FeedConnect?
SeqC ZinC EOL {takes care of different tool path start and end Z values}
ELSE
IF NOT Equal? ClearancePlane2# ClearancePlane3#
SeqC ZCP2 EOL
END
EntryMove
END
SeqC SubCall CallLab EOL
SetSRSubXYRC
SetSRSubZRC
END
NextRep
RETURN

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

{Start of executable Prog **************************************************}

{setup and initializations}
InitProg
ReverseXZArcs
InitWFONum
SetFlood
UseSeparateSubCalls
SetMaxSeparateSubCalls('50')
SetMaxRPM('10000')
SetMaxFeed('500')
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
' NewWFO(56), NWFO(56) -' EOL
' The Work Fixture Offset # you specify will be used for all following operations.' EOL
' Do not use with the ncPost multiple part option.' EOL
' 4thAxisCW(12.5), 4ACW(12.5) -' EOL
' generates a + A move of the value you specify' EOL
' 4thAxisCCW(22.5), 4ACCW(22.5) -' EOL
' generates a - A move of the value you specify' EOL
' 5thAxisCW(30), 5ACW(30) -' EOL
' generates a + B move of the value you specify' EOL
' 5thAxisCCW(22.5), 5ACCW(22.5) -' EOL
' generates a - B move of the value you specify' EOL
END
EachOp {Start of post processing *********************}
IF FirstOperation?
EOR EOL
ProgID1
IF UseComments? AND ProgramNameComment?
'( PROGRAM: ' ProgramName$ ' )'
END
EOL
IF ToolChangeAtHome?
SetHome
END
IF UseComments?
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 NOT IN SPINDLE )' EOL
END
END
OpenSub
RestoreScale
CheckPass
IF MultipleParts? AND AllToolsOnePart?
OpenMP
END
Seq Plane 'G80' CRCOff EOL
SeqC OpToolID EOL
SeqC ToolChng EOL
DoOpComments
DoPostScript
WFOStuff
SeqC Speed SpinOn EOL
IF MultipleParts? AND OneToolAllParts? AND FullUp?
OpenMP
ELSE
SeqC CheckAbsOrInc Rapid StrtPos EOL
END
SeqC OfstOn EOL
SeqC CoolOn EOL
IF MultipleParts? AND OneToolAllParts? AND ExitClearancePlane?
OpenMP
END
ELSE
IF NewTool?

{Finish off last Operation}

IF MultipleParts? AND OneToolAllParts? AND ExitClearancePlane?
CloseMP
END
SeqC CoolOff EOL
SeqC IncValue OfstOff EOL
IF MultipleParts? AND OneToolAllParts? AND FullUp?
CloseMP
END
DoEndOpPS
IF ToolChangeAtHome?
SeqC CheckAbsOrInc Rapid Home SpinOff EOL
ELSE
SeqC SpinOff EOL
END
IF LAST ProgStop?
SeqC 'M0' EOL
ELSE
SeqC ProgStop EOL
END

{Start new Operation}

Seq Plane 'G80' CRCOffC EOL
SeqC OpToolID EOL
SeqC ToolChng EOL
DoOpComments
DoPostScript
WFOStuff
SeqC Speed SpinOn EOL
CheckPass
IF MultipleParts? AND OneToolAllParts? AND FullUp?
OpenMP
ELSE
SeqC CheckAbsOrInc Rapid StrtPos EOL
END
SeqC OfstOn EOL
SeqC CoolOn EOL
IF MultipleParts? AND OneToolAllParts? AND ExitClearancePlane?
OpenMP
END
ELSE
IF SameTool?

{Finish off last Operation}

IF LAST ProgStop? OR CoolOff? AND LAST NOT CoolOff?
SeqC CoolOff EOL
END
IF LAST ProgStop? OR NewToolOffset?
SeqC IncValue OfstOff EOL
END
DoEndOpPS
IF LAST ProgStop?
SeqC SpinOff EOL
SeqC 'M0' EOL
END

{Start new Operation}

DoOpComments
DoPostScript
WFOStuff
CheckPass
SeqC PlaneC CheckAbsOrInc Rapid StrtPos SpeedC
IF LAST ProgStop?
SpinOn
END
EOL
IF LAST ProgStop? OR NewToolOffset?
SeqC OfstOn EOL
END
IF LAST ProgStop? OR NOT CoolOff? AND LAST CoolOff?
SeqC CoolOn EOL
END
END
END
END {common point for all operations}
IF Milling?
SeqC ZCP2C EOL
IF Repeats?
NewProg
IF AutoCycle?
IF ZshiftOnly?
RepZOnlyAutoCycle
ELSE
RepAutoCycle
END
ELSE {not AutoCycle}
StdRep
END {end Auto Cycle IF}
ELSE {no repeat OPs}
NoReps
END
SeqC CheckAbsOrInc
IF AutoCycle?
ZCP3C EOL
ELSE
IF FIFO? {.81}
FeedC CRCOffC ZCP3C FeedEntC EOL
ELSE
RapidC CRCOffC ZCP3C EOL
END
END
ELSE
IF Drilling?
IF Repeats?
NewProg
EachRep
IF FirstCycle?
DrillClearancePlane
SeqC SubCall CallLab EOL
StartSub
SetFlag('2') {set true, we are in a Repeats sub}
SeqC IncValue EOL
DrillStuff
SeqC
IF NOT MultipleParts?
AbsOrInc
END
DrillOff ZCP3 EOL
SaveSubStatus
SeqC EndSub EOL
CloseSub
SetFlagF('2')
ELSE
SeqC Rapid StrtPos EOL
IF RetractToCP1?
IF NOT Equal? ClearancePlane3# ClearancePlane1#
SeqC 'Z' ClearancePlane1# EOL {ZCP1 does not output in incremental}
END
ELSE
SeqC ZCP2C EOL
END
SeqC SubCall CallLab EOL
SetSRSubXYRC
SetSRSubZRC
END
NextRep
ELSE
DrillClearancePlane
DrillStuff
SeqC DrillOff ZCP3 EOL
END
SeqC RapidC ZCP3C EOL
END
END
NextOp {loops back to EachOP until last Operation}

{End of program ************************************************************}

{finish last operation}
IF MultipleParts? AND OneToolAllParts? AND ExitClearancePlane?
CloseMP
END
SeqC CoolOff EOL
SeqC IncValue OfstOff EOL
IF MultipleParts? AND OneToolAllParts? AND FullUp?
CloseMP
END
DoEndOpPS
IF FIRST ToolChangeAtHome? {.71.2 added FIRST modifier}
SeqC CheckAbsOrInc Rapid FirstHome SpinOff EOL
ELSE
SeqC SpinOff EOL
END
IF ProgStop?
SeqC 'M0' EOL
END
IF MultipleParts? AND AllToolsOnePart?
CloseMP
END
SeqC EOP EOL
CloseSub
Post2 {organize Subs into one program}
EOR EOL
Close
IF UseComments?
SetScale('1') {restore scale for comments}
Reopen
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


Wyszukiwarka