秒到pos機到賬時間段,Mastercam后處理時間源代碼

 新聞資訊  |   2023-05-19 09:38  |  投稿人:pos機之家

網(wǎng)上有很多關于秒到pos機到賬時間段,Mastercam后處理時間源代碼的知識,也有很多人為大家解答關于秒到pos機到賬時間段的問題,今天pos機之家(www.tjfsxbj.com)為大家整理了關于這方面的知識,讓我們一起來看下吧!

本文目錄一覽:

1、秒到pos機到賬時間段

秒到pos機到賬時間段

Mastercam后處理時間源代碼,該方法所輸出的時間只能放在程序尾部,如果需要放在程序頭,需要使用者額外增加輸出到程序頭的代碼,至于程序時間的準確與否,未經(jīng)全面測試,部分測試時間可信。

由于代碼較多,添加時嚴格按照下列方法進行。

1:換刀時間,這個需要根據(jù)實際情況進行相應的時間設定。

單位:分鐘

tlchgtime : 0.066 #Tool Change Time (* in Minutes *) I'ts 4 sec now

2:定義切削進給,快速進給等保存數(shù)據(jù)標簽。

ttltime : 0 #Total operation timetltime : 0 #Feed timetrtime : 0 #Rapid timetotal : 0 #Total machine timetot_ltime : 0 #Total FEED timetot_rtime : 0 #Total RAPID time

3:定義記錄x,y,z相對距離保存數(shù)據(jù)標簽

len : 0 #Length for calculationdx : 0 #Delta xdy : 0 #Delta ydz : 0 #Delta z

3:定義鉆孔類輔助數(shù)據(jù)保存標簽

drill_length_r : 0 # Drill length - RAPIDdrill_length_f : 0 # Drill length - FEEDactual_drl_depth : 0 # Actual drill depth variablepeck_safe_dist : 0.3 # Peck/Chip break safe distance for retratct into hole

4:定義他輔助開關

use_TC_pos : yes$ # Calculate with Home positions @ TC? 0=No, 1=Yessav_X_Pos : 0 # Saved X position, use X_home/Y_home/Z_home in rapids at TCsav_Y_Pos : 0 # Saved Y position, use X_home/Y_home/Z_home in rapids at TCsav_Z_Pos : 0 # Saved Z position, use X_home/Y_home/Z_home in rapids at TC

5:定義時間輸出格式

time_format : 2 # Time format of output times in NC code: # 1 = 2h 14:25 # 2 = 2hrs, 14mins, 25.08sec

6:定義時間數(shù)據(jù)格式

fs2 8 0^2 0^2n #Decimal, 2 place, omit decimal if whole number, non-modal

7:定義時間數(shù)據(jù)輸出類型

fmt 2 llenfmt 2 rlenfmt 2 llen_totalfmt 2 rlen_totalfmt 2 totalfmt 2 ttltimefmt 4 thrsfmt 4 tminfmt 8 tsec

8:初始化所有保存數(shù)據(jù)的標簽

psetup #Output of toolchange information !gcodellen = zero #Reset counter for next toolrlen = zero #Reset counter for next tooltltime = zero #Reset counter for next tooltrtime = zero #Reset counter for next toolttltime = zero #Reset counter for next toolif use_TC_pos, [ sav_X_Pos = x, sav_Y_Pos = y, sav_Z_Pos = z x = xh, y = yh, z = zh ptime_calc x = sav_X_Pos, y = sav_Y_Pos, z = sav_Z_Pos ]

9:統(tǒng)計進給距離,快速進給距離,時間等

ptooldata #Total ending data for tool (Path Length and Times) llen_total = llen_total + llen #Keep running total for Program rlen_total = rlen_total + rlen #Keep running total for Program 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

10:時間轉(zhuǎn)換,按60進制進行轉(zhuǎn)換

pthrminsec #Convert minutes to hr/min/sec format thrs = int(ttltime / 60) tmin = int(ttltime - thrs * 60) tsec = (ttltime - thrs * 60 - tmin) * 60

11:時間輸出

ptimeout #Output "times" pthrminsec #Convert minutes to hr/min/sec format if time_format = one, [ #Output 'HOURS' if thrs = one, *thrs, "hr, " if thrs > one, *thrs, "hrs, " #Output 'MINUTES' if tmin = one, *tmin, "min, " if tmin > one, *tmin, "min, " #Output 'SECONDS' if tsec > zero, *tsec, "sec" ] else, [ result = newfs(five, tsec) #Output 'HOURS' if thrs > one, *thrs, "h " #Output 'MINUTES' and 'SECONDS' *tmin, ":", *tsec ]

12:快速進給時間計算

ptimer #Rapid time and length calc rlen = rlen + len #Running total RAPID length trtime = rlen / pst_rpd_fr #Running total RAPID time

13:進給加工時間計算

ptimel #Feed time and length calc llen = llen + len tltime = tltime + len / fr_pos

14:運行軌跡距離計算

ptime_calc #Distance calculations # Delta Distances dx = x - prv_x dy = y - prv_y dz = z - prv_z # Distance at linear movement if gcode = zero | gcode = one, len = sqrt(dx^2 + dy^2 + dz^2) # Distance at circular movement if gcode = two | gcode = three, len = (abs(sweep)/360) * 2 * arcrad * pi # Distance at drilling if gcode = 81 | gcode = 100, [ if gcode = 100, ptime_drill_XY if drillcyc = 0, ptime_drill_0 # Simple Drill if drillcyc = 1, ptime_drill_1 # Peck Drill if drillcyc = 2, ptime_drill_2 # Chip Break Drill if drillcyc = 3, ptime_drill_3 # Tapping if drillcyc = 4, ptime_drill_4 # Bore, feed out, Reaming if drillcyc = 5, ptime_drill_0 # Bore, stop, rapid out, SAME movements as "Simple Drill" if drillcyc = 6, ptime_drill_0 # Bore, fine, SAME movements as "Simple Drill" if drillcyc = 7, ptime_drill_0 # Bore, standard, SAME movements as "Simple Drill" ] # Time calculations by feed type if gcode = zero, ptimer #RAPID time and length calc if gcode = one | gcode = two | gcode = three, ptimel #FEED time and length calc !x, !y, !z, !fr_pos #Update previous [prv_?] variables

15:G81,G82鉆孔距離,時間計算

ptime_drill_0 # Simple Drill lengths len = abs(refht - depth) ptimel if initht <> refht, [ len = abs(initht - refht) len = len + abs(initht - depth) ptimer ] else, [ len = abs(refht - depth) ptimer ] if dwell <> zero, total = total + (dwell / 60)

16:G83鉆孔距離,時間計算

ptime_drill_1 # Peck Drill drill_length_f = abs(refht - depth) actual_drl_depth = peck1 while actual_drl_depth < drill_length_f, [ len = peck1 + peck_safe_dist ptimel len = (actual_drl_depth * 2) - peck_safe_dist ptimer actual_drl_depth = actual_drl_depth + peck1 ] len = (drill_length_f - actual_drl_depth) + peck_safe_dist + peck1 ptimel if initht <> refht, [ len = abs(initht - refht) len = len + abs(initht - depth) ptimer ] else, [ len = abs(refht - depth) ptimer ] if dwell <> zero, total = total + (dwell / 60)

17:G73鉆孔距離,時間計算

ptime_drill_2 # Chip Break Drill drill_length_f = abs(refht - depth) actual_drl_depth = peck1 while actual_drl_depth < drill_length_f, [ len = peck1 + peck_safe_dist ptimel len = peck_safe_dist ptimer actual_drl_depth = actual_drl_depth + peck1 ] len = (drill_length_f - actual_drl_depth) + peck_safe_dist + peck1 ptimel if initht <> refht, [ len = abs(initht - refht) len = len + abs(initht - depth) ptimer ] else, [ len = abs(refht - depth) ptimer ] if dwell <> zero, total = total + (dwell / 60)

18:G84攻絲距離,時間計算

ptime_drill_3 # Tapping drill_length_f = (abs(refht - depth)) * 2 llen = llen + drill_length_f tot_ltime = tot_ltime + ((drill_length_f / (feed / speed)) / speed) if initht <> refht, [ len = (abs(initht - refht)) * 2 ptimer ] if dwell <> zero, total = total + (dwell / 60)

19:G85,G86,G87鏜孔,鉸孔距離,時間計算

ptime_drill_4 # Bore, feed out, Reaming len = (abs(refht - depth)) * 2 ptimel if initht <> refht, [ len = (abs(initht - refht)) * 2 ptimer ] if dwell <> zero, total = total + (dwell / 60)

20:鉆孔其他類型距離,時間計算

ptime_drill_XY # Moves between additional points sav_gcode = gcode gcode = zero ptime_calc gcode = sav_gcode

21:在psof按如下格式增加

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

22:在ptlchg后按如下格式增加

ptlchg #Tool change ptooldata #Total ending data for tool (Path Length and Times) psetup

23:在pncoutput按如下格式增加

pncoutput #Movement output ptime_calc

24:在pdrlcommonb按如下格式增加

pdrlcommonb #Canned Drill Cycle common call, before ptime_calc

25:在pcancledc按如下格式增加

pcanceldc #Cancel canned drill cycle ptime_calc

26:在peof按如下格式增加

peof #End of file for non-zero tool ptooldata #Total ending data for tool (Path Length and Times) "( *** Path Length/Time *** )", e "( Rapid Path Lengh = ", *rlen_total, punit, ")", e "( Feed Path Length = ", *llen_total, punit, ")", e ttltime = total #Transfer TOTAL program time "( Full Cycle Time = ", ptimeout, " )", e #Program Total time output ttltime = tot_rtime "( Full Rapid Time : ", ptimeout, " )", e ttltime = tot_ltime "( Full Feed Time : ", ptimeout, " )", e

27:公英制判斷

punit # System unit if met_tool$, "mm" else, "In"

申明:以上代碼來自國外網(wǎng)站,非本人原創(chuàng),為了方便大家,搬運過來,其中部分地方進行了修正。

以上就是關于秒到pos機到賬時間段,Mastercam后處理時間源代碼的知識,后面我們會繼續(xù)為大家整理關于秒到pos機到賬時間段的知識,希望能夠幫助到大家!

轉(zhuǎn)發(fā)請帶上網(wǎng)址:http://www.tjfsxbj.com/news/48565.html

你可能會喜歡:

版權聲明:本文內(nèi)容由互聯(lián)網(wǎng)用戶自發(fā)貢獻,該文觀點僅代表作者本人。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如發(fā)現(xiàn)本站有涉嫌抄襲侵權/違法違規(guī)的內(nèi)容, 請發(fā)送郵件至 babsan@163.com 舉報,一經(jīng)查實,本站將立刻刪除。