本教程是偶在实际使用中的PowerMILL后处理文件修改知识的积累,其中有部分修改案例来源于帮助文件,在此仅以文字和图片的形式把他记录下来与初学者共同分享。(完整版请至文末下载WORD文档)

一、完整的后处理文件介绍

一个完整的后处理文件通常有:定义字符段、定义字符格式段、定义键值段、定义指令值段、变量定义、程序格式段等部分组成。

下面我们先来看一个比较完整的后处理文件,并把它分为数段,把需要修改的地方做个必要的解释:


machine fanucom —————— 后处理文件头


=========================== 第一部分是定义字符段 ==============================

   define word TN 

    address letter  = "TOOL TYPE:- " 

    address width   = 13 

    field width     = 25

   end define


具体解释:

   define word TN —————————————— 定义字段;

    address letter  = "TOOL TYPE:- " ————— 定义字段的返回值,比如在后处理文件里有“MS =C ; TN ToolType ; EM =C”,而在写程式的时候选用的是端铣刀,那么在CNC程式里就会有(TOOL TYPE:- ENDMILL);

    address width   = 13 ——————————— 定义字符宽度,如上"TOOL TYPE:- ",从T开始算起一共13位,包括空格;

    field width     = 25 ——————————— 定义返回字的宽度,如上"ENDMILL",如果field width = 2,那"TOOL TYPE:- "就返回EN;如果field width = 25,那"TOOL TYPE:- "就返回ENDMILL。

   end define 

 

========================== 第二段是定义字符的格式 =============================

   define format ( / G6 S T M1 M2 L P D E H O )

    address width              =   1

    field width                =   2

    exponent width             =   0

    scale factor               =   1

    scale divisor              =   1

    tape position              =   0

    print position             =   1

    sign                       = none

    not permanent

    not modal

   metric formats

    leading zeros              = false

    trailing zeros             = true

    decimal point              = false     控制公制尺寸的前导零、后导零,小数点

    decimal places             =   0

   imperial formats

    leading zeros              = false

    trailing zeros             = true

    decimal point              = false     控制英制尺寸的前导零、后导零,小数点

    decimal places             =   0

   end define

 

    word order = (    OP   N    G1   G2   G3   G4   G5   )

    word order = ( +  G6   G7   X    Y    Z    B    C    )

    word order = ( +  I    J    K    R    D    S    T    )

    word order = ( +  H    M1   M2   MS   msg  EM   Q    )      注册字符

    word order = ( +  Q1   Z2   R2   ID   F    )

    word order = ( +  TN   TD   TR   DY   MT   YR   PM   )


========================== 第三段是定义键值 ===================================

  define keys

    blocknumber                       = N —————— 定义程序段号

    preparatory function              = G1 ——————— 定义准备功能指令

    aux function                      = M1 —————— 定义辅助功能指令

    x feedrate                        not used ————— 定义X进给率指令

    y feedrate                        not used ————— 定义Y进给率指令

    z feedrate                        not used ————— 定义Z进给率指令

    circle angle                      not used  ————— 圆周角度

    x coordinate                      = X   —————— 定义X坐标轴

    y coordinate                      = Y   —————— 定义Y坐标轴

    z coordinate                      = Z   —————— 定义Z坐标轴

    key i                             = I  —————— 定义X轴矢量I键

    key j                             = J  —————— 定义Y轴矢量J键

    key k                            = K  —————— 定义Z轴矢量K键

    feedrate                          = F  —————— 定义进给率指令

    feedrate per revolution           = F   ——————— 定义每转进给率指令

    spindle                           = S —————— 定义主轴指令

    tool number                       = T —————— 定义刀具指令

    cycle dwell                       not used

    dwell                             = X —————  定义暂停时间键值

    tool length                       = H —————— 定义刀具长度补偿指令

    tool radius                       = D —————— 定义刀具半径补偿指令

    drill peck depth                  = Q1 —————— 钻孔的啄钻深度

    drill hole depth                  = Z2 —————— 定义钻孔深度

    clearplane                        = R2 ————— 定义安全平面高度

    message start                     = MS ————— 定义注释的开始符

    message end                       = EM ———— 定义注释的结束符

    opskip                            = OP ———— 定义跳段符号

    radius                            = R ————— 定义半径R键

    program id                        = ID ————— 定义程序号

    azimuth axis                      = B —————  在多轴加工中,定义方位轴

    elevation axis                    = C —————   在多轴加工中,定义仰角轴

    3rd rotation axis                 = null —————  在多轴加工中,定义第三旋转轴

    leader                            not used

    x vector                          not used

    y vector                          not used

    z vector                          not used

    error                             not used

  end define


========================== 定义指令值 ========================================

  define codes

    rapid                             =  G1    0 ========== 快速点定位

    linear                            =  G1    1 =========== 直线插补

    circle cw                         =  G1    2 =========== 顺圆插补

    circle ccw                        =  G1    3 ========== 逆圆插补

    dwell                             =  G6    4 ========= 暂停、准确停止

    xy plane                          =  G3   17 =========  XY平面

    zy plane                          =  G3   19 =========  YZ平面

    xz plane                          =  G3   18 =========  ZX平面

    compensation off                  =  G2   40 ========== 取消刀具半径补偿

    compensation on left              =  G2   41 =========== 刀具半径左补偿

    compensation on right             =  G2   42  =========== 刀具半径右补偿

    imperial data                     =  G4   20 ============ 英寸输入

    metric data                       =  G4   21 ============ 毫米输入

    absolute data                     =  G5   90 ============ 指定绝对坐标编程

    incremental data                  =  G5   91 ============ 指定增量坐标编程

    from                              =  G3   54 ========== 制定工作坐标系

    feedrate per minute               not used ================ 每分钟进给

    feedrate per revolution           not used ================= 每转进给

    spindle rpm                       not used

    constant surface speed            not used

    drill                             =  G4   81 =========== 钻孔循环锪镗循环

    break chip                        =  G4   82 =========== 钻孔循环或反镗循环

    deep drill                        =  G4   83 ============ 深孔钻循环

    tap                               =  G4   84 ========== 攻丝循环

    bore 1                            =  G4   85 ========== 镗孔循环

    bore 2                            =  G4   86 ========== 镗孔循环

    bore 3                            =  G4   87 ========== 背镗循环

    bore 4                            =  G4   88 ========== 镗孔循环

    bore 5                            =  G4   89 ========== 镗孔循环

    end of drill                      =  G4   80 ============= 固定循环取消

    macro start                       not used ============ 宏程序模态调用

    macro end                         not used =========== 宏程序模态调用取消

macro call                        not used ============ 宏程序调用

    cycle retract                     =  G6   99 ========== 固定循环返回到R点

    tool length offset                =  G3   43 =========== 正向刀具长度补偿

    spline                            not used ========  spline插补方式

    stop                              =  M1    0 ====  程序停止

    opt stop                          =  M1    1 =====  选择停止

    spindle on cw                     =  M1    3 =====  主轴正转

    spindle on ccw                    =  M1    4 =====  主轴逆转

    spindle off                       =  M1    5 =====   主轴停止

    spin coolant on cw                =  M1   13

    spin coolant on ccw               =  M1   14

    spin coolant off                  =  M1    5 ====== 冷却液关

    change tool                      = M1    6 ======  自动换刀

    coolant on mist                   =  M1    7 =====  雾状冷却液

    coolant on                        =  M1    8 ====  冷却液开

    coolant on flood                  =  M1    8 =====  冷却液开(喷出)

    coolant off                       =  M1    9 =====  冷却液关

    clamp on                          not used

    clamp off                         not used

    end of tape                       =  M1    2 =====  程序结束

    end of prog                       =  M1   30 =====  程序结束

    gear range 1                      not used

    gear range 2                      not used

    gear range 3                      not used

    constant contour speed            not used

    constant contour speed 2          not used

    word drill                        not used

    word break chip                   not used

    word deep                         not used

    word tap                          not used

    word bore 1                       not used

    word bore 2                       not used

    word bore 3                       not used

    word bore 4                       not used

    word bore 5                       not used

    coolant on tap                    not used

    rigid tap                         not used ====== 刚性攻丝

    helical drill                     not used

    helical retract drill             not used

  end define


================================ 定义变量 ======================================

  print header               = "Delcam Postprocessor" ================== 定义打印标题

  machine name               = "Fanuc6m          version 1.2" ========= 机器名

  point                      = "." ================================  小数点

  zero                       = "0" ===============================  零

  tape headers               =     1 ==============================  纸带标题

  

(integer 6 、integer 7):定义coolant output(冷却液输出)

integer   6                =     2 ============== 定义冷却液开(M07、M08)的输出方式,

此变量共有三个选项——0:在后处理时遇到相关指令时输出;1:在下一段中单独输出;2、在下一段中和坐标移动一起输出。

  integer   7                =     1 ============== 定义冷却液关(M09)的输出方式,此变量共有三个选项——0:在后处理时遇到相关指令时输出;1:在下一段中单独输出;2、在下一段中和坐标移动一起输出。

 

(integer 10、integer 11、integer 12、integer 13):定义spindle output(主轴输出)

 integer  10                =     2 ============== 定义主轴开(M03、M04)的输出方式,

此变量共有三个选项——0:在后处理时遇到主轴开指令时输出;1:在下一段中单独输出;2、在下一段中和坐标移动一起输出。

  integer  11                =     1 ============= 定义主轴关(M05)的输出方式,此变量共有二个选项——0:在遇到主轴关指令时不输出S;1:在遇到主轴关指令时输出S0。

  integer  12                =     1 ============= 定义M代码的输出方式,此变量共有二个选项——0:在遇到主轴相关指令时不输出M;1:在遇到主轴相关指令时输出M。

 

 tool reset coordinates     =     2 =============== 定义刀具复位后(M06后)的坐标处理方式,有1、2、3、4四个选项,请注意这四个选项的刀具补偿的区别:


    #N   ; OP  ; change tool     ; T ToolNum

    G3  54    ; G5  90   ; G3 =C     ; G5 =C   ; #T NextTool   ;

  end define

 

  define block tool change

    N   ; G5  91    ; G6  28    ; Z   0    

WORD文档下载:

下载量 : 46  |  类型 : 压缩文件