欢迎光临
我们一直在努力

深度好文|怎样制作带有统计加工时间的MasterCAM后处理

分享有穿透力的技术

雕琢有愉悦性的产品

今天是CNC数控编程与前沿机加工陪伴你的第707天

在后处理程序中输出时间,对于编程加工的优化是再方便不过了,但是在MasterCAM的后处理程序中加入时间还是有相当难度的。

程序头的注释说明和刀具清单便于校对加工参数

程序尾的统计说明便于优化已编好的加工程序

1. 一般输出设置项

# Specific setting to allow tuning the cycle time calculations

# Set the time it takes for machine to do a toolchange

tlchgtime    : 0.1   #Tool Change Time (* in Minutes *)

time_est     : 3     #Output operation and/or cycle times?

#0 = Do NOT output time estimates (including det_time estimates below)

#1 = Output operation time ONLY for EACH tool (not Program)

#2 = Output comeplete cycle time ONLY for entire Program

#3 = Output operation time for EACH tool AND cycle time for Program (if > 1 tool)

2. 加工时间输出设置

psof$            #Start of file for non-zero tool number

psetup  #Call for toolchange info output

ptlchg0$         #Call from NCI null tool change (tool number repeats)

if op_id$ <> prv_op_id$, ptlchg$

ptlchg$          #Tool change - Output of time calculations for the last tool run

if op_id$ = prv_op_id$, ex$

ptooldata          #Total ending data for tool (Path Length and Times)

tmax_fr = fr_pos$  #Initialize (max fr used in current tool)

tmin_fr = fr_pos$  #Initialize (min fr used in current tool)

psetup             #Call for toolchange info output

peof0$           #End of file for tool zero

peof$            #End of file for non-zero tool - Output of time calculations for the last tool and total time

ptooldata  #Total ending data for tool (Path Length and Times)

#Supress Program totals if only one tool or no output selected

if tcnt > one & (fr_limits | xyz_limits | show_lengths | time_est),

3.快速和进给长度及时间和总加工时间的输出

#Output Feed/Rapid path lengths

if show_lengths = two | show_lengths = three,

"Total Feed Cut Length = ", *llen_total, e$

"Total Rapid Traverse Length = ", *rlen_total, e$

#sepline, e$  #Output the separator '----' line

#Output Rapid/Feedrate times

if time_est > 0 & (det_time = two | det_time = three),

ttltime = tot_rtime

"Total Rapid Time = ", ptimeout, e$

ttltime = tot_ltime

"Total Feed  Time = ", ptimeout, e$

#sepline, e$  #Output the separator '----' line

#Output Cycle Time information

if time_est = two | time_est = three,

ttltime = total                #Transfer TOTAL program time

"Cycle Time = ", ptimeout, e$  #Program Total time output

4.时间单位的相互转换

pthrminsec       #Convert minutes to hr/min/sec format

thrs = int(ttltime / 60)

tmin = int(ttltime - thrs * 60)

tsec = (ttltime - thrs * 60 - tmin) * 60

5.总加工时间的组成

pttltime         #Total tool times and total program time

tot_ltime = tot_ltime + tltime      #Total FEED time

tot_rtime = tot_rtime + trtime      #Total RAPID time

ttltime = tltime + trtime           #Calc. current Tool Time

total = ttltime + total + tlchgtime #Calc. total Program Time

6.输出时间的格式

ptimeout         #Output "times"

pthrminsec  #Convert minutes to hr/min/sec format

#Output 'HOURS'

if thrs = one, *thrs, " Hour, "

if thrs > one, *thrs, " Hours, "

#Output 'MINUTES'

if tmin = one, *tmin, " Minute, "

if tmin > one, *tmin, " Minutes, "

#Output 'SECONDS'

if tsec > zero, *tsec, " Seconds"

7.快速进给时间和长度的计算原理及变量

ptimer           #Rapid time and length calc

rlen = rlen + len            #Running total RAPID length

trtime = rlen / pst_rpd_fr$  #Running total RAPID time

ptimel           #Feed time and length calc

if fr_pos$ < zero, fr_pos$ = prv_fr_pos$

if fr_pos$ < tol, fr_pos$ = tol

llen = llen + len

tltime = tltime + len / fr_pos$

8.切削进给时间和长度的计算原理及变量

ptimel           #Feed time and length calc

if fr_pos$ < zero, fr_pos$ = prv_fr_pos$

if fr_pos$ < tol, fr_pos$ = tol

llen = llen + len

tltime = tltime + len / fr_pos$

9.空间3D长度的计算原理及变量

ptime            #Distance calculations

dx = x$ - prv_x$

dy = y$ - prv_y$

dz = z$ - prv_z$

len = sqrt(dx^2 + dy^2 + dz^2)

if gcode$ = zero, ptimer  #RAPID time and length calc

if gcode$ = one, ptimel   #FEED  time and length calc

!x$, !y$, !z$, !fr_pos$   #Update previous [prv_?] variables

if fr_limits, pfrcheck    #Track MAX/MIN Feedrates if requested

10.有关加工时间相关变量的格式

# Format assignments

# --------------------------------------------------------------------------

fmt     9   progno$     #Program number

fmt     3   t$          #Tool number

fmt     7   tldia$      #Tool diameter

fmt     7   tcr$        #Tool corner radius

fmt     3   tloffno$    #Diameter offset number

fmt     3   tlngno$     #Length offset number

fmt     3   ss$         #Spindle speed

fmt     4   fr_pos$     #Feedrate

fmt     2   llen        #Feed cut length

fmt     2   rlen        #Rapid traverse cut length

fmt     2   llen_total  #Feed cut length (program total)

fmt     2   rlen_total  #Rapid traverse cut length (program total)

fmt     2   total       #Total part time

fmt     2   ttltime     #Total operation time

fmt     3   thrs        #Time in hours

fmt     3   tmin        #Time in minutes

fmt     8   tsec        #Time in seconds

fmt     3   tcnt        #Tool Counter

fmt     3   custcycle   #Custom Cycle number

fmt     4   tmax_fr     #Max Feedrate in current Tool

fmt     4   tmin_fr     #Min Feedrate in current Tool

fmt     4   pmax_fr     #Max Feedrate in Program

fmt     4   pmin_fr     #Min Feedrate in Program

将以上内容加入到现有后处理中,配以适当的位置便可以在后处理出的NC程序中输出加工时间,其中的快速进给是机床默认的12500mm/min,切削进给在编程参数中设定,换刀时间(tlchgtime    : 0.0333   #Tool Change Time (* in Minutes *)可以根据具体机床设定,本程序设定0.3333分钟,大概是2秒。

其总加工时间( CYCLE TIME)=快速进给时间+切削进给时间+换刀时间;基本吻合实际生产加工时间。

赞(27)
分享到: 更多

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址