Mastercam後置處理文件及其設定方法詳細說明

2020-12-25 凡思

Mastercam 後置處理文件及其設定方法詳細說明 mastercam 系統配置的是適應單一類型控制系統的通用後置處理,該後置處理提供了一種功能資料庫模型, 用戶根據數控工具機和數控系統的具體情況,可以對其資料庫進行修改和編譯,定製出適應某一數控工具機的專用後置處理程序。 mastercam 系統後置處理文件的擴展名為 pst ,稱為 pst 文件,它定義了切削加工參數、 nc 程序格式、輔 助工藝指令,設置了接口功能參數等,其結構由八個部分組成: 1. 註解 程序每一 列前有 「#」 符號表示該列為不影響程序執行的文字註解。如: # mi2 -absolute, or incremental positioning 0=absolute 1=incremental 表示 mi2 定義編程時數值給定方式,若 mi=0 為絕對值編程, mi=1 為增量值編程。 在這一部分裡,定義了數控系統編程的所有準備功能 g代碼格式和輔助功能 m代碼格式。 2. 程序糾錯 程序中可以插入文字提示來幫助糾錯,並顯示在屏幕上。如: # error messages (錯誤信息) psuberror # arc output not allowed "error -wrong axis used in axis substitution", e 如果展開圖形捲成旋轉軸時,軸替換出錯,則在程序中會出現上面引號中的錯誤提示。 3. 定義變量的數據類型、使用格式和常量賦值 如規定 g代碼和 m 代碼是不帶小數點的兩位整數,多軸加工中心的旋轉軸的地址代碼是 a、b和 c,圓弧 長度允許誤差為 0.002 ,系統允許誤差為 0.00005 ,進給速度最大值為 10m/min 等。 4. 定義問題 可以根據工具機加工需要,插入一 個問題給後置處理程序執行。 如定義 nc 程序的目錄,定義啟動和退出後置處理程序時的 c-hook 程序名。 5. 字符串列表 字符串起始字母為 s,可以依照數值選取字符串,字符串可以由兩個或更多的字符來組成。 字符串 sg17 ,表示指定 xy 加工平面, nc 程序中出現的是 g17 ,scc1 表示刀具半徑左補償, nc 程序中出現 的是 g41 ,字符串 sccomp 代表刀具半徑補償建立或取消。 6. 自定義單節 可以讓使用者將一個或多個 nc 碼作有組織的排列。 自定義單可以是公式、變量、特殊字符串等: pwcs # g54 + coordinate setting at toolchange if mil >1, pwcs_g54 表示用 pwcs 單節指代 #g54+ 在換刀時坐標設定值, mil 定義為工件坐標系( g54~g59 ) 7. 預先定義的單節 使用者可按照數控程序規定的格式將一個或多個 nc 代碼作有組織的排列,編排成一條程序段。 8. 系統問答 後置處理軟體提出了五組問題,供使用者回答,可按照註解文字、賦值變量、字符串等內容,根據使用的工具機、數控系統進行回答。

設計後置處理文件,一般是按照 nc 程序的結構模塊來進 行。根據 nc 程序的功能,後置處理文件分成六個 模塊如下: 1. 文件頭 文件頭部分設定程序名稱和編號,此外, sinumerik 810d 系統還必須指定 nc 程序存放路徑,並按照以下格 式輸出: 「%_n_ (程序名及編號) _(路徑) 」。 nc 程序可存放在主程序、子程序和工作程序目錄下,擴展名分別為: mpf 、spf 、wpd ,一般放在工作程序 目錄下。因此經修改的 pst 文件格式為: pheader # start of file " %_n_", progname, "_wpd" (程序名、存放目錄) 2. 程序起始 在程序開始,要完成安全設定、刀具交換、工件坐標系的設定、刀具長度補償、主軸轉速控制、冷卻液控制等,並可顯示編程者、編程日期、時間等註解。 修改後的有刀具號 pst 文件開頭格式如下: # start of file for non -zero tool number ...... pspindle (主軸轉速計算) pcom_movbtl (行動裝置) ptoolcomment (刀具參數註解) ...... pbld, n, *sgcode, *sgplane, "g40", "g80", *sgabsinc (快進、 xy 加工平面、取消刀補、取消固定循環、絕對方式編程) if mil <=one, pg92_rtrnz, pg92_rtrn, pg92_g92 (返回參考點) ...... pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfcout, *speed, *spindle, pgear, pcan1 (快進至某位置、坐標系編置、主軸轉速等) pbld, n, pfzout, *tlngno, scool ant, [ if stagetool=one, *next_tool] (安全高度、刀長補償、開冷卻液) pcom_movea (加工過程) 3. 刀具交換 刀具交換執行前,須完成返回參考點、主軸停止動作,然後換刀,接著完成刀具長度補償、安全設定、主軸轉速控制。 pst 文件中用自定義單節 ptlchg 指代換刀過程,編輯修改後的程序如下: ptlchg # tool change ...... ptoolcomment (新刀參數註解) comment (插入註解) if stagetoo l <> two, pbld, n, *t, e (判斷、選刀) n, "m6" (換刀) pindex (輸出地址) pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfcout, *speed, *spindle, pgear, pcan1 (快進至某位置、坐標系偏置、主軸轉速等) pbld, n, pfzout, *tlngno, "m7", [if stagetool=one, *next_tool]

(安全高度、刀長補償號、開冷卻液 ) pcom_movea (加工過程) 4. 加工過程 這一過程是快速移動、直線插補、圓弧插補、刀具半徑補償等基本加工動作。 對於幾乎所有系統,這些加工動作的程序指令基本相同。只是注意 sinumerik 810d 系統的刀具長度補償值 由字母 d後加兩位數字調用,不需要 g43/g44 指令;而半徑補償值則由 g41/g42 調用,不需要再接地址代 碼。用 g40 取消刀具長度和刀具半徑補償。 5. 切削循環 mastercam 軟體提供了 6種內定的孔加工固定循環方式:一般鑽削( drill/cbore )、深孔啄鑽( peck drill )、 斷屑鑽( chip break )、右攻絲( tap )、精鏜孔( bore#1 )、粗鏜孔( bore #2 ),通過雜項選項( misc #1/misc #2 ) 可設定左攻絲、背鏜孔、盲孔鏜孔、盲孔鉸孔等循環,並採用 g73~g89 代碼來表示。 如對於深孔鑽削固定循環, mastercam 採用的格式為: g83 x_y_z_r_q_f ;而 sinumerik 810d 系統用 cycle83 指代深孔鑽削循環,其 nc 程序要求給出循環加工所有參數,輸出格式為: cycle83 (rtp ,rfp ,sdis ,dp ,dp r,fdep ,fdpr ,dam ,dtb ,dts ,frf,vari ) 在 pst 文件中需按 sinumerik 810d 系統格式進行定義、修改和編寫。 6. 程序結尾 程序結尾一般情況下是取消刀補、關冷卻液、主軸停止、執行回參考點,程序停止等動作。下面是修改後的 pst 程序結尾: ptoolend_t #end of tool path, toolchange ...... pbld, n, sccomp, "m5", *scoolant, e (取消刀補、主軸停止、關冷卻液) pbld, n, *sg74, "z1=0. x1=0. y1=0.", e (返回參考點) if mi2=one, pbld, n, *sg74, "x1=0.", "y1=0.", protretinc, e else, protretabs (程序結束) [轉帖 ]例子中文說明 # POST 名稱 : wgkG54 # 類型 : MILL # 工具機名稱 : GENERIC FANUC # 控制器名稱 : GENERIC FANUC # 描述 : GENERIC FANUC 3 AXIS MILL POST # Associated Post : NONE # 車/銑複合 : NO # 4-axis/Axis subs. : NO # 五軸 : NO # 子程序支持 : NO # 自動換刀 : NO # 工作坐標系 : G54 # Executable : MP 8.00 # # # # 這個 POST 支持 FANUC 控制器普通三軸銑床的的 G 代碼輸出, # 不支持自動換刀 ,有最大圓弧報警

# 它來源於 MP -EZ.PST # 是針對 Mastercam Mill V8 的特徵而設計的 # # -------------------------------------------------------------------------- # # Programmers Note: # CNC 05/01/00 - Initial post setup, jce # 2002 -10-11 - 去掉自動換刀, # 2002 -10-12 - 增加中文注釋, # 2002 -10-21 - 增加最大圓弧警告, # 2002 -11-05 - 修改坐標係為 G54 , # ----------- --------------------------------------------------------------- # 特徵 : # -------------------------------------------------------------------------- # # # 下列 Misc.( 雜項 ) 必須使用整數 : # # mi2 - 絕對或增量坐標 at top level # 0 = 絕對 # 1 = 增量 # # mi3 - 選擇 G28 或 G30 來執行 參考點回歸 . # 0 = G28, 1 = G30 # # Canned text: # 在輪廓點裡插入 "cantext". 以允許 /禁止 下列 Mastercam 裡許可的功能, # Entering cantext on a contour point from within Mastercam allows the # following functions to enable/disable. # Cantext 值: # 1 = Stop = 輸出 "M00" 停止碼 # 2 = Ostop = 輸出 "M01" 選擇停止碼 # 3 = Bld on = 在 NC 單節打開 單節刪除碼 () # 4 = bLd off = 在 NC 單節關閉 單節刪除碼 () # # # 鑽孔 : # 在這個 POST 裡支持所有的鑽孔方法 . # # 附加注意事項 : # 1) G54 calls are generated where the work offset entry of 0 = G54, # 1 = G55, etc.

# 2) 由 NCI 變量 "met_tool" 決定是否使 用米制 # # 3) 以增量方式從換刀起始位置計算運動量 . # 起始位置通常定義為所有換刀時刀具所處的最後位置 # Incremental mode calculates motion from home position at toolchanges. # The home position is used to define the last position of the tool # for all toolchanges. # 4) 變量 'absinc' 現已被預先定義 , 設定 mi2 (雜項整數 )以定義 # 絕對 /增量程序輸出 . # # -------------------------------------------------------------------------- # Debugging and Factory Set Program Switches 調試和加工設置程序切換 # -------------------------------------------------------------------------- m_one : -1 #定義常數 zero : 0 #定義常數 one : 1 #定義常數 two : 2 #定義常數 three : 3 #定義常數 four : 4 #定義常數 five : 5 #定義常數 c9k : 9999 #定義常數 fastmode : 1 #Posting 速度最佳化 bug1 : 2 #0= 不顯示 , 1= 普通列表框 , 2= 編輯器 bug2 : -30 #Append postline labels, non -zero is column position? bug3 : 0 #Append whatline no. to each NC line? bug4 : 1 #Append NCI line no. to each NC line? whatno : yes #不執行 whatline branches( 分枝) ? (leave as yes) get_1004 : 1 #Find gcode 1004 with getnextop? rpd_typ_v7 : 0 #Use Version 7 style contour flags/processing? strtool_v7 : 2 #Use Version 7+ toolname? tlchng_aft : 2 #Delay call to toolchange until move line cant_tlchng : 1 #忽視 cantext 入口 on move with tlchng_aft newglobal : 1 #全局變量錯誤檢測 getnextop : 0 #建立下一個變量表 # ------------------------------------------- ------------------------------- # 一般輸出設置 # -------------------------------------------------------------------------- sub_level : 1 #允許自動子程序支持 breakarcs : no #在各象限分割圓弧

arcoutput : 0 #0= IJK ,1= R不帶符號, 2= R (超過 180 度時帶負號) arctype : 2 #圓弧中心 1=abs, 2=St -Ctr , 3=Ctr -St, 4=unsigned inc. arccheck : 1 #檢測小圓弧,轉化為直線 atol : .01 #arccheck=2 時的角度公差 ltol : .002 #arccheck=1 時的長度公差 vtol : .0001 #系統公差 maxfeedpm : 500 #進給速度極限 (英寸 /分鐘 ) ltol_m : .05 #arccheck=1 時的長度公差,米制 vtol_m : .0025 #系統公差,米制 maxfeedpm_m : 10000 #進給速度極 限 毫米 /分鐘 force_wcs : yes #每次換刀時強制輸出 WCS spaces : 1 #各指令之間插入的空格數 omitseq : no #省略序號 seqmax : 9999 #最大序號 stagetool : 0 #0 = 無預先備刀 , 1 = 預備刀具 use_gear : 0 #輸出齒輪交換代碼 ,0=no,1=yes max_speed : 6000 #最大主軸轉速 min_speed : 1 #最小主軸轉速 nobrk : no #Omit breakup of x, y & z rapid moves progname : 1 #使用大寫字母表示程序名 max_arc : 50000 #工具機允許的最大圓弧半徑 # -------------------------------------------------------------------------- # 旋轉軸設定 # -------------------------------------------------------------------------- vmc : 1 # 0 = 臥式 , 1 = 立式 # -------------------------------------------------------------------------- # 允許鑽孔固定循環功能 # -------------------------------------------------------------------------- usecandrill : yes #使用普通鑽孔固定循環 usecanpeck : yes #使用啄式鑽孔固定循環 usecanchip : yes #使用斷屑鑽孔固定循環 usecantap : yes #使用攻螺紋固定循環 usecanbore1 : yes #使用鏜孔固定循環 1 usecanbore2 : yes #使用鏜孔固定循環 2 usecanmisc1 : yes #使用雜項固定循環 1 usecanmisc2 : yes #使用雜項固定循環 2 # -------------------------------------------------------------------------- # 通用自定義變量 初始化(不能改變!) # -------------------------------------------------------------------------- xia : 0 #Formated absolute value for X incremental calculations yia : 0 #Formated absolute value for Y incremental calculations

zia : 0 #Formated absolute value for Z incremental calculations bld : 0 #單節刪除激活 result : 0 #Return value for functions sav_spc : 0 #Save spaces sav_gcode : 0 #Gcode saved sav_absinc : 0 #Absolute/Incremental Saved value sav_coolant : 0 #Coolant saved toolchng : 1 #On a toolchange flag spdir2 : 1 #Copy for safe spindle direction calculation #Drill variables drlgsel : -1 #Drill Select Initialize drillref : 0 #Select drill reference peckacel : 0 #Fractional percent to reduce peck2 when usecan.. : no drlgcode : 0 #Save Gcode in dri ll sav_dgcode : 0 #Drill gcode saved # -------------------------------------------------------------------------- # 格式列表 - n=nonmodal, l=leading, t=trailing, i=inc, d=delta # # -------------------------------------------------------------------------- #定義 英制 /米制 坐標格式列表 fs2 1 0.7 0.6 #小數 , absolute, 7 place, default for initialize ( fs2 2 0.4 l1.3 #小數 , absolute, 4/3 place (x,y,z) fs2 3 0.4 l1.3d #小數 , delta, 4/3 place (i,j,k) #Common format statements fs2 4 1 0 1 0 #整數 , 無前綴 fs2 5 2 0 2 0l #整數 , 強制兩位前綴 fs2 6 3 0 3 0l #整數 , 強制三位前綴 fs2 7 4 0 4 0l #整數 , 強制四位前綴 fs2 9 0.1 0.1 #小數 , absolute, 1 place fs2 10 0.2 0.2 #小數 , absolute, 2 place fs2 11 0.3 0.3 #小數 , absolute, 3 place fs2 12 0.4 0.4 #小數 , absolute, 4 place fs2 13 0.5 0.5 #小數 , absolute, 5 place fs2 14 0.3 0.3d #小數 , delta, 3 place fs2 15 0.2 0.1 #小數 , absolute, 2/1 place fs2 16 1 0 1 0n #整數 , 強制輸出 # 輸出加工類型字符串定義 # --------------------------------------------------------------------------

# 字符串 - 字符串標籤必須由 's' 開頭 ,它們沒有預先指派 # -------------------------------------------------------------------------- #Select operation note sop00 "NULL" # String definition sop01 "CONTOUR" # " " sop02 "CONTOUR" # " " sop03 "DRILL CYCLE" # " " sop04 "POCKET...." # " " sop05 "RULED....." # " " sop06 "2D -SWEPT.." # " " sop07 "3D -SWEPT.." # " " sop08 "REVOLVED.." # " " sop09 "LOFT......" # " " sop10 "COONS....." # " " sop11 "TRIM ....." # " " sop12 "FLOWLINE.." # " " sop13 "SURFACE_FINISH" # " " sop14 "SURFACE_ROUGH" # " " sop15 "POINT....." # " " sop16 "DRILL -5AX." sop17 "CURVE -5AX." sop18 "SWARF -5AX." sop19 "flat MILL" sop20 "op20?....." sopnote # Target string fstrsel sop00 opcode sopnote # -------------------------------------------------------------------------- # NC 輸出的字符串和字符串選擇定義 # -------------------------------------------------------------------------- #Address string definitions 位址串定義 strm "M" strn "N" stro "O" strp "P" srad "R" srminus "R-" sblank

#Cantext 字符串定義 (spaces must be padded here) sm00 "M00" sm01 "M01" strtextno strcantext # -------------------------------------------------------------------------- # 錯誤信息 # ------------ -------------------------------------------------------------- saxiswarn " WARNING -THE RAD OF ARC IS TOO LARGE" # -------------------------------------------------------------------------- # 一般的 G 和 M 代碼串選擇表 General G and M Code String select tables # -------------------------------------------------------------------------- # 運動 G 代碼選擇 sg00 G00 #快速定位 sg01 G01 #直線進給 sg02 G02 #圓弧插補 CW sg03 G03 #圓弧插補 CCW sg04 G04 #暫停 sgcode #Target for string fstrsel sg00 gcode sgcode # ------------------------ -------------------------------------------------- # 選擇工作平面 G 字串 sg17 G17 #XY 平面代碼 sg19 G19 #YZ 平面代碼 sg18 G18 #XZ 平面代碼 sgplane #Target string fstrsel sg17 plane sgplane # ------------------------------------------------------------------------ -- #選擇 英制 /米制 字串 sg20 G20 #英制代碼 sg21 G21 #米制代碼 smetric #Target string fstrsel sg20 met_tool smetric # -------------------------------------------------------------------------- #選擇參考點回歸字串

sg28 G28 #第一參考點回歸 sg30 G30 #第二參考點回歸 sg28ref #Target strin g fstrsel sg28 mi3 sg28ref # -------------------------------------------------------------------------- # 切削補償 G 字串選擇 scc0 G40 #切削補償取消 scc1 G41 #切削左補償 scc2 G42 #切削右補償 sccomp #Target for string fstrsel scc0 cc_pos sccomp # ----------------------- --------------------------------------------------- # 鑽孔固定循環字符串選擇 sg81 G81 #鑽孔 - 無暫停 sg81d G82 #鑽孔 - 有暫停 sg83 G83 #啄式鑽孔 - 無暫停 sg83d G83 #啄式鑽孔 - 有暫停 sg73 G73 #斷屑 - 無暫停 sg73d G73 #斷屑 - 有暫停 sg84 G84 #攻螺紋 - 右手 sg84d G74 #攻螺紋 - 左手 sg85 G85 #鏜孔 #1 - 無暫 停 sg85d G89 #鏜孔 #1 - 有暫停 sg86 G86 #鏜孔 #2 - 無暫停 sg86d G86 #鏜孔 #2 - 有暫停 sgm1 G76 #misc #1 - 無暫停 sgm1d G76 #misc #1 - 有暫停 sgm2 G81 #misc #2 - 無暫停 sgm2d G82 #misc #2 - 有暫停 sgdrill #Target for string fstrsel sg81 drlgsel sgdrill # -------------------------------------------------------------------------- # 選擇增量或絕對 G字符串 sg90 G90 #絕對代碼 sg91 G91 #增量代碼 sgabsinc #Target string fstrsel sg90 absinc sgabsinc # -------------------------------------------------------------------------- #鑽孔固定循環參考高度 sg98 G98 #Z 軸回到起始高度

sg99 G99 #Z 軸回到參考高度 sgdrlref #Target for string fstrsel sg98 drillref sgdrlref # Drill cycle G string select # -------------------------------------------------------------------------- # Generate string for spindle sm04 M04 #主軸反轉 sm05 M05 #主軸停止 sm03 M03 #主軸正轉 spindle #Target for string fstrsel sm04 spdir2 spindle # -------------------------------------------------------------------------- # 冷卻 M 字符串選擇 sm09 M09 #冷卻液 Off sm08 M08 #冷卻液 噴射 sm 08_1 M08 #冷卻液 噴霧 sm08_2 M08 #Coolant Tool scoolant #Target for string fstrsel sm09 coolant scoolant # -------------------------------------------------------------------------- # 定義齒輪選擇代碼 flktbl 1 3 #Lookup table definition - table no. - no. entries 40 0 #底速齒輪檔 41 400 #中速齒輪檔 42 2250 #高速齒輪檔 # -------------------------------------------------------------------------- # 刀具交換 / NC 輸出變量格式 # -------------------------------------------------------------------------- fmt T 4 t #刀具號 fmt T 4 first_tool #第一把使用的刀具 fmt T 4 next_tool #下一把使用的刀具 fmt D 4 tloffno #直徑偏移號 fmt H 4 tlngno #長度偏移號 fmt G 4 g_wcs #WCS G address fmt P 4 p_wcs #WCS P address fmt S 4 speed #主軸轉速 fmt M 4 gear #Gear range # --------------------------------- ----------------------------------------- fmt N 4 n #序號 fmt X 2 xabs #X 坐標輸出

fmt Y 2 yabs #Y 坐標輸出 fmt Z 2 zabs #Z 坐標輸出 fmt X 3 xinc #X 坐標輸出 fmt Y 3 yinc #Y 坐標輸出 fmt Z 3 zinc #Z 坐標輸出 fmt I 3 i #x 軸方向上的圓弧中心描述 fmt J 3 j #y 軸方向上的圓弧中心描述 fmt K 3 k #z 軸方向上的圓弧中心描述 fmt R 2 arcrad #圓弧半徑 fmt F 15 feed #進給率 fmt P 11 dwell #暫停 fmt M 5 cantext #Canned text # -------------------------------------------------------------------------- #Move comment (pound) to output colon with program numbers fmt O 7 progno #Program number #fmt ":" 7 progno #Program number # -------------------------------------------------------------------------- fmt Q 2 peck1 #First peck increment (positive) fmt Q 2 shftdrl #Fine bore tool shift fmt R 2 refht_a #Reference height fmt R 2 refht_i #Reference height # -------------------------------------------------------------------------- fmt "TOOL:" 4 tnote # 注釋格式 fmt " DIA. OFF:" 4 toffnote # 注釋格式 fmt " LEN.:" 4 tlngnote # 注釋格式 fmt " DIA.:" 1 tldia # 注釋格式 # -------------------------------------------------------------------------- # Tool Comment / Manual Entry Section 刀具注釋 /手工輸入部分 # --------------------- ----------------------------------------------------- ptoolcomment #Comment for tool tnote = t toffnote = tloffno tlngnote = tlngno "(", *tnote, *tldia, *sopnote, ")", e pstrtool #Comment for tool if strtool <> sblank, [ strtool = ucase(strtool) *strtool, " " ] pcomment #Comment from manual entry (must call pcomment2 if booleans) pcomment2

pcomment2 #Comment from manual entry scomm = ucase (scomm) if gcode = 1007, "(", scomm, ")" else, "(", scomm, ")", e # -------------------------------------------------------------------------- # 文件起始和刀具交換設置 # -------------------------------------------------------------------------- psof0 #Start of file for tool zero psof psof #Start of file for non -zero tool number toolchng = one if ntools = one, [ #skip single tool outputs, stagetool must be on stagetool = m_one !next_tool ] "%", e *progno, e "(PROGRAM NAME - ", progname, ")", e "(DATE=Day -Month -Year - ", date, " TIME=Hr:Min - ", time, ")", e ptoolcomment pbld, n, *sgcode, *sgplane, "G40", "G49", "G80", "G54", *sgabsinc, *smetric, e sav_absinc = abs inc pcom_moveb absinc = zero pcan1, pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, *zr, *speed, *spindle, pgear, strcantext, e pe_inc_calc ps_inc_calc absinc = sav_absinc pbld, n, sgabsinc, e pretract #刀具路徑末尾,換刀 sav_absinc = absinc absinc = one sav_coolant = coolant

coolant = zero #cc_pos is reset in the toolchange here cc_pos = zero gcode = zero pbld, n, sccomp, *sm05, e absinc = sav_absinc coolant = sav_coolant peof0 #End of file for tool zero peof peof #End of file for non -zero tool pretract comment #Remove pound character to output first tool with staged tools # #if stagetool = one, pbld, n, *first_tool, e n, "M30", e "%", e pwcs #G54+ coordinate setting at toolchange if workofs <> prv_workofs | (force_wcs & toolchng), [ if workofs < 6, [ g_wcs = workofs + 54 *g_wcs ] else, [ p_wcs = workofs - five "G54.1", *p_wcs ] ] !workofs pgear #Find spindle gear from lookup table if use_gear = one, [ gear = frange (one, speed) *gear ]

#換刀設置 pspindle #主軸轉速計算 for RPM speed = abs(ss) if maxss = zero | maxss > max_speed, maxss = max_speed if speed > max_speed, speed = maxss if spee d < min_speed, speed = min_speed spdir2 = fsg3(spdir) pq #Setup post based on switch settings if stagetool = one, bldnxtool = one if arctype = one | arctype = four, [ result = newfs(two, i) result = newfs(t wo, j) result = newfs(two, k) ] else, [ result = newfs(three, i) result = newfs(three, j) result = newfs(three, k) ] pheader #文件開始前調用 if met_tool = one, #米制常量和變量調整 [ ltol = ltol_m vtol = vtol_m maxfeedpm = maxfeedpm_m ] ptoolend #刀具路徑末尾 ,讀取新刀具資料之前 !speed, !spdir2 ptlchg1002 #Call at actual toolchange, end last path here pspindle if gcode = 1000, [ #Null toolchange ] else, [ #Toolchange and Start of file

if gcode = 1002, [ #Actual toolchange pretract ] if stagetool = one, prv_next_tool = m_one prv_xia = vequ(xh) prv_feed = c9k ] # -------------------------------------------------------------------------- # Motion NC output 運動 NC 輸出 # -------------------------------------------------------------------------- #絕對方式輸出的變量為 xabs, yabs, zabs. #增量方式輸出的變量為 xinc, yinc, zinc. # -------------------------------------------------------------------------- prapidout #輸出直線運動的 NC 指令 - 快速 pcan1, pbld, n, sgplane, `sgcode, sgabsinc, pccdia, pxout, pyout, pzout, strcantext , scoolant, e plinout #輸出直線運動的 NC 指令 - 進給 pcan1, pbld, n, sgplane, `sgcode, sgabsinc, pccdia, pxout, pyout, pzout, feed, strcantext, scoolant, e pcirout #輸出圓弧插補的 NC 指令 if arcrad >= max_arc, result = mprint(saxiswarn) pcan1, pbld, n, sgplane, sgcode, sgabsinc, pccdia, pxout, pyout, pzout, parc, feed, strcantext, scoolant, e pcom_moveb #Common motion preparation routines, before pxyzcout ps_inc_calc pncoutput #Movement output pcom_moveb comment pcan if gcode = zero, prapidout if gcode = one, plinout if gcode > one & gcode < four, pcirout pcom_movea

pcom_movea #Common motion preparation routines, after pcan2 pe_inc_calc pdwl_spd #Call from NCI gcode 4 pspindle comment if prv_spdir2 <> spdir2, pbld, n, *sm05, e if prv_speed <> speed | prv_spdir2 <> spdir2, pbld, n, *speed, *spindle, pgear, e pcan if fmtrnd(dwell), pcan1, pbld, n, *sgcode, *dwell, strcantext, e else, pcan1, pbld, n, strcantext, e pcan2 prapid #輸出直線運動的 NC 指令 - 快速 pncoutput pzrapid #輸出直線運動的 NC 指令 - 快速 Z only pncoutput plin #輸出直線運動的 NC 指令 - 進給 pncoutput pz #輸出直線運動的 NC 指令 - 進給 Z only pncoutput pmx #輸出 NCI 向量的 NC 指令 pncoutput pcir #輸出圓弧插補的 NC 指令 pncoutput # -------------------------------------------------------------------------- # Motion output components 運動輸出組成 # -------------------------------------------------------------------------- pbld #Canned text - 單節刪除 if bld, '/' pfbld #強制 - 單節刪除 "/" pccdia #切削補償

#Force Dxx# if prv_cc_pos <> cc_pos & cc_pos, prv_t loffno = c9k sccomp if cc_pos, tloffno pfxout #Force X axis output if absinc = zero, *xabs, !xinc else, *xinc, !xabs pxout #X output if absinc = zero, xabs, !xinc else, xinc, !xabs pfyout #F orce Y axis output if absinc = zero, *yabs, !yinc else, *yinc, !yabs pyout #Y output if absinc = zero, yabs, !yinc else, yinc, !yabs pfzout #Force Z axis output if absinc = zero, *zabs, !zinc els e, *zinc, !zabs pzout #Z output if absinc = zero, zabs, !zinc else, zinc, !zabs parc #選擇圓弧輸出格式 if arcoutput = zero, [ #圓弧輸出為 IJK i, j, k ] else, [ #圓弧輸出 為 R if abs(sweep)<=180 | arcoutput=one, result = nwadrs(srad, arcrad) else, result = nwadrs(srminus, arcrad) *arcrad ]

# -------------------------------------------------------------------------- # Drilling 鑽孔 # -------------------------------------------------------------------------- pdrlcommonb #Canned Drill Cycle common call, before if gcode = 81, [ result = newfs (two, zinc) if drillcyc = three, drlgsel = fsg1( -ss) + drillcyc * two else, drlgsel = fsg2(dwell) + drillcyc * two if initht <> refht, drillref = zero else, drillref = one prv_refht_a = c9k prv_refht_i = c9k ] z = depth prv_zia = initht feed = fr_pos prv_dwell = zero @dwell pcom_moveb comment pcan prdrlout #R drill position refht_a = refht refht_i = refht - initht if absinc = zero, refht_a, !refht_i else, refht_i, !refht_a pdrill #鑽孔固定循環 pdrlcommonb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, dwell, *feed, strcantext, e pcom_movea ppeck #啄式鑽孔固定循環 pdrlcommonb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *peck1, *feed, strcantext, e pcom_movea pchpbrk #斷屑固定循環

pdrlcommonb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *peck1, *feed, strcantext, e pcom_movea ptap #攻螺紋固定循環 pdrlcommonb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *feed, strcantext, e pcom_movea pbore1 #鏜孔固定循環 #1 pdrlcommonb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout , dwell, *feed, strcantext, e pcom_movea pbore2 #鏜孔固定循環 #2 pdrlcommonb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *feed, strcantext, e pcom_movea pmisc1 #Canned Misc #1 Cycle pdrlcom monb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, shftdrl, dwell, *feed, strcantext, e pcom_movea pmisc2 #Canned Misc #2 Cycle (User Option) pdrill pdrill_2 #Canned Drill Cycle, additional points pdrlcommonb pcan1, pbld, n, pxout, pyout, pzout, prdrlout, dwell, feed, strcantext, e pcom_movea ppeck_2 #Canned Peck Drill Cycle pdrill_2 pchpbrk_2 #Canned Chip Break Cycle pdrill_2

ptap_2 #Canned Tap Cycle pdrill_2 pbore1_2 #Canned Bore #1 Cycle pdrill_2 pbore2_2 #Canned Bore #2 Cycle pdrill_2 pmisc1_2 #Canned Misc #1 Cycle pdrill_2 pmisc2_2 #Canned Misc #2 Cycle pdrill_2 pdrlcst #自定義鑽孔循環 8 - 19 (user opti on) #Use this postblock to customize drilling cycles 8 - 19 pdrlcommonb "CUSTOMIZABLE DRILL CYCLE ", pfxout, pfyout, pfzout, e pcom_movea pdrlcst_2 #自定義鑽孔循環 8 - 19, additional points (user option) #Use this postblock to customize drilling cycles 8 - 19 pdrlcommonb "CUSTOMIZABLE DRILL CYCLE ", pfxout, pfyout, pfzout, e pcom_movea pcanceldc #Cancel canned drill cycle result = newfs (three, zinc) z = initht prv_zia = initht pxyzcout !zabs, !zinc prv_gcode = zero pbld, n, "G80", e # -------------------------------------------------------------------------- # Canned Text # -------------------------------------------------------------------------- pcan #Canned text - before output call strcantext = sblank if cant_no > zero, [ if cant_pos1 = zero, pcant_1

if cant_pos2 = zero, pcant_2 if cant_pos3 = zero, pcant_3 if cant_pos4 = zero, pcant_4 if cant_pos5 = zero, pcant_5 if cant_pos6 = zero, pcant_6 if cant_pos7 = zero, pcant_7 if cant_pos8 = zero, pcant_8 if cant_pos9 = zero, pcant_9 if cant_pos10 = zero, pcant_10 pbld, n, strcantext, e strcantext = sblank ] pcan1 #Canned text - with move strcantext = sblank if cant_no > zero, [ if cant_pos1 = one, pcant_1 if cant_pos2 = one, pcant_2 if cant_pos3 = one, pcant_3 if cant_pos4 = one, pcant_4 if cant_pos5 = one, pcant_5 if cant_pos6 = one, pcant_6 if cant_pos7 = one, pcant_7 if cant_pos8 = one, pcant_8 if cant_pos9 = one, pcant_9 if cant_pos10 = one, pcant_10 ] if cstop, strcantext = strcantext + sm00 if cgstop, strcantext = strcantext + sm01 #Output of strcantext occurs at the end of the output line pcan2 #Canned text - after output call strcantext = sblank if cant_n o > zero, [ if cant_pos1 = two, pcant_1 if cant_pos2 = two, pcant_2 if cant_pos3 = two, pcant_3 if cant_pos4 = two, pcant_4 if cant_pos5 = two, pcant_5 if cant_pos6 = two, pcant_6 if cant_pos7 = two, pcant_7 if cant_pos8 = two, pcant_8

if cant_pos9 = two, pcant_9 if cant_pos10 = two, pcant_10 pbld, n, strcantext, e strcantext = sblank ] pcant_1 #Canned text - output call can text = cant_val1 pcant_out pcant_2 #Canned text - output call cantext = cant_val2 pcant_out pcant_3 #Canned text - output call cantext = cant_val3 pcant_out pcant_4 #Canned text - output call cantext = cant_v al4 pcant_out pcant_5 #Canned text - output call cantext = cant_val5 pcant_out pcant_6 #Canned text - output call cantext = cant_val6 pcant_out pcant_7 #Canned text - output call cantext = cant_val7 pcant_out pcant_8 #Canned text - output call cantext = cant_val8 pcant_out pcant_9 #Canned text - output call cantext = cant_val9 pcant_out pcant_10 #Canned text - output call cantext = cant_val10

pcant_out pcant_out #Canned text - build the string for output #Assign string select type outputs if cantext = three, bld = one if cantext = four, bld = zero #Build the cantext string if cantext = one, strcantext = strcantext + sm00 if cantext = two, strcantext = strcantext + sm01 if cantext > four, [ strtextno = no2str(cantext) strcantext = strcantext + strm + strtextno ] # ------------------------------------------------------- ------------------- # 坐標計算,通常不需要修改 # -------------------------------------------------------------------------- pxyzcout #Map coordinates xabs = vequ (x) feed = fr_pos if feed > maxfeedpm, feed = maxfeedpm #Incremental calcu lations ps_inc_calc #Incremental calculations, start xia = fmtrnd(xabs) yia = fmtrnd(yabs) zia = fmtrnd(zabs) xinc = vsub (xia, prv_xia) pe_inc_calc #Incremental calculations, end !xia, !yia, !zia !x, !y, !z # -------------------------------------------------------------------------- # Numbered questions for Mastercam Version 8 # -------------------------------------------------------------------------- 38. 快速進給率 ? 300.0 #76. 配置文件名 ? 80. 接收和發送的通信 埠號 (1 or 2) ? 2 81. 傳輸速率 (110,150,300,600,1200,2400,4800,9600,14400,19200,38400)? 9600 82. 奇偶校驗 (E/O/N)? E

83. 數據位 (7 or 8)? 7 84. 停止位 (1 or 2)? 2 85. Strip line feeds? N 86. 每行末延遲(秒) ? 0 87. Ascii, Eia, or Binary (A/E/? A 88. Echo keyboard to scre en in terminal emulation? n 89. Strip carriage returns? N 90. NC 和材料文件所處的磁碟和目錄 ? 91. 執行的後置處理器名 ? MP 92. 反向處理器名 (nic ->nc)? RP 93. 反向處理 PST 文件名 ? RPFAN 100. 序號之小數點前的位數 ? 3 101. 序號之小數點後的位數 ? 0 103. 最大的主軸轉數 ? 6000 107. 換刀平均時間 (seconds)? 2.0 #110. 默認的刀具庫 ? TOOL S.TL8 158. 挖槽精加工時使用磨損補償 ? n 159. Compensate the first and last point in cutter comp. in control simulation? y 160. Display first and last entity in toolpath when simulating cutter compensation in control? y 161. 打開機械原點按鈕 ? y 162. 打開參考點按鈕 ? y 163. 打開雜項變數 按鈕 ? y 164. 打開旋轉軸按鈕 ? n 165. 打開刀具平面按鈕 ? y 166. 打開構圖平面按鈕 ? y 167. 打開刀具顯示按鈕 ? y 168. Check tplane during automatic work origin creation? y #在自動工作原點建立時檢查刀具平面 # -------------------------------------------------------------------------- # 定義雜項實數值 # -------------------------------------------------------------------------- 201. Default miscellaneous real variable 1 (mr1)? 0.0 202. Default miscellaneous real variable 2 (mr2)? 0.0 203. Default miscellaneous real variable 3 (mr3)? 0.0 204. Default miscellaneous real variable 4 (mr4)? 0.0 205. Default miscellaneous real variable 5 (mr5)? 0.0 206. Default miscellaneous real variable 6 (mr6)? 0.0 207. Default miscellaneous real variable 7 (mr7)? 0.0 208. Default miscellaneous real variable 8 (mr8)? 0.0 209. Default miscellaneous real variable 9 (mr9)? 0.0 210. Default miscellaneous real variable 10 (mr10)? 0.0 # --------------------------------------------------------------------------

# 定義雜項整數值 # ------------------------------------------------ -------------------------- 301. 工作坐標系 [0-1=G92, 2=G54's] (mi1)? 2 302. 絕對或增量 [0=ABS, 1=INC] (mi2)? 0 303. 參考點回歸 [0=G28, 1=G30] (mi3)? 0 304. 雜項整數變量 4 (mi4)? 0 305. 雜項整數變量 5 (mi5)? 0 306. 雜項整數變量 6 (mi6)? 0 307. 雜項整數變量 7 (mi7)? 0 308. 雜項整數變量 8 (mi8)? 0 309. 雜項整數變量 9 (mi9)? 0 310. 雜項整數變量 10 (mi10)? 0 # -------------------------------------------------------------------------- # 配置文件關聯參數 (預設為 "y") # -------------------------------------------------------------------------- #400. 關聯的配置文件名 ? 401. 讀取系統顏色部分 ? y 402. 讀取配置部分地區 ? y 403. 讀取公差部分 ? y 404. 讀取資料路徑部分 ? y 405. 讀取通信部分 ? y 406. 讀取繪圖設置部分 ? y 407. 讀取雜項部分 ? y 408. 讀取 NC -設置部分 ? y 409. 讀取 DIALOG SCRIPTS 部分 ? y 410. 讀取 DESIGN 設置部分 ? y 411. 讀取列印設置部分 ? y 412. 讀取 ALT -KEY 分配部分 ? y 413. 讀取 CAD 部分 ? y 414. 讀取 載入 /離開 部分 ? y 415. 讀取 螢屏 部分 ? y 416. 讀取文件名部分 ? y 1500. Chook to execute from 'Misc. values' button? y 1501. 插入參數信息到 ascii NCI? n 1502. 寫入操作信息到二進位文件 (.ops)?

相關焦點

  • Mastercam 2019 CAD/CAM模具加工軟體
    Mastercam 2019是mastercam軟體的新版本,也是一款世界知名的CAD/CAM軟體,擁有設計、實體建模、2D/3D銑削、車削、車銑複合、線切割、木工、雕刻等多個模塊,可以為航空航天、汽車、船舶、醫療等先進位造業及電器、輕工產品和模具等傳統製造行業量身定製了多種CAD/CAM解決方案。
  • Python中的文件處理–為初學者學習Python文件處理
    寫入文件write()方法用於將字符串寫入文件。Python讀取功能的語法:例:j=open(「intellipaat.txt」,」r」)k=j.read()print(k)輸出:Python中的文件處理方法Python中有不同的文件處理,如下所示:import
  • C/C+中的頭文件及其用法詳細說明書
    這些預處理器指令用於指示編譯器在編譯之前需要處理這些文件。 在C程序中,必須包含頭文件,該頭文件分別代表標準輸入和用於分別藉助scanf()和printf()函數進行輸入的輸出。 在C ++程序中具有頭文件代表分別使用「 cin」和「 cout」進行輸入的輸入和輸出流。
  • Mastercam2020軟體+安裝教程
    2.打開解壓完的安裝包找到"mastercam2020-web"文件  雙擊運行13.複製文件夾內的這個文件夾及文件15.滑鼠選擇「打開文件位置」16.將複製的文件 粘貼在安裝的根目錄20.再次返回上一步文件夾中,找到「inctall」文件 滑鼠右鍵點擊選擇「以管理員身份運行」
  • 《桌面萌娘MMD》怎麼導入VMD動作文件 導入VMD動作文件方法說明
    桌面萌娘MMD怎麼導入VMD動作文件?想來很多朋友都還不是很清楚吧,所以呢小編今天給大家帶來的就是桌面萌娘MMD導入VMD動作文件方法說明,需要的朋友不妨進來看看。
  • Python利用openpyxl處理Excel文件(Excel文件基本操作)
    上一篇,我們簡要介紹了openpyxl及其安裝過程,這一篇我們學習使用openpyxl處理Excel的具體過程,力爭涵蓋大多數官方文檔中相關內容,對這一知識點進行簡單的匯總。一、學習目標(一)openpyxl的具體使用。
  • 【每日小知識】3 PHP文件上傳方法詳解及其信息解析
    ,下面我們通過具體的代碼實例給大家詳細解說。那麼在還沒有設置方法對文件進行判斷時,直接通過瀏覽器訪問出現的效果如下圖:提示:error表示的是錯誤信息說明,這裡的錯誤號為0,即表示上傳的文件沒有任何錯誤。但是在PHP手冊中,錯誤號不止為0 。
  • 初中英語語法,後置定語用法的詳細總結
    結合多年的英語教學實踐,給我的學生們總結了後置定語的用法,今天藉助百家號「人生底色看語文」這個平臺,分享給更多需要的朋友們。我們先說說什麼叫做定語?用漢語來理解就是表示「……的」。比如說「一個漂亮的女孩」,「漂亮的」就是形容詞作定語,用來修飾名詞「女孩」。然而在英語中定語又分為前置定語和後置定語。
  • VBA代碼大全010:用vba遍歷文件夾及其子文件夾內的文件
    循環處理多個單元格的內容,循環處理多個工作表的內容,循環處理多個工作簿的內容。其中又以循環處理多個文件最為頻繁,一個excel工作簿內的內容循環有些人還可以藉助函數來實現,但是涉及到多個文件的循環處理時,用函數就顯得無力回天,這時候就需要祭出vba大招了。
  • 開關電容濾波器前置、後置濾波器的設計
    摘要:如何為開關電容濾波器(SCF)合理配置前置、後置濾波器,一直缺少系統的分析和說明。在研究SCF工作特性的基礎上,提出了SCF前置、後置濾波器的設計方法。SFC前置、後置濾波器的主要設計參數是轉角頻率和衰減量。設計時,先根據系統要求確定衰減量,再根據選定的濾波器結構的衰減係數確定轉角頻率。
  • C++庫文件說明及使用方法
    動態連結:佔用空間小,庫方法更新只需要更換DLL,擴展性和靈活性強3.靜態庫生成及使用方法靜態連結庫生成方式:以創建test.lib為例1.新建頭文件、源文件在創建的工程中,打開解決方案資源管理器。在源文件下創建test.cpp,頭文件下創建test.h,添加對應的代碼。
  • Spring Boot 配置文件的多環境實現
    至於CloudFoundryVcapEnvironmentPostProcessor的具體作用主要是對於spring-cloud的支持,我們等到後續用到時再做詳細的了解。應用環境準備就緒事件中,走了一遍各個環境後置處理器的後置處理方法,需要注意的是,CongifFileApplicationListener本身也實現了 EnvironmentPostProcessor,所以,它自身的postProcessEnvironment方法也會執行。
  • 空氣壓縮機的前置過濾器與後置過濾器有什麼區別?
    螺杆式空壓機的後處理設備,主要由儲氣罐、乾燥機及過濾器組成。而在過濾器部分中,又分為前置過濾器和後置過濾器,一般是由乾燥機隔開,壓縮空氣從機組排出到儲氣罐、到前置過濾器、到乾燥機、再到後置過濾器,完成過濾和乾燥等淨化處理。
  • 痞子衡嵌入式:JLink Script文件基礎及其在IAR下調用方法
    今天痞子衡給大家分享的是JLink Script文件基礎及其在IAR下調用方法。JLink可以說是MCU開發者最熟悉的調試工具了,相比於其他調試器(比如DAPLink、ST-LINK、I-jet等),JLink除了性能強大之外,還勝在其配套各種軟體小工具相當方便易用。
  • excel數據處理技巧:提取文件名的方法匯總
    前段時間我們和大家分享了使用BAT命令提取文件名稱的方法,不少小夥伴都被這個命令給驚豔到了。其實,提取文件名稱的方法遠不止這一種,甚至還有比BAT命令更簡單的方法,趕緊來看看吧!學習更多技巧,請收藏部落窩教育excel圖文教程。
  • Python讀入文件報錯的處理方法
    文章導讀:本文主要 解決python在讀入文件時的報錯:ParserError:Error tokenizing data.C error:Expected x fields in line nnn,saw y。文章分為兩部分,第一部分解釋報錯的意思,定位原因;第二部分給出解決方法。
  • 詳細說明網站出現500錯誤的解決方案
    在之前也說過關於如何處理403錯誤頁面、502錯誤頁面以及其他的錯誤頁面的文章。那麼,網站出現500錯誤該如何處理呢?下面給大家來仔細分析下!詳細說明網站出現500錯誤的解決方案一、查看詳細信息實際上,網站出現500錯誤頁面也會分為很多種情況,只有當我們知道問題出現在哪裡才能夠去糾正網站出現的問題
  • 使用文件對象讀取Python文件內容
    文件對象提供了三種讀取文件內容的方法,分別是read、readline、readlines。其中read方法即可以讀取文本文件也可以讀取二級制文件,readline和readlines方法只能讀取文本文件。下面分別予以說明。
  • 指針、結構體、編譯預處理和文件
    之前學過數據類型比如整數型,實數型等等,這是一類型的數據類型,但是處理複雜的數據關係的時候,需要在程序裡面能夠簡單表示,這就需要結構體類型,這種類型的意思就是把各種單一的數據類型包含在一個自定義的名稱裡面,用這個自定義的結構體類型來表示各種不同類型的數據。