User Tools

Site Tools


wiki:en:ppedit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:en:ppedit [2019/10/10 11:40]
admin [PARAMETERS]
wiki:en:ppedit [2019/10/11 13:33] (current)
admin [REPETITIONS (LOOPS)]
Line 1: Line 1:
-====== ​PPEdit ​======+====== ​Post processor language ​======
  
 We begin by looking at the different types of definitions accessible in the post processor file.  All definitions begin with a letter and then a number, the letter deciding what type of definition it is and the number being an address to distinguish between the definitions. We begin by looking at the different types of definitions accessible in the post processor file.  All definitions begin with a letter and then a number, the letter deciding what type of definition it is and the number being an address to distinguish between the definitions.
Line 158: Line 158:
 In our macro a special language is used which we have chosen to call "The Macro Language"​. In this language we can output parameters, perform calculations,​ set conditions, etc. We use different signs to do different things. It may look confusing to begin with but it will become clearer quite soon once you have begun working with the post processors. We will begin by describing how to output a simple text  in a macro. Text strings such as these are always initiated and concluded by a quotation mark ("). If we want to output the word Kalle in our nc-program by means of a macro called M125 we simply write: In our macro a special language is used which we have chosen to call "The Macro Language"​. In this language we can output parameters, perform calculations,​ set conditions, etc. We use different signs to do different things. It may look confusing to begin with but it will become clearer quite soon once you have begun working with the post processors. We will begin by describing how to output a simple text  in a macro. Text strings such as these are always initiated and concluded by a quotation mark ("). If we want to output the word Kalle in our nc-program by means of a macro called M125 we simply write:
  
-M125  My own macro :  ​KALLE+''​%%M125  My own macro :  ​"KALLE"​%%''​
  
 We will try to write some macros of our own a little further on in this booklet. Remember that even the spaces are counted as long as they are found inside the quotation marks so if we want a space character after Kalle we will have to write it like this: We will try to write some macros of our own a little further on in this booklet. Remember that even the spaces are counted as long as they are found inside the quotation marks so if we want a space character after Kalle we will have to write it like this:
  
-M125  My own macro :  ​KALLE  ​+''​%%M125  My own macro :  ​"KALLE  ​"​%%''​
  
 Inside the ""​ signs we can besides ordinary texts also insert special control codes to determine the appearance of the output. Control codes are always preceded by a # sign followed by a letter and sometimes digits, too. As an example of a control code can be adduced #b which implies row pitch or block end. If we want to output the text Kalle Andersson but we want these two words to end up each on its own line in the nc-program we simply write Inside the ""​ signs we can besides ordinary texts also insert special control codes to determine the appearance of the output. Control codes are always preceded by a # sign followed by a letter and sometimes digits, too. As an example of a control code can be adduced #b which implies row pitch or block end. If we want to output the text Kalle Andersson but we want these two words to end up each on its own line in the nc-program we simply write
  
-M125  My own macro :  ​KALLE#​bANDERSSON+''​%%M125  My own macro :  ​"KALLE#​bANDERSSON"​%%''​
  
 Another control code is used to output the contents of a parameter and is called #x. This control code prints out the contents of the last-mentioned parameter. Mentioning a parameter implies printing it outside the ""​ signs. If, for instance, we want to print out an S followed by the number of spindle revolutions,​ we print the following macro: Another control code is used to output the contents of a parameter and is called #x. This control code prints out the contents of the last-mentioned parameter. Mentioning a parameter implies printing it outside the ""​ signs. If, for instance, we want to print out an S followed by the number of spindle revolutions,​ we print the following macro:
  
-M125 Print spindle rotation speed : <​spirot>  ​S#x+''​%%M125 Print spindle rotation speed : <​spirot>  ​"S#x"​%%''​
  
 Other control codes can be used to decide the appearance of a number ​ at the output. An example could be #d indicating the minimum of decimals to be printed. If for instance, we want a macro that outputs the absolute x-value ​ with at least two decimals added, the macro will look like this: Other control codes can be used to decide the appearance of a number ​ at the output. An example could be #d indicating the minimum of decimals to be printed. If for instance, we want a macro that outputs the absolute x-value ​ with at least two decimals added, the macro will look like this:
  
-M125 Print out X : <​xstopa>  ​X#d2#x+''​%%M125 Print out X : <​xstopa>  ​"X#d2#x"​%%''​
    
-Below you will find a lists of control codes: +==== Lists of control codes ====
  
-#b      end-of-block +^Code^Description^ 
-#nnn    prints the asciisign ​nnn (e.g. #003) +|#b      |end-of-block| 
-##      prints # +|#nnn    |prints the ascii sign nnn (e.g. #003)| 
-#" ​     prints " +|##      |prints #| 
-#x         prints active parameter +|#" ​     |prints "| 
-#$       ​ prints active text parameter +|#x         |prints active parameter| 
-#Dn     ​ max. n number of decimals (3) +|#$        |prints active text parameter| 
-#dn     ​ min. n number of decimals ​ +|#Dn      |max. n number of decimals (3)| 
- (-1 =no decimal point) +|#dn      |min. n number of decimals (-1 =no decimal point)| 
-#Rt     ​ fills in concluding zeros by t  +|#Rt      |fills in concluding zeros by t (ä = none)| 
- (ä = none) +|#Hn      |max. n-number of integers (9)| 
-#Hn     ​ max. n-number of integers (9) +|#hn      |min. number of integers (1| 
-#hn     ​ min. number of integers (1 +|#Lt      |fills in introductory zeros by t | 
-#Lt     ​ fills in introductory zeros by t  +|#Pt      |sign for decimal point  (ä= no decimal point (.))| 
-#Pt     ​ sign for decimal point  ​ +|#Tt      |sign at positive number (ä=none)| 
- (ä= no decimal point (.)) +|#Nt      |sign at negative number (-)| 
-#Tt     ​ sign at positive number (ä=none) +|#Fn      |fills in to the right to the number of positions with the sign indicated by #R (0).|
-#Nt     ​ sign at negative number (-) +
-#Fn     ​ fills in to the right to the number ​   ​of positions with the sign  indicated by #R (0).+
  
  
-You can read more about control codes in the section called ​"Formatted output" ​further on in this booklet.+You can read more about control codes in the section called ​[[wiki:​en:​ppedit#​formatted_output|Formatted output]] further on in this documentation.
  
    
Line 227: Line 225:
 It now remains to create the condition which will output code M66 the first time: It now remains to create the condition which will output code M66 the first time:
  
-''&​F25(” M66)''​+''​%%&F25(" ​M66")%%'' ​
  
 This means: //IF FLAG 25 IS NOT SET OUTPUT M66 AND SET FLAG 25.// This means: //IF FLAG 25 IS NOT SET OUTPUT M66 AND SET FLAG 25.//
Line 233: Line 231:
 The flag being zero (not set)  when we start the post processor the condition will be met the first time and since we use the &​character the flag will be set which will entail that the condition will not be met the next time. It now remains to insert the condition in the desired position in the macro for the change of tools. The flag being zero (not set)  when we start the post processor the condition will be met the first time and since we use the &​character the flag will be set which will entail that the condition will not be met the next time. It now remains to insert the condition in the desired position in the macro for the change of tools.
  
-''​M111 Makro for toolchange: M103 <​toolnr> ​” T#x M6” \ \\ +''​%%M111 Makro for toolchange: M103 <​toolnr> ​" ​T#x M6" ​%%'' ​\\ 
-&F25(” M66)''​+''​%%&F25(" ​M66")%%'' ​
  
 Notice that we use the   ​\-sign (backslash) to tell the post processor to go on reading the macro on the next line. Notice that we use the   ​\-sign (backslash) to tell the post processor to go on reading the macro on the next line.
Line 240: Line 238:
 We can also indicate what we want to happen if the condition is not met (OR ELSE). If we want to change the macro for the change of tools so that M66 is output at the first change of tools and M67 (notice that this example is not necessarily logical but only used to explain the functions of the language) is output at all subsequent changes of tools we must add a pair of brackets to be executed if the condition is not met. This is done like this: We can also indicate what we want to happen if the condition is not met (OR ELSE). If we want to change the macro for the change of tools so that M66 is output at the first change of tools and M67 (notice that this example is not necessarily logical but only used to explain the functions of the language) is output at all subsequent changes of tools we must add a pair of brackets to be executed if the condition is not met. This is done like this:
  
-''&​F25(” M66),(” M67)''​+''​%%&F25(" ​M66"),(" ​M67")%%'' ​
  
 This means: IF FLAG 25 IS NOT SET OUTPUT M66 OTHERWISE OUTPUT M67 AND SET THE FLAG. This means: IF FLAG 25 IS NOT SET OUTPUT M66 OTHERWISE OUTPUT M67 AND SET THE FLAG.
Line 246: Line 244:
 After all types of conditions we can print an alternative pair of brackets separately with a comma sign to be executed if the first pair of brackets was not executed. Those who know some BASIC would picture the above line like this: After all types of conditions we can print an alternative pair of brackets separately with a comma sign to be executed if the first pair of brackets was not executed. Those who know some BASIC would picture the above line like this:
  
-''​IF F25=0 THEN  +''​%%IF F25=0 THEN %%''​ \\ 
-  PRINT ” M66”  +''​%% ​ ​PRINT ​" ​M66" %%'' ​ 
-ELSE  +''​%%ELSE %%'' ​ 
-  PRINT ” M67”  +''​%% ​ ​PRINT ​" ​M67" %%'' ​ 
-END IF \\ +''​%%END IF %%'' ​\\ 
-F25=1 +''​%%F25=1%%''​  
-''​ + 
-  +
-====== Examples ======+
  
-====== SETTING VARIABLES AND FLAGS ======+===== SETTING VARIABLES AND FLAGS =====
  
 The $-sign is used to set unconditionally a variable at a value or to set a flag. If for instance we want to set variable 10 with the contents of <​xstope>​ we write: The $-sign is used to set unconditionally a variable at a value or to set a flag. If for instance we want to set variable 10 with the contents of <​xstope>​ we write:
Line 275: Line 272:
  
  
-====== REPETITIONS (LOOPS) ​======+===== REPETITIONS (LOOPS) =====
  
 By means of the *-character we can perform repetitions or loops as they are also called. By means of the *-character we can perform repetitions or loops as they are also called.
Line 282: Line 279:
 If we want a pair of brackets to be repeated controlled by a parameter we write: If we want a pair of brackets to be repeated controlled by a parameter we write:
  
-<​parameter> ​ *()+''​%%<​parameter> ​ *()%%''​
  
 which means that the contents of the brackets will be repeated as many times as the contents of the parameter. which means that the contents of the brackets will be repeated as many times as the contents of the parameter.
Line 288: Line 285:
 Instead of the name of a parameter we can write a calculation,​ a variable or an integer between the < and > signs. These will be created in the same way as a parameter of the post processor. See example below! Instead of the name of a parameter we can write a calculation,​ a variable or an integer between the < and > signs. These will be created in the same way as a parameter of the post processor. See example below!
  
-''<​10>​ \\ +''​%%<​10> ​%%'' ​\\ 
-<​5+toolnr>​ \\ +''​%%<​5+toolnr> ​%%'' ​\\ 
-<V1> \\ +''​%%<​V1> ​%%'' ​\\ 
-<​V1+toolnr>​ ''​ \\+''​%%<​V1+toolnr> ​%%''​ \\
  
 ==== Example ==== ==== Example ====
Line 396: Line 393:
 Then we can write a new macro calculating the X,Y coordinates according to the values input in V12 and V13: Then we can write a new macro calculating the X,Y coordinates according to the values input in V12 and V13:
  
-''​M120 Calculate X, Y coordinates ​ \\ +''​%%M120 Calculate X, Y coordinates ​%%'' ​\\ 
-  : $V10<​V12*cos(V13)>​\ ​ \\ +''​%% ​ : $V10<​V12*cos(V13)>​\ ​%%'' ​\\ 
-    $V11<​V12*sin(V13)> ​ \\ +''​%% ​   ​$V11<​V12*sin(V13)> ​%%'' ​\\ 
-''​+
 When calling macro 120 our coordinate will be found stored in V10 and V11. When calling macro 120 our coordinate will be found stored in V10 and V11.
  
Line 480: Line 477:
  
 Before: \\ Before: \\
-''​M104 Set new X-pos              : &​V1<​ystopa>​("​ X#​x"​)''​+''​%%M104 Set new X-pos              : &​V1<​ystopa>​("​ X#x")%%''​
  
 After: \\ After: \\
-''​M104 Set new X-pos              : &​V1<​ystopa*2>​("​ X#​x"​)''​+''​%%M104 Set new X-pos              : &​V1<​ystopa*2>​("​ X#x")%%''​
  
 //- How do I get a decimal point after all numbers, even integers? My machine requires this otherwise the numbers will be interpreted as thousandths. //- How do I get a decimal point after all numbers, even integers? My machine requires this otherwise the numbers will be interpreted as thousandths.
Line 493: Line 490:
  
 Before: \\ Before: \\
-''​M104 Set new X-pos              : &​V1<​xstopa>​("​ X#x") \\ +''​%%M104 Set new X-pos              : &​V1<​xstopa>​("​ X#​x"​) ​%%'' ​\\ 
-M105 Set new Y-pos              : &​V2<​ystopa>​("​ Y#x") \\ +''​%%M105 Set new Y-pos              : &​V2<​ystopa>​("​ Y#​x"​) ​%%'' ​\\ 
-M106 Set new Z-pos              : &​V3<​zstopa>​("​ Z#x") ''​ \\+''​%%M106 Set new Z-pos              : &​V3<​zstopa>​("​ Z#​x"​) ​%%''​ \\
  
 After: \\ After: \\
-''​M104 Set new X-pos             : &​V1<​xstopa>​("​ X#​d0#​x"​) \\ +''​%%M104 Set new X-pos             : &​V1<​xstopa>​("​ X#​d0#​x"​) ​%%'' ​\\ 
-M105 Set new Y-pos             : &​V2<​ystopa>​("​ Y#​d0#​x"​) \\ +''​%%M105 Set new Y-pos             : &​V2<​ystopa>​("​ Y#​d0#​x"​) ​%%'' ​\\ 
-M106 Set new Z-pos             : &​V3<​zstopa>​("​ Z#​d0#​x"​) ''​ \\+''​%%M106 Set new Z-pos             : &​V3<​zstopa>​("​ Z#​d0#​x"​) ​%%''​ \\
  
 It could be that coordinate values are written out in several places in the post processor and then you will have to find these and enter the code #d0 there too. It could be that coordinate values are written out in several places in the post processor and then you will have to find these and enter the code #d0 there too.
Line 510: Line 507:
 Change the macros M6-M9 from looking like this: Change the macros M6-M9 from looking like this:
  
-''​M6 Clockwise arc < than 180° \\ +''​%%M6 Clockwise arc < than 180° %%'' ​\\ 
-: M108 M103 " G02" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​   " J#x" M101 M109''​+''​%%: M108 M103 " G02" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​   " J#x" M101 M109 %%''​
  
-''​M7 Clockwise arc > than 180°:​ M6''​ \\+''​%%M7 Clockwise arc > than 180°: M6%%''​ \\
  
-''​M8 C.Clockwise arc < than 180° \\ +''​%%M8 C.Clockwise arc < than 180° %%'' ​\\ 
-: M108 M103 " G03" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​   " J#x" M101 M109 ''​\\+''​%%: M108 M103 " G03" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​   " J#x" M101 M109 %%''​\\
  
-''​M9 C.Clockwise arc > than 180°: M8 ''​+''​%%M9 C.Clockwise arc > than 180°:​ M8 ​%%''​
  
 To look like this: To look like this:
  
-''​M6 Clockwise arc < than 180° \\ +''​%%M6 Clockwise arc < than 180° %%'' ​\\ 
- : M108 M103 " G02" M104 M105 <​radie> ​” R#x” M101 M109 \\ +''​%% ​: M108 M103 " G02" M104 M105 <​radie> ​" ​R#x" ​M101 M109 %%'' ​\\ 
-M7 Clockwise arc > than 180° \\ +''​%%M7 Clockwise arc > than 180° %%'' ​\\ 
- : M108 M103 " G02" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​    "​ J#x" M101 M109 \\+''​%% ​: M108 M103 " G02" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​    "​ J#x" M101 M109 %%'' ​\\
  \\  \\
-M8 C.Clockwise arc < than 180° \\ +''​%%M8 C.Clockwise arc < than 180° %%'' ​\\ 
- : M108 M103 " G03" M104 M105 <​radie> ​” R#x” M101 M109 \\+''​%% ​: M108 M103 " G03" M104 M105 <​radie> ​" ​R#x" ​M101 M109 %%'' ​\\
  \\  \\
-M9 C.Clockwise arc > than 180° \\ +''​%%M9 C.Clockwise arc > than 180° %%'' ​\\ 
- : M108 M103 " G03" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​    "​ J#x" M101 M109''​ \\+''​%% ​: M108 M103 " G03" M104 M105 <​xcenti>"​ I#x" <​ycenti>​\ ​    "​ J#x" M101 M109%%''​ \\
  
 Notice that your macros may not look exactly like the above and then of course you will have to consider this when changing your macros. Notice that your macros may not look exactly like the above and then of course you will have to consider this when changing your macros.
Line 539: Line 536:
 ANSWER: ANSWER:
  
-There is a position at the beginning of the post processor indicating where the nc-programs will be stored. This position is called I102. Enter the search way into the catalogue where you want to store your programs after the colon of  I102.+There is a position at the beginning of the post processor indicating where the NC-programs will be stored. This position is called I102. Enter the search way into the catalogue where you want to store your programs after the colon of  I102.
  
-''​I102 File path  : c:​\ncprog''​+''​%%I102 File path  : c:\ncprog%%''​
    
 //-My machine writes all values in thousandths and without decimals. How do I fix this?// //-My machine writes all values in thousandths and without decimals. How do I fix this?//
Line 549: Line 546:
 Change the positions I3-I5 at the beginning of the post processor so that it says 1000 instead of 1 on these: Change the positions I3-I5 at the beginning of the post processor so that it says 1000 instead of 1 on these:
  
-''​I3 X scale : 1000 \\ +''​%%I3 X scale : 1000%%'' ​\\ 
-I4 Y scale : 1000 \\ +''​%%I4 Y scale : 1000%%'' ​\\ 
-I5 Z scale : 1000''​ \\+''​%%I5 Z scale : 1000%%''​ \\
  
 Then change the macros that write out the X,Y, Z values (usually M104-M106) so that it says #D0 in front of # in them. Then check if X, Y, Z-values are entered into any more positions of the post processor and change those too, if necessary. Then change the macros that write out the X,Y, Z values (usually M104-M106) so that it says #D0 in front of # in them. Then check if X, Y, Z-values are entered into any more positions of the post processor and change those too, if necessary.
  
-''​M104 Set new X-pos             : &​V1<​xstopa>​("​ X#​D0#​x"​) \\ +''​%%M104 Set new X-pos             : &​V1<​xstopa>​("​ X#​D0#​x"​)%%'' ​\\ 
-M105 Set new Y-pos             : &​V2<​ystopa>​("​ Y#​D0#​x"​) \\ +''​%%M105 Set new Y-pos             : &​V2<​ystopa>​("​ Y#​D0#​x"​)%%'' ​\\ 
-M106 Set new Z-pos             : &​V3<​zstopa>​("​ Z#​D0#​x"​)''​ \\+''​%%M106 Set new Z-pos             : &​V3<​zstopa>​("​ Z#​D0#​x"​)%%''​ \\
  
-//-I want my first change of tools to look different from the subsequent ones in my nc-program. Can I change this?//+//-I want my first change of tools to look different from the subsequent ones in my NC-program. Can I change this?//
  
 ANSWER: ANSWER:
Line 565: Line 562:
 Yes, look up the section on conditions at the beginning of this booklet. A similar case is described there. Yes, look up the section on conditions at the beginning of this booklet. A similar case is described there.
  
-''​- I have problems when I want to test-run my post processor. A red square appears where it says "Wrong character" ​ or "Macro M99 missing"​ or suchlike. What is to be done?''​+//- I have problems when I want to test-run my post processor. A red square appears where it says "Wrong character" ​ or "Macro M99 missing"​ or suchlike. What is to be done?//
  
 ANSWER: ANSWER:
wiki/en/ppedit.1570700449.txt.gz · Last modified: 2019/10/10 11:40 by admin