Introduction to the ESPRIT post processor



Comments



Description

Introduction to ESPRIT Post ProcessorThis guide is an introduction to the ESPRIT Post Processor. You will be given tips that will help you write your own post processor or modify an existing one. Please always refer to the ESPRIT Post Help (in ESPRIT go to Help > Post Help). Most of the points mentioned in this guide are explained in detail there. You Will Learn... • Basic facts about post processors • How to download and set up the UltraEdit text editor • System Variables • Machine Modes • Formatable Codes • Symbolic Codes • Variables • Subroutines • Examples section • Overwriting dimensions • Debugging • Logical operators • Mathematical operators and functions • Special keywords to add loops in the program A few basics Every CAM user should know a few basic facts about post processors. Programming a part in a CAM system is one thing. Getting programs out of the CAM system and into a format the CNC machine can use to cut parts is another. That’s the job of the post processor. ESPRIT provides the fundamental architecture to support the capabilities of the machine. This architecture generates CL File (cutter location file) data that describes the machining operation in absolute terms. The CL file represents the cutter path for machining your part. It does not reflect the specific CNC machine tool and control capabilities of the machine you will actually use to cut the part. A post processor (*.asc) file converts CL File data to the specific format of the NC program for a particular machine. A post processor can do many things besides simply translating CL File data to NC machine codes. A post processor can also be responsible for outputting the most efficient and productive NC code possible. In cases where the author of a post processor does not want anyone to modify the source code, they will provide a compiled .pst file instead of an editable .asc file. The content of a .pst files cannot be viewed or edited. dptechnology.com   1 Below is an illustration of the post processor work flow in ESPRIT. INTRODUCTiON TO ESPRIT POsT PROCessOR The information contained in a .asc file is divided into sections. Each section defines a specific type of information for the post. • Header: Information about the post, such as the name of the machine, the machine configuration, the author, the date the file was written, and so on. This information is not output in the NC code. • System Variables: Default values for the post, such as the output of sequence numbers or the type of machining operation being performed • Machine Modes: Default values for the machine, such as the default angle output range and format for a rotary axis • Formatable Codes: Codes that get values from the operation technology in ESPRIT, such as the tool number or spindle speed • Symbolic Codes: Codes that are output “as is” in the NC output, such as G00 and G01 • Examples: Examples of the NC code that is output, such as the code for a tool change or the code for a rapid move Sample .asc file for illustration purposes only: ############################## ## Machine: 2-Axis Lathe ## Controller: ## Author: ## Date: ## ESPRIT Version: 2012 ## Company: ## Comments: ## Modified Date: ############################## ******* System Variables ******* PostName : Lathe.asc dptechnology.com  2 1 N 0 0 1 N 0 0 1 N 0 0 1 N 0 0 ..1 N 0 0 1 N 0 0 XCenterAbsolute ZCenterAbsolute SequenceNumber StartSequenceNumber EndSequenceNumber ******* Symbolic Codes ******* MotionRapid MotionCW Dwell Inch : G00 : G01 : G02 : G03 : G04 : G20 : G21 MotionLinear MotionCCW Metric ******* Examples ******* ex_MainStart : O* : TimeStamp : MachineSetupComment ex_MachineSetup : N CoordinateCode* MeasurementCode* : ToolChangeComment ex_FirstToolChange : N G00* X*(XTC) Z*(ZTC) : N T*(101 * PresentTool) dptechnology.com  3 .INTRODUCTiON TO ESPRIT POsT PROCessOR MachineTolerance MaxCircleRadius MaxNCode NCodeDefault : 0...00001 : 9999 : 9999 : 100 : 10 NCodeIncrement ******* Machine Modes ******* CoordinateMode CircleMode CenterMode : Absolute : By180 : IncrementFromStart : Metric : Diametral MeasurementMode RadialValueMode ******* Formatable Codes ******* ProgramNumber XAbsolute ZAbsolute : O : X : Z : I : K : N : P : Q Y 4 N N 0 N 2 Y N 5 N 2 Y N 5 N 4 Y N 4 N 4 Y N 4 Y 4 N N 0 N 3 N N 0 N 3 N N 0 Y 4 N N 0 N 3 Y N 4 N 3 Y N 4 N 5 Y N 3 N 5 Y N 3 Y 4 N N 0 N 3 N N 0 N 3 N N 0 0 1 1 1 1 0 0 0 .. 6.ultraedit. UltraEdit is useful for editing posts because the syntax highlighting lets you visually sort your code by highlighting related parts of the source code as different colors.com A free trial version of UltraEdit is available here: http://www.uew is located. UltraEdit reads . and an advanced PHP. 3. HTML and XML editor.uew to a directory on your computer (ESPRITWeb login required). dptechnology.uew files from the directory you specify to configure the syntax highlighting.uew file each time the editor starts up. 8. Perl. expand Editor Display and select Syntax Highlighting.ultraedit. Click Apply.html A configuration file is provided with this lesson. 1. called ESPRIT. Set up UltraEdit to read the ESPRIT. Information about UltraEdit is available here: http://www. even Notepad.uew file will be used. the syntax highlighting from the ESPRIT. Java and JavaScript editor for programmers. to make it easier for you to visualize your code. 2. Click OK to close the dialog.INTRODUCTiON TO ESPRIT POsT PROCessOR ex_OtherToolChange : ToolChangeComment : N G00* X*(XTC) Z*(ZTC) : N T*(101 * PresentTool) ex_LastToolChange : ToolChangeComment : N G00* X*(XTC) Z*(ZTC) : N T*(101 * PresentTool) ex_ToolCancel ex_CycleStart : N G00* G28* G40* G49* G80* M05* M09* : Comment : N SpindleUnit S S_ SpindleDirection SpindleRange CoolantCode Tex t editors for post processor files Posts can be edited in the ESPRIT NC Editor or any other text editor.com  4 . Click the browse button next to the directory path and navigate to the directory where the file ESPRIT. Run UltraEdit. 4. 7. Click Advanced > Configuration. An inexpensive editor that works well for post processors is UltraEdit. 5.com/downloads/ultraedit_download. In the dialog. a multi-purpose text. Download the configuration file ESPRIT.uew. Every time you open a file with UltraEdit. Perhaps the most important system variable is MachineTolerance. some machines cannot have spaces in the NC code. It should be set to the resolution of the NC machine. Note that with the settings below. The system variable called RemoveSpaces provides this function.. N will start at N1 (First N value output in the code will be: NCodeDefault 0 plus NCodeIncrement 1) and will reach at the most N9999.- dptechnology. Some system variables have a more advanced use in the Examples section of the post.System Variables System variables serve two purposes: • They allow certain default values to be set • Other variables can be used to call special features The structure used in the system variables section is: ****** SYSTEM VARIABLES ****** Keyword : Value INTRODUCTiON TO ESPRIT POsT PROCessOR Commonly used variables Two system variables that are commonly used are NCodeDefault and NCodeIncrement.CANNED CYCLE) N2 (T1515 GROOVING INSERT FACE 3V) N3 G28 U0 N5 G54 N4 G28 V0 W0 : N N 4 N N 0 N 4 N N 0 0 . Any move that is less than the MachineTolerance value will be eliminated from the NC code output. NCodeDefault is the sequence number to start the program and NCodeIncrement is how much the sequence number increases on each line. Example: Change N-code increment If the system variable NCodeIncrement is set to 1 in your post processor. Other system variables allow the user to call up special functions or conditions. In that case.00001 in the post.com  5 . ****** SYSTEM VARIABLES ****** NCodeIncrement NCodeDefault MaxNCode : 1 : 0 : 9999 ****** FORMATABLE CODES ****** SequenceNumber Sample NC code: N1 (SPINDLE-1 GROOVING FACE . Less is More With system variables. the current sequence number will incremented by 1. whenever SequenceNumber N will be called. system variables and functions can be used to determine certain values from ESPRIT. then set MachineTolerance to 0. If the NC machine can make moves out to the fifth decimal place. For example.. the rule is: do not add variables unless you need to set a value other than default. then By360 can be set for CircleMode. these two machine modes are ignored. the default for MeasurementMode can be Inch or Metric. any arc up to a full circle can be output as one line of NC code.CANNED CYCLE) N10 (T1515 GROOVING INSERT FACE 3V) N15 G28 U0 N25 G54 N20 G28 V0 W0 N30 G00 T1515 Machine Modes Machine modes serve two purposes: • To set certain default machine values in case they are not set in the ESPRIT program • To give important machine requirements that are not found within any of the technology in ESPRIT The structure used in the machine modes section is: ****** MACHINE MODES ****** Keyword : Value Review of common modes Below is an example of typical machine modes: ****** MACHINE MODES ****** CoordinateMode CircleMode CenterMode : Absolute : Metric : By360 MeasurementMode WorkPlaneMode : IncrementFromStart : XYPlane For example. then use ByQuadrant. If the machine can cut a 360-degree arc in one block of code. If these values have already been programmed in ESPRIT. CoordinateMode can be Incremental but is almost always set to Absolute. if you change NCodeIncrement to 5. If the machine can cut up to 90 degrees in one block and must break down circles larger than 90.com  6 . To specify the capabilities of the machine. CircleMode specifies how much of a circle the NC machine can cut in one block of NC code. ****** MACHINE MODES ****** CircleMode : By360 dptechnology. your NC code will be: N5 (SPINDLE-1 GROOVING FACE . Example: Change CircleMode If the machine mode CircleMode is set to By360 in your post processor.INTRODUCTiON TO ESPRIT POsT PROCessOR N6 G00 T1515 Now. com  7 . and F for feedrate are all formatable codes. Y. The structure of the formatable codes section is unique in that it has several columns of information. such as the tool number and X.921 R16.479 R16. trailing digits. and Z coordinates.998 Z-75. a decimal point. The symbol for XAbsolute is usually X. Below is an example of formatable codes being used in the “Examples” section.371 Y15. # +/-* Inch Output Metric Output L # . Formatable codes must be defined in the formatable codes section before they can be used in other sections of the post file. and Z coordinates.87 Y-15. if you change CircleMode to By180 (arcs which are greater than 180 degrees will be broken up into multiple lines of NC code). your NC code will be: G03 X56. Keyword : Symbol I1 I2 I3 I4 I5 M1 M2 M3 M4 M5 S Z1 Z2 Z3 Z4 The columns to the right of the Symbol define the numeric field for the value that is output.371 Y15.998 Z-75.. A post may have the following in its formatable codes section: ************************** * * FORMATABLE CODES L # . XAbsolute returns the value of the X coordinate in ESPRIT. Numeric values can be output with or without leading digits. S for spindle speed. ex_Circle ex_OtherToolChange : N G17 CircleDirection* X Y I* J* F : ToolChangeComment : N T M06 ex_Rapid ex_Linear : N G00 X Y Z : N G01 X Y Z F dptechnology.Sample NC code: G03 X58. T # ************************************************************************ XAbsolute : X : T N 4 Y N 4 Y 2 N N 0 Y 2 N N 0 N 5 Y N 3 Y 2 N N 0 Y 2 N N 0 1 0 0 1 N 0 0 . The X. the I and J circle center coordinates.1 N 0 0 ToolNumber DiameterCompensation : D The keyword returns a value from ESPRIT. or a positive or negative sign. T # ************************** +/Zero Value* L .921 R16. The last set of columns (Z1-Z4) give the format for when the value is zero. the T for the tool number.0 INTRODUCTiON TO ESPRIT POsT PROCessOR Formatable Codes Formatable codes are used to return values from the operation technology in ESPRIT.998 Z-76.0 Now. For example. Y.0 X58.. • You can also pad symbolic codes (discussed in the next section).]*(2) will be output like this (with above format): Z[#500+2. you can use the padding technique (use of “_” symbol): EndSequenceNumber MiscFormat5 Peck : Q N 4 N N 0 N 3 N Y 4 N 3 N Y 4 N 4 N N 0 N 5 N Y 3 N 3 N Y 3 0 0 0 .1 N 0 0 : Q_ : Q__ When using the above formatable codes in your post. Its only use is as a user-defined formatable that is always overwritten. etc. similar to MiscFormat1. Y 4 N N 0: The first Y will fill the leading digits with zeros. N to not fill trailing digits with zeros. MiscMCode and MiscGCode formatable codes can be used for miscellaneous M and G codes.. Z[#500+. N to make sure to not output a decimal point.]*(Value that needs to be output). 4 sets which digits will be filled (4 first digits). MiscMCode and MiscGCode do not correspond to any value in ESPRIT.. This can be very useful when working with variables on your machine. You can add as many underscores as you need since all of the underscores will be stripped. For example.. Here is an example: MiscFormat1 : Z[#500+. To achieve this. 0 trailing digits would be filled.. The “_” will be ignored. Notes: • The amount of padding is not limited.0].] 1 3 Y 1 4 1 5 Y 1 3 1 1 Y 1 0 You can then use in the post examples Z[#500+. you can insert symbols and numbers in the middle of formatable codes. 0: Sign output is set to 0 so that the program number will always output with no sign.. The same settings are applied for inch and metric output.. All these values use a different format and so need to be defined with different formatable properties in your post. to specify the peck increment for drilling canned cycles. only Q and its value will be output.. This is how you can define multiple formatable codes that need to be output using the same symbol but with different formatting. MiscMCode. Double dot format for inserting symbols and numbers in the middle of formatable codes Using the double dot format. For example. a symbol can be used for multiple different cycles. ProgramNumber can be set this way: ProgramNumber : O Y 4 N N 0 Y 4 N N 0 0 .. the first four digits need to be filled with a value.com  8 . “CoolantFlood: M8_M28” will output both M codes on one line with a space between them. to specify the depth of cut or the step over for a grooving canned cycle.. MiscGCode Only twenty custom symbolic codes can be defined using MiscSymbolicCode# (see the next section on Symbolic Codes). Q can be used to define the end sequence number for a turning canned cycle. dptechnology.Examples of common formats When outputting program numbers (O0001(SAMPLE 1)). etc. To be able to do that. A good alternative to avoid using up all of them is to use MiscMCode and MiscGCode.. For example. Padding: Use of underscores In the NC code.- INTRODUCTiON TO ESPRIT POsT PROCessOR O: Symbol that will be output in NC code. The structure used in the symbolic codes section is: Keyword : Symbol A post may have the following in its symbolic codes section: ****** SYMBOLIC CODES ****** dptechnology.com  9 .- Sample NC code (with above format properties): (SPINDLE-1 GROOVING FACE .CANNED CYCLE) N2 (T1515 GROOVING INSERT FACE 3V) N3 G28 U0 N5 G54 N4 G28 V0 W0 N6 G00 T1515 Now..- Symbolic Codes A symbolic code is generated in the NC file exactly as it is shown in the post .- INTRODUCTiON TO ESPRIT POsT PROCessOR Sample NC code (with above format properties): N1 (SPINDLE-1 GROOVING FACE .. remove N numbers If Sign Output (fourth column) of a formatable code is set to (-1).-...asc file. if you change the format properties as follow. In this example. for example. This can be achieved using the Zero Format properties of the formatable codes section.. the sign output is set to 0 so that the N-codes will output with no sign. This is.... set the Zero Format to . To omit the output of zero values. a very useful way to turn off the output of N-codes in the NC code. ****** FORMATABLE CODES ****** SequenceNumber : N N 4 N N 0 N 4 N N 0 0 . the output of the symbol and value will be suppressed. Here is an example for the dwell time: DwellTime : G04_U 1 3 Y 1 4 1 3 Y 1 4 0 . the N-codes will not be output anymore: ****** FORMATABLE CODES ****** SequenceNumber : N N 4 N N 0 N 4 N N 0 -1 .Sign output set to (-1) to omit code.CANNED CYCLE) (T1515 GROOVING INSERT FACE 3V) G28 U0 G54 G28 V0 W0 G00 T1515 Zero format Some values (like the dwell time) should not be output in the NC code if their value is set to 0 in ESPRIT. com   10 . M09. CoolantFlood2 etc. The symbolic switch CircleDirection specifically switches between the symbols assigned to the keywords MotionCW and MotionCCW. depending on the coolant setting chosen for a particular tool. the post would not work because all arcs would be output with the same direction code. CompensationSide. either G02 or G03. often found in ex_Compensation. CoolantMist. CoolantOn. and M02 have already been defined in the symbolic codes section. but there are many other symbolic switches that switch between three or more symbolic codes.INTRODUCTiON TO ESPRIT POsT PROCessOR MotionRapid XYPlane MotionLinear EndProgram SpindleOff ToolChange CoolantOff : G00 : G01 : G17 : M02 : M05 : M06 : M09 Symbolic codes must be defined in the symbolic codes section before they can be used in other sections of the . By using the CircleDirection symbolic switch instead. G01. CompensationLeft. M05. Symbolic switches A symbolic switch is a keyword that switches output to one of several symbolic codes depending upon certain conditions. Below is an example of symbolic codes being used in the “Examples” section. will switch between CompensationOff. This symbolic switch switches between just two symbolic codes. the symbolic code defined for MotionCW or MotionCCW will be output depending on the arc direction. CircleDirection typically would have the following: MotionCW : G02 MotionCCW : G03 Here is an example: ex_Circle : N G17 CircleDirection* X Y I* J* F If G02 or G03 were used directly in ex_Circle instead of the switch. dptechnology. the symbolic codes output using a symbolic switch must be defined in the symbolic codes section. and CompensationRight which are typically G40. As with other symbolic codes. CoolantFlood. CoolantCode will switch between CoolantOff.asc file. ex_Rapid : N G00 X Y Z : N M05 M09 : N M02 ex_Linear ex_ToolCancel ex_MainEnd : N G01 X Y Z F The symbolic codes for G00. G41 and G42. then a G92 with X.MiscSymbolicCode# MiscSymbolicCode# (with # equal to an index number from 1 to 20) corresponds to a user defined miscellaneous code. such as the built-in system variables and functions. variable names cannot start with a number. arrays of values. But if a Set Origin is not created. Y.asc file it is possible to declare variables for your own use. Here is an example: ****** FORMATABLE CODES ****** ProgramNumber : O Y 4 N N 0 Y 4 N N 0 0 1 N 0 0 INTRODUCTiON TO ESPRIT POsT PROCessOR ****** SYMBOLIC CODES ****** MiscSymbolicCode1 ex_MachineSetup : G10 : O* : G10 : MachineSetupComment Instead of assigning codes to MiscSymbolicCode# keywords. and Z of the approach (entry) point of the first operation needs to be output. Initially the flag variable is cleared. so Milling5Axis is valid. Variables Variables let you store single values. Here a variable can be used to determine whether a Set Origin has been created. the variable will be set so as to prevent any additional G92 output: MiscFormat1 MiscFormat2 : X_ : Y_ N 4 Y N 4 N 4 Y N 4 N 5 Y N 3 N 5 Y N 3 1 1 1 N 0 0 1 N 0 0 dptechnology. It can be used as part of a mathematical expression to overwrite formatable values. the output is to be G92 with the X. For instance ProgNumber cannot be used as a variable because it is already defined as a system variable in the post processor language. Also. Nearly any name can be used for a variable provided that there isn’t already a system variable defined with the same name. and Z Start Positions from the Set Origin page. or it can be used as part of logical condition testing. Suppose that if a Set Origin operation is created in EDM. it can be used like any other variable. but as soon as the G92 is output. Y. The variable can be assigned a value in any ex_ example by using the following format: : VariableName=(expression) Once the variable is declared. The variable acts like a flag. In the post . or create switches.com   11 . but 5AxisMilling is not. strings can be hardcoded into ex_ examples by enclosing them in double quotes. See StringCharacter in ESPRIT Post Help for more details. The format for doing this is: Variable : VariableName1 VariableName2 VariableName3 Multiple variables can be defined on one line. com   12 .. The example ex_CycleDefinition is called for each operation at the beginning of the NC code.upper_index). You can also manually find CL codes in ESPRIT by right-clicking on a parameter in a technology page and selecting Edit Properties. for sync purposes. Repeated code like this can instead be defined as a subroutine.. all of the spindle speeds and feed rates had to be known prior to changing to the tool used for those operations. The index numbers for CL codes can be found in the Appendix of the ESPRIT Post Help. one of the locations could easily be missed. Single-line subroutines Some subroutines may be just part of a single line. The format for these subroutines is: Define subroutine_name [code] EndDefine dptechnology. Then if a change needs to be made.999) fpr(1.999) opcount : opcount=(0) : opcount=(opcount+1) : css(opcount)=(nextclfile(418)) : fpr(opcount)=(nextclfile(416)) The examples above demonstrate numeric variables. If a change has to be made to this code. For example.INTRODUCTiON TO ESPRIT POsT PROCessOR MiscFormat3 SetOrigin Variable ex_StartCode ex_SetOrigin : Z_ : G92 : seto N 4 Y N 4 N 5 Y N 3 1 1 N 0 0 : seto=(0) : G92 X_*(xstart) Y_*(ystart) Z_*(zstart) : seto=(1) ex_CycleStart : If (seto=0) : : seto=(1) G92 X_*(xnext) Y_*(ynext) Z_*(znext) : EndIf An array variable can be declared with the format array_name(lower_index. and there is a set of string functions for dealing with strings and string variables.. CL code 418 returns the spindle speed and CL code 416 returns the feed rate from the ESPRIT operation. In this example all of the feed and speed values could be recorded into an array for later use. it only has to be done in one location. The CL code is displayed in parentheses at the top of the dialog. Subrout ines There are a lot of examples where certain portions of the code may be repeated over and over again. The following would do just that: Variable ex_StartCode ex_CycleDefinition : css(1. User-defined variables may also contain strings. Suppose there was a 4-axis lathe post where. : [code] EndDefine Where. not when defining it. maybe all of the drilling canned cycles in a post are canceled with N G00 G80 M09. To call the subroutine. A typical mill post may contain the following: ex_FirstToolChange : T M06 : ToolChangeComment : T(secondtool) ex_OtherToolChange : T M06 : ToolChangeComment : T(nexttool) ex_LastToolChange : T M06 : ToolChangeComment : T*(firsttool) This could be rewritten with a subroutine as: Define tc : T M06 : ToolChangeComment dptechnology.com   13 . The $ is only used before the name when calling it in the examples. a single line subroutine could be made like so: Define cannedcancel N G00 G80 M09 EndDefine The cancel examples would then call this subroutine like this: ex_DrillCancel ex_PeckCancel ex_TapCancel ex_BoreCancel : $cannedcancel : $cannedcancel : $cannedcancel : $cannedcancel Multi-line subroutines Other subroutines may encompass several lines of NC code. Instead of putting this into all of the cancel examples and risking having to change it several places later. As one example. there can be as many lines of code as necessary..INTRODUCTiON TO ESPRIT POsT PROCessOR The keywords Define and EndDefine are used to create the subroutine.. a $subroutine_name is inserted into the appropriate examples. between the Define and EndDefine. The format for them is: Define subroutine_name : [code] : . com   14 . Notes: • Make sure to always end a subroutine with EndDefine • Subroutines must always be defined above all call locations • In the samples above. a subroutine can be called from another subroutine or as the argument for an If statement. If you include them in both places. A typical arc move may look like this: ex_Circle : N G17 CircleDirection* X Y I* J* F Other examples may generate several lines of NC code like this tool change example: ex_OtherToolChange : ToolChangeComment : N T M06 Each line after ex_ keyword that starts with a colon makes a line in the NC file. E xamples sect ion The Examples section is the heart of the post because it gives examples of what the output NC code is supposed to look like. Any line in an ex_ example can be broken up into multiple lines in the . The structure used in the Examples section is: ex_Keyword : NC Code Format The format of the NC code is given to the right of the colon(s).asc file. It is possible to make subroutine calls in other sections of the post . with a multiple line subroutine. There are several different types of codes used to give the NC format. the colons are embedded between the subroutine keywords Define and EndDefine. The example keywords all start with ex_. This is done by using \\ line continuation in the .asc but still only produce one line of code in the NC file. Everything that is programmed in ESPRIT has a corresponding ex_ keyword in the post.INTRODUCTiON TO ESPRIT POsT PROCessOR EndDefine ex_FirstToolChange $tc : T(secondtool) $tc ex_OtherToolChange : T(nexttool) $tc ex_LastToolChange : T*(firsttool) Notice how there is no colon (:) between the ex_ keyword and the $ for the subroutine call. you will get a compilation error. For example. This is because. Three of the most important types seen in the Examples section are. the subroutine calls were all made within the Examples section.asc: dptechnology. as seen above: • Symbolic codes • Symbolic switches • Formatable codes Some examples produce a single line of NC code. Sample: dptechnology.INTRODUCTiON TO ESPRIT POsT PROCessOR ex_CycleStart : Comment : SpindleUnit If (spindlespeed<500) S(1) Else \\ S(2) Else S(3) EndIf EndIf SpindleDirection If ((spindlespeed>=500) && (spindlespeed<1250)) \\ Important notes: • Each ex_ example in your post processor file must have a colon (:) on its first line • Each example can only be defined once: each example can only have one instance in the post processor Review of example flow order To work on a post processor. This way.. it is necessary to know the ex_ examples workflow.” keywords from the .. go to File > Advanced NC code … or push on Ctrl + F9 on your keyboard: The Advanced NC Code Output window will be displayed. the proper logic can be implemented in each example of your post processor.com   15 . Select “Long”to display the long NC code when you post. Long NC code shows the “ex_. The best way to review this flow order is to post the long NC code: in ESPRIT. This way. you can see the posting flow order.asc file before the line(s) of NC code that keyword produced. ex_Tap2Start and ex_Tap2Body are soft examples.com   16 . Soft As you can see in the sample above. there are Soft and Hard examples.BORE) (T1414 EM 05.asc file. In both cases.0 G89 X34. • A Hard example is always called.644 583 Soft ex_BoreStart(DrillWrap) 584 Soft ex_BoreBody(DrillWrap) 585 Soft ex_BoreBody(DrillWrap) 586 Soft ex_BoreBody(DrillWrap) 588 Hard ex_CycleEnd(DrillWrap) 589 Hard ex_ToolCancel 587 Soft ex_BoreCancel(DrillWrap) X42. If Canned Cycle was Yes and Cycle Type was just Tap. then the soft examples ex_TapStart and ex_TapBody would be called instead.4 R0.0 G30 U0 M05 M69 M46 G30 V0 W0 Hard vs.0 C0. the example that is called can depend on what other examples are defined (or not defined) in the post . ex_MainStart is a hard example because it always comes at the start of the main program. however.0 G80 M09 C90. If Canned Cycle was No.1 Y0.INTRODUCTiON TO ESPRIT POsT PROCessOR 575 Hard ex_OtherToolChange N45 (SPINDLE-1 WRAP DRILLING OD Y0 . the motion would be broken down into all of the ex_Rapid and ex_Linear moves necessary to perform the tapping on each hole. because they are only used if Canned Cycle is Yes and the Cycle Type is set to Tap 2 on the drilling technology dialog.0 F150. then instead of those examples. dptechnology.0 G00 Z-19.0 M08 C-90.0 L) G30 U0 G54 G30 V0 W0 G00 T1414 576 Hard ex_ConstantSurface 577 Hard ex_SetWorkCoor 578 Hard ex_CycleStart(DrillWrap) M69 G98 G19 M45 579 Hard ex_ChangeWorkSystem(DrillWrap) 580 Soft ex_Rapid(DrillWrap) 581 Soft ex_Rapid(DrillWrap) G97 S3000 M13 582 Hard ex_StartPoint(DrillWrap) G00 C-180. Likewise ex_MainEnd and ex_EndCode are hard examples. ex_Rapid and ex_Linear are themselves Soft examples. regardless of any technology or other settings • Soft examples are only called based on certain conditions ex_StartCode is a hard example because it always comes at the start of the NC Code output. asc file and be confident that it will always be called in that same relative location. Well. XAbsolute is considered a formatable dimension while ToolNumber is considered a formatable miscellaneous. Probably the best example of this is in posts for multi-axis mills. while the name Miscellaneous is used for values that typically come from the technology pages. INTRODUCTiON TO ESPRIT POsT PROCessOR Over writ ing Dimensions In overwriting formatable values. Another example of this is trying to apply a scale factor. the output would be X-5. You can then try changing those settings or even removing those example keywords from your post . Suppose your I and J values on arcs or U and V values on 4 axis are measured incrementally from X and Y.asc file either. This is often accomplished with G91 G28 X0 Y0 Z0 in the NC code.asc file. if you overwrite the X and Y values directly. then you can add that Example to your post . So if you just try to apply the same scale to the I and J or U and V values. unless it is a drilling type operation and ex_PTOPCycleStart is defined in the post . such as MiscFormat1. instead of X0 output in the NC code. then it will be used for the start of drilling type operations instead of ex_CycleStart. then ex_TapStart and ex_TapBody would be used instead. When rotating table axes. One way you could try to get this output may be with G91* G28* X(0) Y(0) Z(0). So in general. If those examples were not defined in the post . you get the incremental move necessary to take you back to the zero position.asc file. So instead of getting a move of zero. It can be summed up like so: • Formatable Miscellaneous values can always be overwritten • Overwriting Formatable Dimension values can give unpredictable output in the NC code and is strongly recommended against Values that come from the graphics are called Dimensions. Maybe you have a user-defined variable called scale that is set via one of the custom page settings. The solution in all cases is to define a MiscFormat# keyword. you still need to update it as if it had been output. While you do not overwrite the formatable dimension. and it always appears at the start of an operation.com N 4 Y N 4 N 4 Y N 4 N 4 Y N 4 N 4 Y N 4 N 5 Y N 3 N 5 Y N 3 N 5 Y N 3 N 5 Y N 3 1 1 1 1 1 N 0 0 1 N 0 0 1 N 0 0 1 N 0 0   17 . then you also change the reference for these incremental calculations.asc file altogether to see what examples are called and what NC code output they produce instead. but the post . then it would resort to breaking the motion up into ex_Rapid and ex_Linear moves. If ex_PTOPCycleStart is defined in the post .asc file did not contain the ex_Tap2Start and ex_Tap2Body examples. then the numbers will come out wrong. and overwrite the symbol for that MiscFormat#. If you see some Soft examples in the Long (or Extended) NC Code listings that you did not expect to see. If you see a Hard example in the Long (or Extended) NC Code listings that is coming out at a certain location where you need NC code output. but the G91* forces the code into incremental mode.ex_CycleStart is a Hard example. the distinction between formatable dimensions and formatable miscellaneous is very important. This is done with NCOutputOff and NCOutputOn. The (0) says to overwrite the formatable value with zero. If the tool was at X5 to begin with. For example. Knowing this difference and what the terms Hard and Soft mean can be somewhat useful when Debugging. take the approach shown in the example below: XAbsolute YAbsolute MiscFormat1 MiscFormat2 MotionRapid : X : Y : X_ : Y_ : G00 dptechnology. then you know that certain technology settings are causing those examples to be output. it is usually desired to send the tool to a safe home position. If Canned Cycle was Yes and Cycle Type was Tap 2 on a drilling technology dialog. Debugging When writing your post processor. To debug in ESPRIT.INTRODUCTiON TO ESPRIT POsT PROCessOR Define XOut X_(overwrite expression) NCOutputOff X NCOutputOn EndDefine Define YOut Y_(overwrite expression) NCOutputOff Y NCOutputOn EndDefine ex_Rapid : G00 $XOut $YOut If you always make it a rule to only overwrite formatable miscellaneous codes and never overwrite formatable dimensions. you probably used a formatable code to do that: MiscFormat1 Variable : Test ex_Rapid : Debug*(Test) : Debug N 4 Y N 4 N 5 Y N 3 7 1 N 0 6 This way is not the best way to do it because the output of the value of your variable is subject to the formatting of the DEBUG formatable. only three digits will be output and so your variable will be rounded. For instance. With this function. It was added as part of the string variable support in ESPRIT 2010. you will often have to debug the value of your defined variables to make sure that your logic or your mathematical expression is correct. you will save yourself a lot of headaches. if you are working in metric. The example above would become: Variable : Test ex_Rapid : OutputString(“Test=” + Test) dptechnology.com   18 . you can easily output a variable to the standard listing (without overwriting a formatable and thus limiting the number of places after the decimal shown). you should use OutputString(). Before ESPRIT 2010. For positive numbers. Whatever is inside has the highest precedence. ACS is the angle (in degrees) that has a cosine value equal to the given argument. it is negated so as to be a positive value of the same magnitude. Multiplication Division (same precedence as multiplication) Modulus. Negation. If the value is positive. In other words. e is a transcendental constant (like pi) and has a value off approximately 2. it is one less than the number with that decimal portion removed.14) = (-4).Logical operators The following logical operators can be used in the post processor: > < = <> >= <= || && Greater than Less than Equal to Not equal Greater than or equal to Less than or equal to Or And INTRODUCTiON TO ESPRIT POsT PROCessOR Mathematical operators and functions The following mathematical operators can be used in the post processor (given in order of precedence): () * / % + Parenthesis (by default). are used to group parts of an expression. EXP(x) equals e^x. For example. e^LN(x) = x.71828. or whatever is defined as the StartExp and EndExp. the absolute value is the same. COS is a function that returns the cosine of a given angle. EXP is a function that raises the natural logarithm (e) to the power of the argument. this is the number with the decimal portion removed. Numbers which are to be negated should be enclosed in parenthesis. ACS ASN ATN COS EXP INT dptechnology. ACS is a function that returns the arccosine value. ATN is a function that returns the arctangent value. LN LN is a function that returns the natural logarithm value. as in (-2). If the value is negative. ASN is a function that returns the arcsine value. INT is a function that returns the next lowest integer value for a given argument.14) = 3 while INT(-3. Variables and expressions which are to be negated should be multiplied by (-1). ATN is the angle (in degrees) that has a tangent value equal to the given argument. and is evaluated first. ASN is the angle (in degrees) that has a sine value equal to the given argument.71828. as in (-1)*(expression).com   19 . which returns the remainder after division Addition Subtraction (same precedence as addition) Besides mathematical operators there are also mathematical functions: ABS ABS is a function that returns the absolute value of an argument. e is a transcendental constant (like pi) and has a value off approximately 2. The angle value is given in degrees. For Negative numbers with a decimal portion. The natural logarithm is the power to which the constant e must be raised to equal the given value. INT(3. TAN is a function that returns the tangent of a given angle. The angle value is given in degrees.com   20 . but it is easily worked around using the EXP and LN functions since: x^y=exp(y*ln(x)). ElseIf Example: ex_CycleStart : Comment : : : If (SpindleSpeed<500) : ElseIf (SpindleSpeed<1250) SpindleUnit S(1) SpindleDirection SpindleUnit S(2) SpindleDirection dptechnology. SQR(x) equals x^2. Special key words to add loops in t he program Special keywords let you add more functionality to your post.INTRODUCTiON TO ESPRIT POsT PROCessOR SIN SQR SQRT TAN Notes: SIN is a function that returns the sine of a given angle. What appears after the Else and before the EndIf is executed when the condition is false. Instead of writing a separate line of code for each Else and If condition. • The exponent operator ^ is not supported. • The + operator is also used to concatenate strings. The + operator only works as addition of both operands are numbers or numeric variables. • ‘If’ is a special keyword that branches the NC code output depending upon a test condition • ‘Else’ is a special keyword that separates the true and false branches of an If condition • ‘ElseIf’ is a special keyword that is useful for testing several ranges of values • ‘EndIf’ is a special keyword that closes an If conditional branch If Example (single line): ex_Rapid : If (OutputStartPoint=1) ExitExample EndIf : G00 X Y Z CoolantCode If/Else Example (multiple lines): Define PreCallTool If (NextTool=0) \\ Else \\ EndIf If (PresentTool<>FirstTool) T*(FirstTool) EndIf \\ T*(NextTool) \\ EndDefine What comes before the Else is executed when the condition is true. the ElseIf keyword lets you shorten the code to make it easier to read. then the + is treated as concatenation. If either of the operands in an expression is a string. SQRT is a function that returns the square root of a given value. The keywords If and Else will add a loop to the program to test for a specified condition. SQR is a function that returns the square of a value (that value to the power of 2). The angle value is given in degrees. ” : While (LoopCounter<=prognumber) : : LoopCounter=(LoopCounter+1) “Loop Counter” =~*(LoopCounter) : EndWhile DP Technology Corp. ©2011 DP Technology Corp. CA 93012 USA Phone: 1 800 627-8479 Outside the US: + 1 805 388-6000 Email: esprit@dptechnology. 1150 Avenida Acaso Camarillo. do a Set Origin” : “or Machine Setup and change the Program Number. All rights reserved. As soon as the condition is false. dptechnology. • ‘While’ is a special keyword that starts a loop that will continue while the condition is true and terminate as soon as the condition is false • ‘EndWhile’ is a special keyword that closes a While loop While example: Variable MiscFormat1 ex_EndCode : LoopCounter : =~ N 4 N N 0 N 4 N N 0 0 1 N 0 0 : LoopCounter=(1) : “To fully demonstrate this example.com ESPRIT is a registered trademark of DP Technology Corp.com   21 .INTRODUCTiON TO ESPRIT POsT PROCessOR : ElseIf (SpindleSpeed<2500) : : : Else SpindleUnit S(3) SpindleDirection SpindleUnit S(4) SpindleDirection : EndIf The keywords While and EndWhile will add a continuous loop to the program that will execute as long as a given test condition is true. the loop will terminate.
Copyright © 2024 DOKUMEN.SITE Inc.