mastercam9.1改后处理怎么改后处理能让它关闭刀具转速s输出呢

当前位置: >>
MasterCAM后处理设置教程
Mastercam 软件的后置处理文件及其设定方法 一、前言 Mastercam 是一套应广泛的CAD/CAM/CAE软件包,它采用图形义互 式自动编程方法实现NC程序的编制。义互式编程是一种人机对话的编程方法,编程人员根据屏幕提示的内容, 反复与计算机对话,选择菜单目录或计算机的提问,将所有的问题回答完毕后即可以生生成NC程序。NC程 序的自动产生是受软件的后置处理功能控制的,
不同的加工模块(如车削、铣削、线切割等)和不同的数控系 统对应于不同的后处理文件。软件当前使用哪一个后处理文件,是在软件安装时设定的,而在具体应用软件进 行编程之前,一般还需要对当前的后处理文件进行必要的修改和设定,以使其符合系统要求和使用者的编程习 惯。有些用户在使用软件 时由于不了解情况,没有对后处理文件进行修改,导致生成的NC程序中某些固定的 地方经常出现一些多余的内容,或者总是漏掉某些词句,这样,在将程序传入数控机床之前,就必须对程序进 行手工修改,如果没有全部更正,则可能造成事故。例如,某机床的控制系统采用G54工件坐标系定位,G 90绝对坐标编程,要求生成的NC程序前面必须有G54G90设置,如果后处理文件的设置为G55G9 1,则每次生成的程序中含有G55G91,却不一定有G54G90,如果在加工时没有进行手工改正,则 势必造成加工错误。 二、Mastercam 软件的后置处理文件 后置处理文件简称后处理文件,是一种可以由用户以回答问题的形式自行修改的文件,其扩展名为.PS T。在应用Mastercam 软件的自动编程功能之前,必须先对这个文件进行编辑,才能在执行后处理程序时产生 符合某种控制器需要和使用者习惯的NC程序,也就是说后处理程序可以将一种控制器的NC程序定义成该控 制器所使用的格式。以FANUC系列的后处理为例,它既可以定义成惯用于FANUC 格式,也可以定义成FANUC 1.Annotation(注释) 2.问题 3M控器所使用的 6M控制器所使用的格式,但不能用来定义其它系列的控制器。 对后处理文件及其设定方法作一般性介绍。不同系列的后处理文件在内容上略有不同,但其格式及主体部分是相似的,一般都包括以下几个部分。 该部分为后处理文件的主要部分,FANUC系列的后处理文件中共包括200个问题,对 指令的作用是对它后面的变量施加影响。如 oldvars 和 newvars 指令,在回答问这些问题的回答将决定将来输出的NC程序的格式。 3.Commands(指令) 所使用的刀具号码。 4.Variables(变量) 给出了"问题"中所使用的各种变量的定义.FANUC系列的后处理文件中共 定义了26个变量,如 prog-n=程序号码,f=进给率,s=主轴转速,t=刀具号码等。 三、后处理文件的设定方法 1.后处理文件编辑的一般规则 对后处理文件的编辑和设定只需要对第(4)部分的&问题&进行回答。PST文件的每个问题前都有一个 号码并在号码后加一个小数点。若问题前没有号码,那么这个问题在执行后处理时是被忽略不用的。回答号码 20以前的问题时,需要在问题的下一行键入所回答的文字,而且回答的内容可以包括多行,20号以后问题 均带有问号且回答时直接写在问号的后面,不得换行,这一类的问题常常是以&y&&n&来回答。回答问题时用到 变量,不能用引号,而字符串则必须包围在引号之中(如&G91 将按字符串的原样写入程序中。变量和字符之间要用逗号隔开。 2.变量的使用 变量的定义在后处理文件的开头部分已经作了说明,使用时可通过查阅来了解变量的意义。变量在回答问 题时一经使用,就会在生产的NC程序中表达确定的意义。如变量 spindle-on,转速为正或0时定义为M03, 为负时定义为M04,如果回答问题时使用了该变量,则会在NC程序的相应部分写出M03或M04。变量 prog-n 若写到问题1或2中,将对在NC程序规划时给定的程序中起作用。变量First-tool 用来呼叫程序中 所使用中的第一把刀的号码,此变量通常用于程序结束时将使用中的刀具改变为第一把刀的号码,以便在下一 次执行程序时使用。next-tool 用于无T字首的刀具号码,使用这个变量可在刀具被呼叫前,选择另一把刀来 进行换刀。变量 xr、 yr、zr 是用来定义程序中快速定位的X、Y、Z坐标位置,通常用于换刀和程序结束时 G28 GZ0M05&),引号中的文字 题3时若写于刀具号码变量 t 之前,则使用 oldvars 时将呼叫前一把刀具的号码,使用 newvars 时将呼叫现在 使刀具返回机械原点。prev-x、prev-y、prev-z 则是用来定义刀具所在的前一个X、Y、Z坐标的位置。其它 变量的定义可参看文件开头的说明。 3.后处理文件的设置方法 后处理文件中的大部分问题一般不需要作修改,使用时,通常办需对其中固定的某几个问题进行编辑。下面以 FANUC系列的.PST文件为例,来说明设定的方法。 (1)问题0的回答要用字符串,对于FANUC控制系统设置为&%&。 (2) 以问题2的回答以例说明2、 4、 5问题的回答方法。 假设在设定NC参数时所给的程序名为 test1, 程序号为1234, 顺序号开始号码为100且增量值为2, 刀具号为01, 主轴转速为1500/mim, 则.PST 文件格式及产生的NC程序对照台下。 .PST 文件格式 NC 程序 prog_mane test1 prog_n 1234 N,&G90 G54 G49 G40& N100 G90 G54 G49 G40 N,&G00 X0 Y0& N102 G00 X0Y0 N,&M06& M104 M06 T01 N,S,spindle_on N106 s1500 M03 (3)问题6是用来设定当铣削状态改变面刀具号码并不改变时,其使用的变量与问题2、4、5中所使用的 变量相同。 (4)问题7、8、9控制NC参数屏幕中Text1、2、3所设定的文字。 (5)问题36要求规定进给速度值小数点后允许的位数,若写-1时则为整数。 (6)问题37高定的比例因数可使写到NC程序中的进给速度按此因数变化。 (7)问题38中要求设置快速进给速率的大小。 (8)问题42是若设定为 e(表示圆弧插补指令中用R程序)时,问题53必须回答&Y&,则系统在后处 理时将自动大于180?圆弧打断为两段。 (9)问题50~55是使用权控制器中的 cannedcycles 指令(G81~G89)被使用于NC程序中。 (10)问题70是用来设定几何图形中线与线或线与圆弧之间的精确度,使其值保证连接外形时能自动 连接。 (11)问题81~89是用于NC程序与数控机床传输与接受时的对数设定。 (12)当使用者在换马中使用权用 next_tool 变量时,问题120应回答为&Y&。当后处理系统执行时, 电脑首先必须做一个刀具表,否则电脑无法了解在换刀要用到次一把刀时,什么刀具要来到一把刀的位置。 (13)问题190~196是用于设定刀具路径显示时的内定值。 (14)问题201~510中的杂项变量是在线切割后处理系统中使用的。 四、结束语 后置处理文件的编辑和设定,对CAD/CAM软件来说都是需要的。但是一般的使用者经常忽略这一点, 面是在每次生成NC程序后去对程序进行修改,不仅浪费时间,而且容易出错导致事故。本文对 Mastercam 软 伯的后处理文件进行了分析和讨论,介绍了其编辑和设定的方法。 ------------------------------------------------------# POST 名称 # 类型 # 机床名称 # 控制器名称 # 描述 # Associated Post # 车/铣复合 # 4-axis/Axis subs. : wgkG54 : MILL : GENERIC FANUC : GENERIC FANUC : GENERIC FANUC 3 AXIS MILL POST : NONE : NO : NO # 五轴 # 子程序支持 # 自动换刀 # 工作坐标系 # Executable # # #: NO : NO : NO : G54 : MP 8.00# 这个 POST 支持 FANUC 控制器普通三轴铣床的的 G 代码输出, # 不支持自动换刀,有最大圆弧报警 # 它来源于 MP-EZ.PST # 是针对 Mastercam Mill V8 的特征而设计的 # # # 欢迎各位试用此后处理程序,提供意见反馈, # 地址: 福建漳州新华北路 56 号 # E-MAIL:
力佳股份有限公司 吴桂凯 # 电话:
(19:00-23:30)# -------------------------------------------------------------------------# 修改日志: # -------------------------------------------------------------------------# Programmers Note: # CNC 05/01/00 # # # #
Initial post setup, jce 去掉自动换刀,吴桂凯 增加中文注释,吴桂凯 增加最大圆弧警告,吴桂凯 修改坐标系为 G54,吴桂凯# -------------------------------------------------------------------------# 特征: # -------------------------------------------------------------------------# # # 下列 Misc.(杂项) 必须使用整数: # # mi2 - 绝对或增量坐标 at top level # # # # mi3 - 选择 G28 或 G30 来执行参考点回归. # # # Canned text: # 在轮廓点里插入&cantext&.以允许/禁止 下列 Mastercam 里许可的功能, 0 = G28, 1 = G30 0 = 绝对 1 = 增量 # # # # # # # # #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, # # # 3) 以增量方式从换刀起始位置计算运动量. # # # # # # # -------------------------------------------------------------------------# Debugging and Factory Set Program Switches m_one zero one two three four five c9k fastmode bug1 bug2 bug3 bug4 whatno get_1004 : -1 : 0 : 1 : 2 : 3 : 4 : 5 : 9999 : 1 : 2 : -30 : 0 : 1 : yes : 1 #定义常数 #定义常数 #定义常数 #定义常数 #定义常数 #定义常数 #定义常数 #定义常数 #Posting 速度最佳化 #0=不显示, 1=普通列表框, 2=编辑器 #Append postline labels, non-zero is column position? #Append whatline no. to each NC line? #Append NCI line no. to each NC line? #不执行 whatline branches(分枝)? (leave as yes) #Find gcode 1004 with getnextop? 调试和加工设置程序切换 # -------------------------------------------------------------------------起始位置通常定义为所有换刀时刀具所处的最后位置 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. 绝对/增量程序输出. 1 = G55, etc. # 2) 由 NCI 变量&met_tool&决定是否使用米制# 4) 变量 'absinc' 现已被预先定义, 设定 mi2 (杂项整数)以定义 rpd_typ_v7 strtool_v7 tlchng_aft newglobal getnextop: 0 : 2 : 2 : 1 : 0#Use Version 7 style contour flags/processing? #Use Version 7+ toolname? #Delay call to toolchange until move line #忽视 cantext 入口 on move with tlchng_aft #全局变量错误检测 #建立下一个变量表cant_tlchng : 1# -------------------------------------------------------------------------# 一般输出设置 : 1 : no : 0 : 2 : 1 : .01 : .002 : .0001 : 500 : .05 : .0025 : yes : 1 : no : 9999 : 0 : 0 : 6000 : 1 : no : 1 : 50000 #允许自动子程序支持 #在各象限分割圆弧 #0= IJK,1= R 不带符号,2= R (超过 180 度时带负号) #圆弧中心 1=abs, 2=St-Ctr, 3=Ctr-St, 4=unsigned inc. #检测小圆弧,转化为直线 #arccheck=2 时的角度公差 #arccheck=1 时的长度公差 #系统公差 #进给速度极限 (英寸/分钟) #arccheck=1 时的长度公差,米制 #系统公差,米制 #进给速度极限 毫米/分钟 #每次换刀时强制输出 WCS #各指令之间插入的空格数 #省略序号 #最大序号 #0 = 无预先备刀, 1 = 预备刀具 #输出齿轮交换代码,0=no,1=yes #最大主轴转速 #最小主轴转速 #Omit breakup of x, y & z rapid moves #使用大写字母表示程序名 #机床允许的最大圆弧半径 # -------------------------------------------------------------------------sub_level breakarcs arcoutput arctype arccheck atol ltol vtol maxfeedpm ltol_m vtol_m force_wcs spaces omitseq seqmax stagetool use_gear max_speed min_speed nobrk progname max_arcmaxfeedpm_m : 10000# -------------------------------------------------------------------------# vmc 旋转轴设定 : 1 # 0 = 卧式 , 1 = 立式 # --------------------------------------------------------------------------# -------------------------------------------------------------------------# 允许钻孔固定循环功能 #使用普通钻孔固定循环 #使用啄式钻孔固定循环 #使用断屑钻孔固定循环 #使用攻螺纹固定循环 # -------------------------------------------------------------------------usecandrill : yes usecanpeck usecanchip usecantap : yes : yes : yes usecanbore1 : yes usecanbore2 : yes usecanmisc1 : yes usecanmisc2 : yes#使用镗孔固定循环 1 #使用镗孔固定循环 2 #使用杂项固定循环 1 #使用杂项固定循环 2# -------------------------------------------------------------------------# 通用自定义变量初始化(不能改变!) # -------------------------------------------------------------------------xia yia zia bld result sav_spc sav_gcode sav_absinc toolchng spdir2 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 1 : 1 #Formated absolute value for X incremental calculations #Formated absolute value for Y incremental calculations #Formated absolute value for Z incremental calculations #单节删除激活 #Return value for functions #Save spaces #Gcode saved #Absolute/Incremental Saved Value #Coolant saved #On a toolchange flag #Copy for safe spindle direction calculationsav_coolant : 0#Drill variables drlgsel drillref peckacel drlgcode sav_dgcode : -1 : 0 : 0 : 0 : 0 #Drill Select Initialize #Select drill reference #Fractional percent to reduce peck2 when usecan.. : no #Save Gcode in drill #Drill gcode saved# -------------------------------------------------------------------------# 格式列表 - n=nonmodal, l=leading, t=trailing, i=inc, d=delta # # -------------------------------------------------------------------------#定义 英制/米制 坐标格式列表 fs2 1 fs2 2 fs2 3 0.7 0.6 0.4 l1.3 0.4 l1.3d #小数, absolute, 7 place, default for initialize (:) #小数, absolute, 4/3 place (x,y,z) #小数, delta, 4/3 place (i,j,k)#Common format statements fs2 4 fs2 5 fs2 6 fs2 7 fs2 9 fs2 10 fs2 11 1 0 1 0 2 0 2 0l 3 0 3 0l 4 0 4 0l 0.1 0.1 0.2 0.2 0.3 0.3 #整数, 无前缀 #整数, 强制两位前缀 #整数, 强制三位前缀 #整数, 强制四位前缀 #小数, absolute, 1 place #小数, absolute, 2 place #小数, absolute, 3 place fs2 12 fs2 13 fs2 14 fs2 15 fs2 160.4 0.4 0.5 0.5 0.3 0.3d 0.2 0.1 1 0 1 0n#小数, absolute, 4 place #小数, absolute, 5 place #小数, delta, 3 place #小数, absolute, 2/1 place #整数, 强制输出# 输出加工类型字符串定义 # -------------------------------------------------------------------------# 字符串 - 字符串标签必须由 's' 开头,它们没有预先指派 # -------------------------------------------------------------------------#Select operation note sop00 sop01 sop02 sop03 sop04 sop05 sop06 sop07 sop08 sop09 sop10 sop11 sop12 sop13 sop14 sop15 sop16 sop17 sop18 sop19 sop20 &NULL& &CONTOUR& &CONTOUR& &DRILL CYCLE& &POCKET....& &RULED.....& &2D-SWEPT..& &3D-SWEPT..& &REVOLVED..& &LOFT......& &COONS.....& &TRIM .....& &FLOWLINE..& &SURFACE_FINISH& &SURFACE_ROUGH& &POINT.....& &DRILL-5AX.& &CURVE-5AX.& &SWARF-5AX.& &flat MILL& &op20?.....& # String definition # # # # # # # # # # # # # # # & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &sopnote fstrsel# Target string sop00 opcode sopnote# -------------------------------------------------------------------------# NC 输出的字符串和字符串选择定义 # -------------------------------------------------------------------------#Address string definitions strm &M& 位址串定义 strn stro strp srad srminus sblank&N& &O& &P& &R& &R-&#Cantext 字符串定义 (spaces must be padded here) sm00 sm01 strtextno strcantext # -------------------------------------------------------------------------# 错误信息 & WARNING-THE RAD OF ARC IS TOO LARGE& # -------------------------------------------------------------------------saxiswarn &M00& &M01&# -------------------------------------------------------------------------# 一般的 G 和 M 代码串选择表 # 运动 G 代码选择 sg00 sg01 sg02 sg03 sg04 sgcode G00 G01 G02 G03 G04 #快速定位 #直线进给 #圆弧插补 CW #圆弧插补 CCW #暂停 #Target for string General G and M Code String select tables # --------------------------------------------------------------------------fstrsel sg00 gcode sgcode # -------------------------------------------------------------------------# 选择工作平面 G 字串 sg17 sg19 sg18 sgplane G17 G19 G18 #XY 平面代码 #YZ 平面代码 #XZ 平面代码 #Target stringfstrsel sg17 plane sgplane # -------------------------------------------------------------------------#选择 英制/米制 字串 sg20 sg21 smetric G20 G21 #英制代码 #米制代码 #Target stringfstrsel sg20 met_tool smetric # -------------------------------------------------------------------------#选择参考点回归字串 sg28 sg30 sg28ref G28 G30 #第一参考点回归 #第二参考点回归 #Target stringfstrsel sg28 mi3 sg28ref # -------------------------------------------------------------------------# 切削补偿 G 字串选择 scc0 scc1 scc2 sccomp G40 G41 G42 #切削补偿取消 #切削左补偿 #切削右补偿 #Target for stringfstrsel scc0 cc_pos sccomp # -------------------------------------------------------------------------# 钻孔固定循环字符串选择 sg81 sg81d sg83 sg83d sg73 sg73d sg84 sg84d sg85 sg85d sg86 sg86d sgm1 sgm1d sgm2 sgm2d sgdrill G81 G82 G83 G83 G73 G73 G84 G74 G85 G89 G86 G86 G76 G76 G81 G82 #钻孔 #钻孔 #啄式钻孔 #啄式钻孔 #断屑 #断屑 #攻螺纹 #攻螺纹 #镗孔 #1 #镗孔 #1 #镗孔 #2 #镗孔 #2 #misc #1 #misc #1 #misc #2 #misc #2 - 无暂停 - 有暂停 - 无暂停 - 有暂停 - 无暂停 - 有暂停 - 右手 - 左手 - 无暂停 - 有暂停 - 无暂停 - 有暂停 - 无暂停 - 有暂停 - 无暂停 - 有暂停#Target for stringfstrsel sg81 drlgsel sgdrill # -------------------------------------------------------------------------# 选择增量或绝对 G 字符串 sg90 sg91 sgabsinc G90 G91 #绝对代码 #增量代码 #Target stringfstrsel sg90 absinc sgabsinc # -------------------------------------------------------------------------#钻孔固定循环参考高度 sg98 G98 #Z 轴回到起始高度 sg99 sgdrlrefG99#Z 轴回到参考高度 #Target for string # Drill cycle G string selectfstrsel sg98 drillref sgdrlref # Generate string for spindle sm04 sm05 sm03 spindle M04 M05 M03 #主轴反转 #主轴停止 #主轴正转 #Target for string# --------------------------------------------------------------------------fstrsel sm04 spdir2 spindle # -------------------------------------------------------------------------# 冷却 M 字符串选择 sm09 sm08 sm08_1 sm08_2 scoolant M09 M08 M08 M08 #冷却液 Off #冷却液 喷射 #冷却液 喷雾 #Coolant Tool #Target for stringfstrsel sm09 coolant scoolant # -------------------------------------------------------------------------# 定义齿轮选择代码 flktbl 1 40 41 42 3 0 400 2250 #Lookup table definition - table no. - no. entries #底速齿轮档 #中速齿轮档 #高速齿轮档# -------------------------------------------------------------------------# fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt T T T D H G P S M N X Y Z X 刀具交换 / NC 输出变量格式 4 4 4 4 4 4 4 4 4 4 2 2 2 3 t next_tool tloffno tlngno g_wcs p_wcs speed gear n xabs yabs zabs xinc #刀具号 #下一把使用的刀具 #直径偏移号 #长度偏移号 #WCS G address #WCS P address #主轴转速 #Gear range #序号 #X 坐标输出 #Y 坐标输出 #Z 坐标输出 #X 坐标输出 # -------------------------------------------------------------------------first_tool #第一把使用的刀具# -------------------------------------------------------------------------- fmt fmt fmt fmt fmt fmt fmt fmt fmtY Z I J K R F P M3 3 3 3 3 2 15 11 5yinc zinc i j k arcrad feed dwell cantext#Y 坐标输出 #Z 坐标输出 #x 轴方向上的圆弧中心描述 #y 轴方向上的圆弧中心描述 #z 轴方向上的圆弧中心描述 #圆弧半径 #进给率 #暂停 #Canned text# -------------------------------------------------------------------------#Move comment (pound) to output colon with program numbers fmt O 7 progno progno peck1 shftdrl refht_a refht_i 4 4 1 #Program number #Program number #First peck increment (positive) #Fine bore tool shift #Reference height #Reference height tnote toffnote tlngnote tldia # 注释格式 # 注释格式 # 注释格式 # 注释格式 #fmt &:& 7 fmt fmt fmt fmt Q Q R R 2 2 2 2# --------------------------------------------------------------------------# -------------------------------------------------------------------------fmt &TOOL:& fmt & DIA. OFF:& 4 fmt & LEN.:& fmt & DIA.:&# -------------------------------------------------------------------------# Tool Comment / Manual Entry Section ptoolcomment tnote = t toffnote = tloffno tlngnote = tlngno &(&, *tnote, *tldia, pstrtool [ strtool = ucase(strtool) *strtool, & & ] pcomment pcomment2 pcomment2 #Comment from manual entry #Comment from manual entry (must call pcomment2 if booleans) if strtool && sblank, *sopnote, &)&, e #Comment for tool #Comment for tool 刀具注释/手工输入部分 # --------------------------------------------------------------------------scomm = ucase (scomm) if gcode = 1007, &(&, scomm, &)& else, &(&, scomm, &)&, e # -------------------------------------------------------------------------# 文件起始和刀具交换设置 # -------------------------------------------------------------------------psof0 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 = absinc 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 #Start of file for tool zeropretract#刀具路径末尾,换刀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 peof peof 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 #End of file for non-zero tool #End of file for tool zeropgear [#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 speed & 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(two, 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 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 ] #Call at actual toolchange, end last path here # -------------------------------------------------------------------------# 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 指令 - 进给 pxout, pyout, pzout, feed, strcantext, scoolant, e pcirout #输出圆弧插补的 NC 指令pcan1, pbld, n, sgplane, `sgcode, sgabsinc, pccdia,if arcrad &= max_arc, result = mprint(saxiswarn) pcan1, pbld, n, sgplane, sgcode, sgabsinc, pccdia, pxout, pyout, pzout, parc, feed, strcantext, scoolant, e pcom_moveb pxyzcout ps_inc_calc pncoutput comment pcan if gcode = zero, prapidout if gcode = one, plinout if gcode & one & gcode & four, pcirout pcom_movea pcom_movea pcan2 pe_inc_calc pdwl_spd 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 #Call from NCI gcode 4 #Common motion preparation routines, after #Movement output #Common motion preparation routines, beforepcom_moveb prapid pncoutput pzrapid pncoutput plin pncoutput pz pncoutput pmx pncoutput pcir pncoutput#输出直线运动的 NC 指令 - 快速#输出直线运动的 NC 指令 - 快速 Z only#输出直线运动的 NC 指令 - 进给#输出直线运动的 NC 指令 - 进给 Z only#输出 NCI 向量的 NC 指令#输出圆弧插补的 NC 指令# -------------------------------------------------------------------------# Motion output components pbld 运动输出组成 # -------------------------------------------------------------------------#Canned text - 单节删除 if bld, '/' pfbld &/& pccdia #切削补偿 #Force Dxx# if prv_cc_pos && cc_pos & cc_pos, prv_tloffno = 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 #Force Y axis output if absinc = zero, *yabs, !yinc else, *yinc, !yabs #强制 - 单节删除 pyout#Y output if absinc = zero, yabs, !yinc else, yinc, !yabspfzout#Force Z axis output if absinc = zero, *zabs, !zinc else, *zinc, !zabspzout#Z output if absinc = zero, zabs, !zinc else, zinc, !zabsparc [#选择圆弧输出格式 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 [ 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 钻孔 #Canned Drill Cycle common call, before # -------------------------------------------------------------------------if gcode = 81, @dwell pcom_moveb comment pcan prdrlout #R drill positionrefht_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 pdrlcommonb pcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, shftdrl, dwell, *feed, strcantext, e pcom_moveapmisc2 pdrill pdrill_2#Canned Misc #2 Cycle (User Option)#Canned Drill Cycle, additional pointspdrlcommonb pcan1, pbld, n, pxout, pyout, pzout, prdrlout, dwell, feed, strcantext, e pcom_movea ppeck_2 pdrill_2 pchpbrk_2 pdrill_2 ptap_2 pdrill_2 pbore1_2 pdrill_2 pbore2_2 pdrill_2 pmisc1_2 pdrill_2 pmisc2_2 pdrill_2 pdrlcst #自定义钻孔循环 8 - 19 (user option) #Canned Misc #2 Cycle #Canned Misc #1 Cycle #Canned Bore #2 Cycle #Canned Bore #1 Cycle #Canned Tap Cycle #Canned Chip Break Cycle #Canned Peck Drill Cycle#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 cycleresult = 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_no & 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 pcant_out pcant_2 pcant_out pcant_3 pcant_out pcant_4 pcant_out pcant_5 pcant_out pcant_6 #Canned text - output call #Canned text - output call #Canned text - output call #Canned text - output call #Canned text - output call #Canned text - output callcantext = cant_val1cantext = cant_val2cantext = cant_val3cantext = cant_val4cantext = cant_val5cantext = cant_val6 pcant_out pcant_7 pcant_out pcant_8 pcant_out pcant_9 pcant_out pcant_10 pcant_out pcant_out #Canned text - build the string for output #Canned text - output call #Canned text - output call #Canned text - output call #Canned text - output callcantext = cant_val7cantext = cant_val8cantext = cant_val9cantext = cant_val10#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 ] # -------------------------------------------------------------------------# 坐标计算,通常不需要修改 #Map coordinates xabs = vequ (x) feed = fr_pos if feed & maxfeedpm, feed = maxfeedpm #Incremental calculations ps_inc_calc #Incremental calculations, start xia = fmtrnd(xabs) yia = fmtrnd(yabs) zia = fmtrnd(zabs) xinc = vsub (xia, prv_xia) # -------------------------------------------------------------------------pxyzcout 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,00,,)? 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/B)? A 88. Echo keyboard to screen 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. 最大的主轴转数? . 换刀平均时间(seconds)? 2.0 #110. 默认的刀具库? TOOLS.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)? n}

我要回帖

更多关于 mastercam9.1后处理 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信