80001694 an Introduction to ESPRIT Post Processor

download 80001694 an Introduction to ESPRIT Post Processor

of 22

Transcript of 80001694 an Introduction to ESPRIT Post Processor

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    1/22

    Post Perfect: An Introduction to ESPRIT Post Processor

    1. IntroductionThis class is an introduction to ESPRIT post processor. You will be given tips that willhelp you write your own post processor or to modify an existing one.

    This class is also a prereuisite for the more advanced post processor classes: PostPerfect: 4- and 5-Axis Outputand Post Perfect: Mill-Turn Output.

    Iportant note:

    Please always refer to ESPRIT Post !elp "in ESPRIT go to !elp # Post !elp$. %ost ofthe points below are covered& explained and detailed there.

    '. !"at#s ne$ in ESPRIT post processor: ne$ par% c&cleand tool c"an'e location

    ( new Par) cycle is introduced in ESPRIT '*+'. It is now possible to par) a headwithout selecting a tool. Par) positioning has also been improved and optimi,ed.You can even position your head in the machine wor) coordinate system "-/$.0inally& new return modes have been implemented to precisely control how to par)your tool.

    1n every tool pages& there is also a new tool change movement option2 it is possibleto select machine wor) coordinate system "-/$.

    Please see the class (et )our Mo*e On: Strate'ies for Multitas%in' and Pinc"Mac"inin'for more details.

    Par) and tool change do now share the same positioning options. Theseimprovements will reuire some changes in your post processor. These will beexplained and documented in the class Post Perfect: Mill-Turn Output.

    /. S&ste *aria+les

    a. Introduction

    System variables serve two purposes2 They allow certain default values to be set 1ther variables can be used to call special features.

    The structure used in the system variables section is2

    ****** SYSTEM VARIABLES ******

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    2/22

    Keyword : Value

    +. ,oonl& used *aria+les

    Two system variables that are commonly used are 34ode5efault and34odeIncrement. 34ode5efault is the seuence number to start the program and34odeIncrement is how much the seuence number increases on each line.

    1ther system variables allow the user to call up special functions or conditions. 0orexample& some machines cannot have spaces in the 34 code. The system variablecalled RemoveSpaces provides this function.

    Perhaps the most important system variable is %achineTolerance. It should be setto the resolution of the 34 machine. If the 34 machine can ma)e moves out to thefifth decimal place& then set %achineTolerance to *.****+ in the post. (ny movethat is less than the %achineTolerance value will be eliminated from the 34 codeoutput.

    Some system variables have a more advanced use in the Examples section of thepost. In that case& system variables and functions can be used to determine certainvalues from ESPRIT.

    c. ess is More

    6ith system variables& the rule is2 do not add variables unless you need to set avalue other than default.

    d. Exaple: ,"an'e -code increent

    If the system variable 34odeIncrement is set + in your post processor& wheneverSeuence3umber 3 will be called& the current seuence number will incrementedby +. 3ote that with the settings below& 3 will start at 3+ "0irst 3 value output in thecode will be2 34ode5efault * plus 34odeIncrement +$ and will reach at the most37777.

    ****** SYSTEM VARIABLES ******

    NCodeIncrement : 1

    NCodee!ault : "

    Ma#NCode : $$$$

    ****** %&RMATABLE C&ES ******

    Se'uenceNum(er : N N ) N N " N ) N N " "

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    3/22

    Sample 34 code2

    N1+S,INLE1 -R&&VIN- %ACE CANNE CYCLE.

    N2+T1/1/ -R&&VIN- INSERT %ACE 0V.

    N3-2 3"

    N4-2 V" 4"

    N5-/)

    N6-"" T1/1/

    3ow& if you change 34odeIncrement to & you 34 code will be2

    N5+S,INLE1 -R&&VIN- %ACE CANNE CYCLE.

    N10+T1/1/ -R&&VIN- INSERT %ACE 0V.

    N15-2 3"

    N20-2 V" 4"

    N25-/)

    N30-"" T1/1/

    8. Mac"ine odes

    a. Introduction

    %achine modes serve two purposes2

    To set certain default machine values in case they are not set in the ESPRITprogram To give important machine reuirements that are not found within any ofthe technology in ESPRIT

    The structure used in the machine modes section is2

    Keyword : Value

    +. Re*ie$ of coon ites

    9elow is an example of typical machine modes2

    ****** MAC5INE M&ES ******

    Coord6nateMode : A(7olute

    Mea7urementMode : Metr6c

    C6rcleMode : By08"

    CenterMode : Increment%romStart

    4or9,laneMode : Y,lane

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    4/22

    0or example& the default for %easurement%ode can be Inch or %etric.4oordinate%ode can be Incremental but is almost always set to (bsolute. If thesevalues have already been programmed in ESPRIT& these two machine modes areignored.

    To specify the capabilities of the machine& 4ircle%ode specifies how much of a circlethe 34 machine can cut in one bloc) of 34 code. If the machine can cut a /:*;degree arc in one bloc) of code& then 9y/:* can be set for 4ircle%ode. If themachine can cut up to 7* degrees in one bloc) and must brea) down circles largerthan 7*& then use 9y

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    5/22

    ************************** %&RMATABLE C&ES **************************

    * Inc> &ut?ut Metr6c &ut?ut @ =ero Value*

    * L ; T L ; T L ; @*

    ************************************************************************

    A(7olute : N ) Y N ) N / Y N 0 1 1 N " "

    ToolNum(er : T Y N N " Y N N " "

    6ameterCom?en7at6on : Y N N " Y N N " " 1 N " "

    The )eyword returns a value from ESPRIT. 0or example& >(bsolute returns the valueof the > coordinate in ESPRIT. The symbol for >(bsolute is usually >.

    0ormatable codes must be defined in the formatable codes section before they canbe used in other sections of the post file.

    9elow is an example of formatable codes being used in the @Examples@ section. The

    >& Y& and ? coordinates& the I and A circle center coordinates& the T for the toolnumber& S for spindle speed& and 0 for feedrate are all formatable codes.

    e#C6rcle : N -1< C6rcle6rect6on* Y I* D* %

    e#&t>erToolC>ane : ToolC>aneComment

    : N T M"8

    e#Ra?6d : N -"" Y =

    e#L6near : N -"1 Y = %

    +. Exaples of coon forats

    6hen outputting program numbers "O0001+SAM,LE 1.$& the first four digits need tobe filled with ,eros. To achieve this& Program3umber can be set this way2

    ,roramNum(er : & Y ) N N " Y ) N N " "

    O:Symbol that will be output in 34 code.

    ) 4 0:

    The first Y will fill the digits with ,erosB 8 sets which digits will be filed "8 first digits$B3 to ma)e sure to not output a decimal pointB 3 to not fill trailing digits with ,erosB *trailing digits would be filled. The same settings are applied for inch and metricoutput.

    0:

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    6/22

    Sign output is set to * so that program number always output with no sign.

    c. MiscM,ode Misc(,ode

    1nly twenty custom symbolic codes can be defined using "%iscSymbolic4odeCB seenext part$. ( good alternative to avoid using them all is to use %isc%4ode and%isc-4ode.

    %isc%4ode and %isc-4ode formatable codes can be used for miscellaneous % and- codes. %isc%4ode and %isc-4ode do not correspond to any value in ESPRIT. Itsonly use is as a user defined formatable that is always overwritten& similar to%isc0ormat+& etc.

    d. Paddin': 2se of underscores

    In the 34 code& a symbol can be used for multiple different cycle. 0or example& & Y& and ? Start Positions from the Set 1rigin page. 9ut if a Set 1rigin isnot created& then a -7' with >& Y& and ? of the approach "entry$ point of the firstoperation needs to be output. !ere a variable can be used to determine whether aSet 1rigin has been created. The variable acts li)e a flag. Initially the flag variable iscleared& but as soon as the -7' is output& the variable will be set so as to preventany additional -7' output2

    M67c%ormat1 : N ) Y N ) N / Y N 0 1 1 N " "M67c%ormat : Y N ) Y N ) N / Y N 0 1 1 N " "

    M67c%ormat0 : = N ) Y N ) N / Y N 0 1 1 N " "

    Set&r66n : -$

    Var6a(le : 7eto

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    11/22

    e#StartCode : 7etoJ+".

    e#Set&r66n : -$ *+#7tart. Y*+y7tart. =*+7tart.

    : 7etoJ+1.

    e#CycleStart : I! +7etoJ".

    : -$ *+#ne#t. Y*+yne#t. =*+ne#t.

    : 7etoJ+1.

    : EndI!

    (n array variable can be declared with the formatarrayFname"lowerFindex..upperFindex$. Suppose there was a 8 axis lathe postwhere for sync purposes all of the spindle speeds and feedrates had to be )nownprior to changing to the tool used for those operations. The example

    exF4ycle5efinitionis called for each operation at the beginning of the 34 code. Inthis example all of the feed and speed values could be recorded into an array forlater use. The following would do ust that2

    Var6a(le : c77+1;;$$$. !?r+1;;$$$. o?count

    e#StartCode : o?countJ+".

    e#Cyclee!6n6t6on : o?countJ+o?count@1.

    : c77+o?count.J+ne#tcl!6le+)12..

    : !?r+o?count.J+ne#tcl!6le+)18..

    The examples above demonstrate numeric variables. Hser defined variables mayalso contain strings& and there is a set of string functions for dealing with stringsand string variables.

    >. Su+routines

    a. Introduction

    There are a lot of examples where certain parts of code may be repeated over and

    over again. If a change has to be made to this code& one of the locations couldeasily be missed. Repeated code li)e this can instead be defined as a subroutine.Then if a change needs to be made& it only has to be done in one location.

    +. Sin'le line ulti-line

    Sin'le line su+routines:

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    12/22

    Some subroutines may be ust part of a single line. The format for these subroutinesis2

    e!6ne 7u(rout6nename GcodeH Ende!6ne

    The )eywords 5efineand End5efineare used to create the subroutine. To call thesubroutine then& a MsubroutineFname is inserted into the appropriate examples. TheMis only used before the name when calling it in the examples& not when defining it.

    (s one example& maybe all of the drilling canned cycles in a post are canceled with3 -** -=* %*7. Instead of putting this into all of the cancel examples and ris)inghaving to change it several places later& a single line subroutine could be made li)eso2

    e!6ne cannedcancel N -"" -2" M"$ Ende!6ne

    The cancel examples would then call this subroutine li)e this

    e#r6llCancel : cannedcancel

    e#,ec9Cancel : cannedcancel

    e#Ta?Cancel : cannedcancel

    e#BoreCancel : cannedcancel

    Multi-line su+routines:

    1ther subroutines may encompass several lines of 34 code. The format for them is2

    e!6ne 7u(rout6nename

    : GcodeH

    : ;;;

    : GcodeH

    Ende!6ne

    6here between the 5efineand End5efinethere can be as many lines of code asnecessary.

    ( typical mill post may contain the following2

    e#%6r7tToolC>ane : T M"8

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    13/22

    : ToolC>aneComment

    : T+7econdtool.

    e#&t>erToolC>ane : T M"8

    : ToolC>aneComment

    : T+ne#ttool.

    e#La7tToolC>ane : T M"8

    : ToolC>aneComment

    : T*+!6r7ttool.

    This could be rewritten with a subroutine as2

    e!6ne tc

    : T M"8

    : ToolC>aneComment

    Ende!6ne

    e#%6r7tToolC>ane tc

    : T+7econdtool.

    e#&t>erToolC>ane tc

    : T+ne#ttool.

    e#La7tToolC>ane tc

    : T*+!6r7ttool.

    3otice how there is no 2 "colon$ between the exF )eyword and the Mfor thesubroutine call. This is because with a multiple line subroutine the colons areembedded between the subroutine 5efine and End5efine. If you include them inboth places& you will get a compilation error.

    otes:

    %a)e sure to always end a subroutine with End5efine.

    Subroutines must always be defined above all call locations.

    In the samples above& the subroutine calls were all made within theExamples section. It is possible to ma)e subroutine calls in other sections ofthe post .(S4 file.

    7. Exaples section

    a. Introduction

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    14/22

    The Examples section is the heart of the post because it gives examples of what theoutput 34 code is supposed to loo) li)e. The example )eywords all start with exF.Everything that is programmed in ESPRIT has a corresponding exF )eyword in thepost.

    The structure used in the Examples section is2

    e#Keyword : NC Code %&RMAT

    The format of the 34 code is given to the right of the colon"s$. There are severaldifferent types of codes used to give the 34 format. Three of the most importanttypes seen in the Examples section are& as seen above2 symbolic codes& symbolicswitches& and formatable codes.

    Some examples produce a single line of 34 code. ( typical arc move may loo) li)ethis2

    e#C6rcle : N -1< C6rcle6rect6on* Y I* D* %

    1ther examples may generate several lines of 34 code li)e this tool changeexample2

    e#&t>erToolC>ane : ToolC>aneComment

    : N T M"8

    Each line after exF )eyword that starts with colon ma)es a line in the 34 file.

    (ny line in an exF example can be bro)en up into multiple lines in the .asc but still

    only produce one line of code in 34 file. This is done by using NN line continuationin .asc2

    e#CycleStart : Comment : S?6ndle3n6t I! +7?6ndle7?eed/"". S+1. El7e \\ I! ++7?6ndle7?eedJ/"". OO +7?6ndle7?eed1/".. \\ S+. El7e S+0. EndI! EndI! S?6ndle6rect6on

    Iportant notes:

    Each exF example in your post processor file must have a colon "2$ on itsfirst line. Each example can only be defined once2 each example can only have oneinstance in the post processor.

    +. Re*ie$ of exaple flo$ order

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    15/22

    To wor) on a post processor& it is necessary to )now the exF examples wor)flow.This way& the proper logic can be implemented in each example of your postprocessor.

    The best way to review this flow order is to post the long 34 code2 in ESPRIT& go to

    0ile # (dvanced 34 code D or push on 4trl O 07 on your )eyboard2

    The (dvanced 34 4ode 1utput window will be displayed. 4hec) JongB this way&

    when you post& the long 34 code will be displayed.

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    16/22

    Jong 34 code shows the @exF...@ )eywords from the .(S4 0ile before the line"s$ of34 code that )eyword produced. You can this way see the posting flow order.

    Sample2

    /

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    17/22

    /2 5ard ESTART,&INT+r6ll4ra?. -"" C12";"

    -"" =1$;8))

    );1 Y";" M"2

    /20 So!t EB&RESTART+r6ll4ra?. -2$ 0);) R";" %1/";"

    /2) So!t EB&REB&Y+r6ll4ra?. C$";"

    /2/ So!t EB&REB&Y+r6ll4ra?. C";"

    /28 So!t EB&REB&Y+r6ll4ra?. C$";"

    /2< So!t EB&RECANCEL+r6ll4ra?. -2"

    /22 5ard ECYCLEEN+r6ll4ra?.

    /2$ 5ard ET&&LCANCEL M"$

    -0" 3"

    -0" V" 4"

    M"/

    M8$

    M)8

    c. ?ard *s. soft

    (s you can see in the sample above& there are Soft and !ard examples.

    ( !ard example is always called& regardless of any technology or other settings.Soft examples are only called based on certain conditions. exFStart4odeis a hardexample because it always comes at the start of the 34 4ode output. exF%ainStartis a hard example because it always comes at the start of the main program.Ji)ewise exF%ainEndand exFEnd4odeare hard examples.

    exFTap'Startand exFTap'9odyare soft examples& because they are only used if

    4anned 4ycle is Yes and the 4ycle Type is set to Tap ' on the drilling technologydialog. If 4anned 4ycle was Yes and 4ycle Type was ust Tap& then the softexamples exFTapStartand exFTap9odywould be called instead. If 4anned 4yclewas 3o& then instead of those examples& the motion would be bro)en down into allof the exFRapidand exFJinearmoves necessary to perform the tapping on eachhole. exFRapid and exFJinear are themselves Soft examples.

    In both cases& however& the example that is called can depend on what otherexamples are defined "or not defined$ in the post .(S4 file. exF4ycleStart is a !ardexample& and it always appears at the start of an operation& unless it is a drillingtype operation and exFPT1P4ycleStartis defined in the post .(S4 file. IfexFPT1P4ycleStart is defined in the post .(S4 file& then it will be used for the startof drilling type operations instead of exF4ycleStart.

    If 4anned 4ycle was Yes and 4ycle Type was Tap ' on a drilling technology dialog&but the post .(S4 file did not contain the exFTap'Start and exFTap'9ody examples&then exFTapStart and exFTap9ody would be used instead. If those examples werenot defined in the post .(S4 file either& then it would resort to brea)ing the motionup into exFRapid and exFJinear moves.

    nowing this difference and what the terms !ard and Soft mean can be somewhatuseful when 5ebugging. If you see a !ard example in the Jong "or Extended$ 344ode listings that is coming out at a certain location where you need 34 code

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    18/22

    output& then you can add that Example to your post .(S4 file and be confident thatit will always be called in that same relative location. If you see some Soft examplesin the Jong "or Extended$ 34 4ode listings that you did not expect to see& then you)now that certain technology settings are causing those examples to be output. Youcan then try changing those settings or even removing those example )eywordsfrom your post .(S4 file altogether to see what examples are called and what 34

    code output they produce instead.

    10. (eneral topics

    a. O*er$ritin' diensions

    In overwriting formatable values the distinction between formatable dimensions andformatable miscellaneous is very important. It can be summed up li)e so2

    0ormatable %iscellaneous values can always be overwritten. 1verwriting 0ormatable 5imension values can give unpredictable output in

    the 34 code and is strongly recommended against.Lalues that come from the graphics are called 5imensions& while the name%iscellaneous is used for values that typically come from the technology pages. 0orexample& >(bsoluteis considered a formatable dimension whileTool3umberisconsidered a formatable miscellaneous.

    Probably the best example of this is in posts for multi;axis mills. 6hen rotating tableaxes& it is usually desired to send the tool to a safe home position. This is oftenaccomplished with -7+ -'= >* Y* ?* in the 34 code. 1ne way you could try to getthis output may be with -7+Q -'=Q >"*$ Y"*$ ?"*$. The "*$ says to overwrite theformatable value with ,ero& but the -7+Q forces the code into incremental mode. Soinstead of getting a move of ,ero& you get the incremental move necessary to ta)eyou bac) to the ,ero position. If the tool was at > to begin with& instead of >*

    output in the 34 code& the output would be >;.(nother example of this is trying to apply a scale factor. %aybe you have a user;defined variable called scale that is set via one of the custom page settings.Suppose your I and A values on arcs or H and L values on 8 (xis are measuredincrementally from > and Y. 6ell& if you overwrite the > and Y values directly& thenyou also change the reference for these incremental calculations. So if you ust tryto apply the same scale to the I and A or H and L values& then the numbers will comeout wrong.

    The solution in all cases is to define a %isc0ormatC )eyword& such as %isc0ormat+&and overwrite the symbol for that %isc0ormatC. 6hile you do not overwrite theformatable dimension& you still need to update it as if it had been output. This is

    done with 341utput1ffand 341utput1n. So in general& ta)e the approach shown inthe example below2

    A(7olute : N ) Y N ) N / Y N 0 1 1 N " "

    YA(7olute : Y N ) Y N ) N / Y N 0 1 1 N " "

    M67c%ormat1 : N ) Y N ) N / Y N 0 1 1 N " "

    M67c%ormat : Y N ) Y N ) N / Y N 0 1 1 N " "

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    19/22

    Mot6onRa?6d : -""

    e!6ne &ut +oerwr6te e#?re776on. NC&ut?ut&!! NC&ut?ut&n Ende!6ne

    e!6ne Y&ut Y+oerwr6te e#?re776on. NC&ut?ut&!! Y NC&ut?ut&n Ende!6ne

    e#Ra?6d : -"" &ut Y&ut

    If you always ma)e it a rule to only overwrite formatable miscellaneous codes andnever overwrite formatable dimensions& you will save yourself a lot of headaches.

    +. 3e+u''in'

    6hen writing your post processor& you will often have to debug the value of yourdefined variables to ma)e sure that your logic or your mathematical expression iscorrect.

    9efore ESPRIT '*+*& you probably used a formatable code to do that2

    M67c%ormat1 : e(u N ) Y N ) N / Y N 0 < 1 N " 8

    Var6a(le : Te7t

    e#Ra?6d : e(u*+Te7t.

    This way is not the best way to do it because the output of the value of yourvariable is subect to the formatting of the 5E9H- formatable. 0or instance& if youare wor)ing in metric& only three digits will be output and so your variable will berounded.

    To debug in ESPRIT& you should use OutputStrin'

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    20/22

    # -reater than

    Jess than

    Eual to

    #

    3ot eual

    # -reater than oreual to

    Jess than or eualto

    1r

    UU

    (nd

    d. Mat"eatical operators and functions

    The following mathematical operators can be used in the post processor "These are

    given in order of precedence$2

    " $

    Parenthesis "by default$& or whatever is defined asthe StartExp and EndExp& are used to group parts ofan expression. 6hatever is inside has the highestprecedence& and is evaluated first.

    ;

    3egation. 3umbers which are to be negated shouldbe enclosed in parenthesis& as in ";'$. Lariables andexpressions which are to be negated should bemultiplied by ";+$& as in ";+$Q"expression$.

    Q %ultiplication

    V 5ivision "same precedence as multiplication$W %odulus& which returns the remainder after division

    O (ddition

    ; Subtraction "same precedence as addition$

    9esides mathematical operators there are also mathematical 0unctions2

    (9S

    (9S is a function that returns the absolute value ofan argument. If the value is positive& the absolutevalue is the same. If the value is negative& it is

    negated so as to be a positive value of the samemagnitude.

    (4S(4S is a function that returns the arccosine value.(4S is the angle "in degrees$ that has a cosine valueeual to the given argument.

    (S3(S3 is a function that returns the arcsine value. (S3is the angle "in degrees$ that has a sine value eualto the given argument.

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    21/22

    (T3(T3 is a function that returns the arctangent value.(T3 is the angle "in degrees$ that has a tangentvalue eual to the given argument.

    41S 41S is a function that returns the cosine of a givenangle. The angle value is given in degrees.

    E>P

    E>P is a function that raises the natural logarithm "e$to the power of the argument. In other words& E>P"x$euals eXx. e is a transcendental constant "li)e pi$and has a value off approximately '.K+='=.

    I3T

    I3T is a function that returns the next lowest integervalue for a given argument.

    0or positive numbers& this is the number with thedecimal portion removed. 0or 3egative numberswith a decimal portion& it is one less than thenumber with that decimal portion removed. 0or

    example& I3T"/.+8$ / while I3T";/.+8$ ";8$.

    J3

    J3 is a function that returns the natural logarithmvalue. The natural logarithm is the power to whichthe constant e must be raised to eual the givenvalue. eXJ3"x$ x. e is a transcendental constant"li)e pi$ and has a value off approximately '.K+='=.

    SI3 SI3 is a function that returns the sine of a givenangle. The angle value is given in degrees.

    S

  • 8/12/2019 80001694 an Introduction to ESPRIT Post Processor

    22/22

    Elseis a special )eyword that separates the true and false branches of an Ifcondition.

    ElseIfis a special )eyword that separates and branches the 34 code outputdepending on a test condition.

    EndIfis a special )eyword that closes an If conditional branch.

    6hile End6hile2

    !"ileis a special )eyword that starts a loop. The loop will continue toexecute as long as a given test condition is true.

    End!"ileis a special )eyword that closes a 6hile loop.