Mastercam软件的后置处理文件及其设定方法
- 格式:doc
- 大小:152.00 KB
- 文档页数:24
MasterCAM X版本后置处理及其修改方法详细说明mastercam系统配置的是适应单一类型控制系统的通用后置处理,用户根据数控机床和数控系统的具体情况,可以对其数据库进行修改和编译,定制出适应某一数控机床的专用后置处理程序。
mastercam系统默认发那科后置处理文件的扩展名为pst,称为pst文件。
(一般该文件在共享文档\shared mcamx5\MILL\Posts\MPFAN.pst)根据本人多年使用经验,初次安装后后处理有以下几点要修改。
(1)默认后处理去掉第四轴A0的输出用记事本或任意文本编辑器打开MPFAN.pst,然后搜索Rotary Axis Settings,找到rot_on_x:1#SET_BY_MD Default Rotary Axis Orientation#0=Off,1=About X,2=About Y,3=About Z改成rot_on_x:0#SET_BY_MD Default Rotary Axis Orientation#0=Off,1=About X,2=About Y,3=About Z就可以关闭四轴,没有A0输出。
(2)去掉程序开头的注释输出用记事本或任意文本编辑器打开MPFAN.pst,然后搜索"%",找到"%",e$sav_spc=spaces$spaces$=0中间略掉spaces$=sav_spc改成"%",e$sav_spc=spaces$spaces$=0*progno$,sopen_prn,sprogname$,sclose_prn,e$#sopen_prn,"PROGRAM NAME-",sprogname$,sclose_prn,e$#sopen_prn,"DATE=DD-MM-YY-",date$,"TIME=HH:MM-",time$, sclose_prn,e$#Date and time output Ex.12-02-0515:52#sopen_prn,"DATE-",month$,"-",day$,"-",year$,sclose_prn,e$#Date output as month,day,year-Ex.02-12-05#sopen_prn,"DATE-",*smonth,"",day$,"",*year2,sclose_prn, e$#Date output as month,day,year-Ex.Feb.122005#sopen_prn,"TIME-",time$,sclose_prn,e$#24hour time output-Ex.15:52#sopen_prn,"TIME-",ptime sclose_prn,e$#12hour time output 3:52PMspathnc$=ucase(spathnc$)smcname$=ucase(smcname$)stck_matl$=ucase(stck_matl$)snamenc$=ucase(snamenc$)#sopen_prn,"MCX FILE-",*smcpath$,*smcname$,*smcext$, sclose_prn,e$#sopen_prn,"NC FILE-",*spathnc$,*snamenc$,*sextnc$, sclose_prn,e$#sopen_prn,"MATERIAL-",*stck_matl$,sclose_prn,e$spaces$=sav_spc在不需要的前面加#,就可以去掉注释的输出。
MasterCAM X版本后置处理及其修改方法详细说明mastercam系统配置的是适应单一类型控制系统的通用后置处理,用户根据数控机床和数控系统的具体情况,可以对其数据库进行修改和编译,定制出适应某一数控机床的专用后置处理程序。
mastercam系统默认发那科后置处理文件的扩展名为pst,称为pst文件。
(一般该文件在共享文档\shared mcamx5\MILL\Posts\MPFAN.pst)根据本人多年使用经验,初次安装后后处理有以下几点要修改。
(1)默认后处理去掉第四轴A0的输出用记事本或任意文本编辑器打开MPFAN.pst,然后搜索Rotary Axis Settings,找到rot_on_x:1#SET_BY_MD Default Rotary Axis Orientation#0=Off,1=About X,2=About Y,3=About Z改成rot_on_x:0#SET_BY_MD Default Rotary Axis Orientation#0=Off,1=About X,2=About Y,3=About Z就可以关闭四轴,没有A0输出。
(2)去掉程序开头的注释输出用记事本或任意文本编辑器打开MPFAN.pst,然后搜索"%",找到"%",e$sav_spc=spaces$spaces$=0中间略掉spaces$=sav_spc改成"%",e$sav_spc=spaces$spaces$=0*progno$,sopen_prn,sprogname$,sclose_prn,e$#sopen_prn,"PROGRAM NAME-",sprogname$,sclose_prn,e$#sopen_prn,"DATE=DD-MM-YY-",date$,"TIME=HH:MM-",time$, sclose_prn,e$#Date and time output Ex.12-02-0515:52#sopen_prn,"DATE-",month$,"-",day$,"-",year$,sclose_prn,e$#Date output as month,day,year-Ex.02-12-05#sopen_prn,"DATE-",*smonth,"",day$,"",*year2,sclose_prn, e$#Date output as month,day,year-Ex.Feb.122005#sopen_prn,"TIME-",time$,sclose_prn,e$#24hour time output-Ex.15:52#sopen_prn,"TIME-",ptime sclose_prn,e$#12hour time output 3:52PMspathnc$=ucase(spathnc$)smcname$=ucase(smcname$)stck_matl$=ucase(stck_matl$)snamenc$=ucase(snamenc$)#sopen_prn,"MCX FILE-",*smcpath$,*smcname$,*smcext$, sclose_prn,e$#sopen_prn,"NC FILE-",*spathnc$,*snamenc$,*sextnc$, sclose_prn,e$#sopen_prn,"MATERIAL-",*stck_matl$,sclose_prn,e$spaces$=sav_spc在不需要的前面加#,就可以去掉注释的输出。
MasterCAM后处理修改特殊技巧一.1 MasterCAM后处理修改特殊技巧:Scrollex EDIT另外:输出字母的大小写修改方式不知如何更改;注:若要修改下述相应功能则直接查找红色下划线语句即可;①、 MasterCAM后处理输出文件格式设置sextnc MIN NC Program Extension for Okuma上述语句表示输出格式为MIN格式;若没有可以新建;“.Trun”格式表示车床专用;需要的格式修改MIN即可,如MPF,NC,H,TXT等这样就不必每次为输出什么样的格式费神了;我就经常用MPF和NC、H几种格式,为每种格式编制一个后处理或通用一个均比较方便;②、“Arcoutput”控制语句控制圆弧输出格式,设置值若为“0”表示输出为“IJK”格式;若设置值为“1”则输出圆弧格式为“R”;“arctype”控制输出圆弧类型,若为“1”则表示由圆心确定;若为“2”则表示由起点Start指向圆心Center,2=St-Ctr;若为“3”表示由圆心指向起点,3=Ctr-St;若为“4”表示非增量;arcoutput : 0 0 = IJK, 1 = R no sign, 2 = R signed neg. over 180 arctype : 1 Arc center 1=abs, 2=St-Ctr, 3=Ctr-St , 4=unsigned inc.③、“Omitseq”控制语句控制序列号输出,若设置值为“Yes”则忽略序列号,不输出,若设置值为“No”则不忽略即输出序列号;④、“Spaces”控制语句控制空格输出,若设置值为“0”表示不输出空格即紧凑输出,若设置值为“1”表示输出空格即在每个“X,Y,R,F”等控制语句前加一空格;⑤、若要查找每一条输出语句的作用及位置则在输出语句后加上标语句即可;一般输出语句的格式为:pbld, n, "M6", e其中pbld为输出开头,n为序列号,“”引号内为直接输出字符,e为结束语句;下面语句为程序号输出格式:fmt O 4 progno Program numberfmt ":" 4 progno Program number表示注释语句的开始,fmt是格式定义,O表示输出程序开头为O,若开头为PR或P时只需要改O为需要的程序开头即可;这里的4表示程序号长度为4个字节;其它用fmt格式定义的语句也一样,可用此法修改想改的部分即可得到需要的输出结果;比如要求输出的G01变为L格式即从ISO格式转化为Heidenhain格式数据的读入:*progno:从MasterCAM图形中读入程序号scomm:从MasterCAM图形中读入注释文本*t:从MasterCAM图形中读入刀具号*tnote, toffnote, tlngnote,*tldia:从MasterCAM图形中读入刀具直径date:从MasterCAM图形中读入日期time:从MasterCAM图形中读入时间*speed:从MasterCAM图形中读入主轴速度*spindle:从MasterCAM图形中读入主轴scoolant:从MasterCAM图形中读入冷却液打开与关闭“”:从MasterCAM图形中输出时引号内的内容直接输出;Sprogname:从MasterCAM图形中输出程序名控制语句ScrollexMasterCAM9后处理的修改MasterCAM系统缺省的后处理文件为,适用于FANUC发那科数控代码的控制器;其它类型的控制器需选择对应的后处理文件;由于实际使用需要,用缺省的后处理文件时,输出的NC文件不能直接用于加工;原因是:以下内容需要回复才能看到⑴进行模具加工时,需从G54~G59的工件坐标系指令中指定一个,最常用的是G54;部分控制器使用G92指令确定工件坐标系;对刀时需定义工件坐标原点,原点的机械坐标值保存在CNC控制器的G54~G59指令参数中;CNC控制器执行G54~G59指令时,调出相应的参数用于工件加工;采用系统缺省的后处理文件时,相关参数设置正确的情况下可输出G55~G59指令,但无法实现G54指令的自动输出;⑵后处理文件针对的是4轴加工中心,而目前使用量最大的是3轴加工中心,多出了第4轴数据“A0.”;⑶不带刀库的数控铣使用时要去掉刀具号、换刀指令、回参考点动作;⑷部分控制器不接受NC文件中的注释行;⑸删除行号使NC文件进一步缩小;⑹调整下刀点坐标值位置,以便于在断刀时对NC文件进行修改;⑺普通及啄式钻孔的循环指令在缺省后处理文件中不能输出;使用循环指令时可大幅提高计算速度,缩小NC文件长度;如果要实现以上全部要求,需对NC文件进行大量重复修改,易于出现差错,效率低下,因此必须对PST后处理文件进行修改;修改方法如下:1、增加G54指令方法一:采用其他后处理文件如可正常输出G54指令;由于后处理文件广泛采用,这里仍以此文件为例进行所有修改;其他后处理文件内容有所不同,修改时根据实际情况调整;用MC9自带的编辑软件路径:C:\Mcam9\Common\Editors\Pfe\ 打开文件路径:C:\Mcam9\Mill\Posts\单击edit→find按钮,系统弹出查找对话框,输入“G49”;查找结果所在行为:pbld, n, sgcode, sgplane, "G40", "G49", "G80", sgabsinc, e插入G54指令到当前行,将其修改为:pbld, n, sgcode, sgplane, "G40", "G49", "G80", sgabsinc, "G54",e输出的NC文件修改前对应位置指令为:N102G0G17G40G49G80G90修改后变为:N102G0G17G40G49G80G90G54查找当前行的上一行:pbld, n, smetric, e将其整行删除,或加上“”成为注释行:pbld, n, smetric, e修改后G21指令不再出现,某些控制器可不用此指令;注意修改时保持格式一致;G21指令为选择公制单位输入,对应的英制单位输入指令为G20;2、增加G54指令方法二:单击按钮,系统弹出查找对话框,输入“force_wcs”,单击按钮,查找结果所在行为:force_wcs : no Force WCS output at every toolchange将no改为yes,修改结果为:force_wcs : yes Force WCS output at every toolchange输出的NC文件修改前对应位置指令为:修改后变为:前一方法为强制输出固定指令代码,如需使用G55~G59指令时,有所不便;多刀路同时输出时,只在整个程序中出现一次G54指令;后一方法同其他后处理文件产生G54指令的原理相同,多刀路同时输出时,每次换刀都会出现G54指令,也可根据参数自动转换成G55~G59指令;输出三轴加工中心程序的FANUC后处理文件为,输出4轴加工中心程序的三菱控制器后处理文件为;3、删除第四轴数据“A0.”,以适应三轴加工中心:单击按钮,系统弹出查找对话框,输入“Rotary Axis”,单击按钮,查找结果所在行为:164. Enable Rotary Axis button y将其修改为:164. Enable Rotary Axis button n修改后第四轴数据不再出现;4、删除刀具号、换刀指令、回参考点指令,适应无刀库的数控铣机床:单击按钮,系统弹出查找对话框,输入“M6”,单击按钮,查找结果所在行为:if stagetool >= zero, pbld, n, t, "M6", e将其修改为:if stagetool >= zero, e pbld, n, t, "M6",另一个换刀的位置所在行为:pbld, n, t, "M6", e将其删除或改为注释行:pbld, n, t, "M6", e修改后换刀指令行不再出现,通常修改第一个出现“M6”指令的位置即可;单击按钮,系统弹出查找对话框,输入“sg28ref”,单击按钮,查找结果所在行为:pbld, n, sgabsinc, sgcode, sg28ref, "Z0.", scoolant, epbld, n, sg28ref, "X0.", "Y0.", protretinc, e将其修改为:pbld, n, scoolant, epbld, n, sg28ref, "X0.", "Y0.", protretinc, e输出的NC文件修改前对应位置指令为:修改后变为:N116M9PST文件中另有两个类似位置,如使用G92指令确定工件坐标,可对其适当修改;加工结束后,机床各轴不回参考点,便于手动换刀时节省时间;5、删除NC文件的程序名、注释行:单击按钮,系统弹出查找对话框,输入“%”,单击按钮,查找结果所在行为:"%", e*progno, e"PROGRAM NAME - ", progname, "", e"DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, "", e将其删除或改为注释行:"%", eprogno, e"PROGRAM NAME - ", progname, "", e"DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, "",输出的NC文件修改前对应位置指令为:O0010PROGRAM NAME - A2DATE=DD-MM-YY - 25-12-04 TIME=HH:MM - 10:45修改后以上指令行不再出现;单击按钮,系统弹出查找对话框,输入“pstrtool”,单击按钮,查找结果所在行为:"", pstrtool, tnote, toffnote, tlngnote, tldia, "", e将其删除或改为注释行:"", pstrtool, tnote, toffnote, tlngnote, tldia, "", e输出的NC文件修改前对应位置指令为:TOOL - 2 DIA. OFF. - 0 LEN. - 0 DIA. - 16.修改后以上指令行不再出现;此注释行指明当前刀路所使用的刀具参数,可用于加工前核对加工单,建议保留;法兰克及三菱控制器可以接受注释内容;6、取消行号:单击按钮,系统弹出查找对话框,输入“omitseq”,单击按钮,查找结果所在行为:omitseq : no Omit sequence no.将其修改为:omitseq : yes Omit sequence no.修改后行号不再出现;7、调整下刀点坐标值位置:单击按钮,系统弹出查找对话框,输入“g43”,单击按钮,查找结果所在行为:pcan1, pbld, n, sgcode, sgabsinc, pwcs, pfxout, pfyout,pfcout, speed, spindle, pgear, strcantext, epbld, n, "G43", tlngno, pfzout, scoolant, next_tool, e将其修改为:pcan1, pbld, n, sgcode, sgabsinc, pwcs, pfxout, pfyout, pfcout, e pbld, n, sgcode, pfzout, epbld, n, speed, spindle, pgear, strcantext, epbld, n, "G43", tlngno, scoolant, next_tool, e输出的NC文件修改前对应位置指令为:修改后变为:新的指令顺序使下刀点安全高度x、y、z坐标值同其他指令分开,易于在断刀时修改;G43指令在PST文件中有两个位置,如仅使用G54指令时,修改第一个出现“G43”的位置即可;8、输出普通及啄式钻孔循环指令:单击按钮,系统弹出查找对话框,输入“usecandrill”,单击按钮,查找结果相关行为:usecandrill : no Use canned cycle for drillusecanpeck : no Use canned cycle for Peck将其修改为:usecandrill : yes Use canned cycle for drill usecanpeck : yes Use canned cycle for Peck此修改适用于支持G81、G83钻孔循环指令的控制器;部分FANUC系统G代码,不全;可供参考;G代码表代码组功能G00 01 定位G01 直线插补G02 顺时针圆弧插补G03 逆时针圆弧插补G04 00 暂停G10 可编数据输入G11 取消可编数据输入方式G15 17 极坐标指令取消G16 极坐标指令开G17 02 选择X、Y平面G18 选择Z、X平面G19 选择Y、Z平面G20 06 英制输入G21 公制输入G28 00 返回参考点G29 从参考点返回G30 返回第2、3、4参考点G40 07 取消刀具半径补偿G41 刀具半径左补偿G42 刀具半径右补偿G43 08 刀具长度正补偿G44 刀具长度负补偿G49 取消刀具长度补偿G50 11 取消比例缩放G51 比例缩放开22 镜象取消镜象开G52 00 局部坐标系设定G53 选择机床坐标系G54 14 选择工件坐标系1G55 选择工件坐标系2G56 选择工件坐标系3G57 选择工件坐标系4G58 选择工件坐标系5G59 选择工件坐标系6G65 00 宏程序调用G66 12 宏程序模态调用G67 取消宏程序模态调用G68 16 坐标旋转G69 取消坐标旋转G73 09 深孔钻循环G74 左攻螺纹循环G76 精镗循环G80 取消孔加工固定循环G81 钻、镗孔循环G82 锪孔循环G83 深孔钻循环G84 右攻螺纹循环G85 镗孔循环G86 镗孔循环G87 背镗孔循环G88 镗孔循环G89 镗孔循环G90 03 绝对方式编程G91 增量方式编程G92 00 设定工件坐标系G98 10 固定循环返回初始点G99 固定循环返回R点MASTERCAM后处理的设置和参数修改Mastercam是美国CNC Software公司开发的一套CAD/CAM软件,最早的版本为,可运行于DOS系统.以上版本运行于Windows操作系统;由于其诞生较早且功能齐全,特别是在CNC编程上快捷方便,因此有很高的市场占有率.软件的CAD功能可以构建2D或3D图形,架构自由曲面的功能远远胜于其他同类软件.在CAM方面更是直观和方便,可直接在点,线,面和实体上产生刀路.下面重点介绍它的后处理设置.后置处理文件简称后处理文件,是一种可以由用户以回答问题的形式自行修改的文件,其扩展名为.PST;安装MASTERCAM时系统会自动安装默认的后处理为.在应用Mastercam软件的自动编程功能之前,必须先对这个文件进行编辑,才能在执行后处理程序时产生符合某种控制器需要和使用者习惯的NC程序,如果没有全部更正,则可能造成事故.例如,某机床的控制系统采用G54工件坐标系定位,G90绝对坐标编程,要求生成的NC程序前面必须有G54G90设置,如果后处理文件的设置为G55G91,则每次生成的程序中含有G55G91,却不一定有G54G90,如果在加工时没有进行手工改正,则势必造成加工错误.本文介绍了Mastercam后处理文件的内容以及修改和设置的方法,供有关人员参考.也就是说后处理程序可以将一种控制器的NC程序,定义成该控制器所使用的格式.以FANUC系列的后处理系统为例,它可以定义成惯用于FANUC 3M控制器所使用的格式,也可以定义成FANUC 6M控制器所使用的格式,但不能用来定义其它系列的控制器.不同系列的后处理文件,在内容上略有不同,但其格式及主体部分是相似的,一般都包括以下部分:1 Annotation注释.对后处理文件及其设定方法作一般性介绍.此部分内容一般都不用更改. 以下是截取的部分注释:注释前都带号,系统在执行代码处理时是不会读取前面带号的语句的.Post Name : MPFANProduct : MILLMachine Name : GENERIC FANUCControl Name : GENERIC FANUCDescription : GENERIC FANUC MILL POSTAssociated Post : NONEMill/Turn : NO4-axis/Axis subs. : YES5-axis : NOSubprograms : YESExecutable : MPWARNING: THIS POST IS GENERIC AND IS INTENDED FOR MODIFICATION TOTHE MACHINE TOOL REQUIREMENTS AND PERSONAL PREFERENCE.2 Debugging and Factory Set Program Switches 系统程序规划.此部分是MASTERCAM版本的后处理系统规划,每个版本都大同小异,一般不需更改.以下截取的是版的m_one : -1 Define constantzero : 0 Define constantone : 1 Define constanttwo : 2 Define constantthree : 3 Define constantfour : 4 Define constantfive : 5 Define constantc9k : 999 Define constantfastmode : yes Enable Quick Post Processing, set to no for debugbug1 : 2 0=No display, 1=Generic list box, 2=Editorbug2 : 40 Append postline labels, non-zero is column positionbug3 : 0 Append whatline no. to each NC linebug4 : 1 Append NCI line no. to each NC linewhatno : yes Do not perform whatline branches leave as yesget_1004 : 1 Find gcode 1004 with getnextoprpd_typ_v7 : 0 Use Version 7 style contour flags/processingstrtool_v7 : 2 Use Version 7+ toolnametlchng_aft : 2 Delay call to toolchange until move linecant_tlchng : 1 Ignore cantext entry on move with tlchng_aftnewglobal : 1 Error checking for global variablesgetnextop : 0 Build the next variable table3 General Output Settings常规后处理设定.此部分可视情况更改,以适合机台或个人使用.以下截取的是版的一些常规设定.冒号前面的是变量,冒号后面的是设定值,号后面是注解一般是说明0代表什么,1代表什么,2代表什么,yes或no应该不用翻译了吧英文后面的中文注解是我加进去的,翻译的不是很详细,但相信大家能看懂.没有翻译的就表示我根本不会或此设定不常用....嘿嘿...sub_level : 1 Enable automatic subprogram support启用自动支持子程式breakarcs : 2 Break arcs, 0 = no, 1 = quadrants, 2 = 180deg. max arcs打断圆弧方式arcoutput : 1 0 = IJK, 1 = R no sign, 2 = R signed neg. over 180转出圆弧方式arctype : 2 Arc center 1=abs, 2=St-Ctr, 3=Ctr-St, 4=unsigned inc.do_full_arc : 0 Allow full circle output 0=no, 1=no 是否转成整圆方式helix_arc : 0 Support helix arc output, 0=no, 1=all planes,2=XY plane only是否转成螺旋弧arccheck : 1 Check for small arcs, convert to linear是否检测小圆弧并将其转成线atol : .01 Angularity tolerance for arccheck = 2圆弧角度公差ltol : .002 Length tolerance for arccheck = 1圆弧长度公差vtol : .1 System tolerance系统公差maxfeedpm : 500 Limit for feed in inch/min最大进给-英制ltol_m : .05 Length tolerance for arccheck = 1, metric圆弧长度公差-公制vtol_m : .0025 System tolerance, metric系统公差-公制maxfeedpm_m : 10000 Limit for feed in mm/min最大进给-公制force_wcs : no Force WCS output at every toolchange换刀时是否转出WCS坐标spaces : 0 Number of spaces to add between fields两行之间是否加入空格omitseq : yes Omit sequence numbers是否省略序列号seqmax : 9999 Max. sequence number最大序列号stagetool : 0 0 = Do not pre-stage tools, 1 = Stage tools是否沿用刀具use_gear : 0 Output gear selection code, 0=no, 1=no 是否转成齿轮代码max_speed : 10000 Maximum spindle speed最大转速min_speed : 50 Minimum spindle speed最小转速nobrk : no Omit breakup of x, y & z rapid movesprogname : 0 Use uppercase for program name sprogname程式名称是否使用大写4 中间还有一些例如:Common User-defined指令设定,Format statements格式报告,definitions for NC outputNC代码限定,Error messages出错信息,Toolchange / NC output variable Formats刀具变量等基本上都是系统固定格式,不需要更改.在此就不再详述.当然,我也不建议你更改这些项目,如果你改错的话,系统很可能不执行或机台报警......5 Start of File and Toolchange Setup文本内容和换刀设定.此部分内容很重要,很多使用者都从这里着手把程式改成自己需要的格式.以下截取的是版的部分内容,其中有些是我根据自己需要更改的,中文是我加的注解.引号内是可以更改的内容."%", e程式开头的百分号*progno, e程式号码comment注解,可有可无,如不需要则删除此句"PROGRAM NAME - ", sprogname, "", e程式名称,可有可无"", tnote, toffnote, tlngnote, tldia, "", e刀具直径及补正参数显示,如不需要则把此整句删除"DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, "", e程式日期显示,可有可无pbld, n, "/M99", e 我自己加的一句,如不需要则整句删除,而不是只删除引号内的内容定义加工原点,也可以改为G54坐标sav_absinc = absinc 绝对坐标系......中间省略的部分是系统根据刀路自动转出的程式,一般不必改......以下几句是出现在程式尾,可以根据需要添加或删除n, "Z10.", e 加工完成后提刀至安全高度n, ".", e 归零n, "G91", e 转用相对坐标n, "M99", e 回到主程式mergesub此四句为程式结尾固定语句,不必理它clearsubmergeauxclearaux"%", e程式尾6Numbered questions for Mastercam Mill问题参数设定.此部分大多数是MASTERCAM系统的参数设定,而涉及到后处理的内容很少,在此就不再详述,有兴趣者可以用词典翻译看看讲些啥有什么新发现可以告诉俺.。
Mastercam9.1后处理设置Mastercam9.1是一款广泛应用于机械制造行业的计算机辅助设计和制造软件。
在使用Mastercam9.1进行数控编程时,后处理设置是非常重要的一步。
本文将介绍Mastercam9.1后处理设置的步骤和注意事项。
步骤以下是设置Mastercam9.1后处理的步骤:1.打开Mastercam9.1软件,并选择需要进行后处理设置的机床类型。
2.进入后处理设置界面,选择“工具”菜单下的“后处理工具”。
3.在后处理工具界面中,选择左侧的“设置管理器”。
4.在设置管理器中,将光标定位到当前使用的后处理器上,并点击右键选择“编辑”。
5.进入后处理器编辑界面后,可以对后处理器进行各种设置。
6.首先,需要设置后处理的输出文件路径。
点击“文件”菜单下的“设置文件名”选项,设置输出文件的路径和文件名。
7.接下来,根据具体的机床和加工需求,可以进行一些其他的设置,例如刀具补偿、刀具半径补偿、进给速度等。
8.对于一些特殊的加工工艺,还可以在后处理器编辑界面中添加自定义的代码段,以满足特定的加工需求。
9.设置完所有的参数后,点击保存并关闭后处理器编辑界面。
10.返回到设置管理器界面,可以将当前设置的后处理器设为默认后处理器,以便在以后的操作中直接使用。
11.完成所有的设置后,可以关闭后处理工具界面,开始进行数控编程。
注意事项在进行Mastercam9.1后处理设置时,需要注意以下几点:1.不同机床类型所需的后处理设置可能有所不同,在选择后处理器时要根据实际的机床类型进行选择。
2.在进行后处理设置之前,要先了解机床的技术参数和加工要求,确保后处理器的设置与之相符。
3.后处理的输出文件路径要设置在合适的位置,方便后续的操作和查找。
4.在进行一些高级的设置时,要小心操作,确保设置的正确性和安全性。
5.在使用自定义代码段时,要谨慎选择和添加代码,确保其适用性和正确性。
6.建议在进行后处理设置之前先做好程序的检查和验证,以减少出错的可能性。
MASTERCAM后处理的设置及参数修改.docxMASTERCAM后处理的设置和参数修改后置处理文件简称后处理文件,MASTERCAM后置处理文件是一种可以由用户以回答问题的形式自行修改的文件,其扩展名为 .PST。
安装MASTERCAM时系统会自动安装默认的后处理为MPFAN.PST在.应用Mastercam 软件的自动编程功能之前,必须先对这个文件进行编辑,才能在执行后处理程序时产生符合某种控制器需要和使用者习惯的NC程序,如果没有全部更正,则可能造成事故 . MASTERCAM提供了不同系列的后处理文件,它们在内容上略有不同,但其格式及主体部分是相似的,一般都包括以下部分:1)注释部分。
对后处理文件及其设定方法作一般性介绍. 此部分内容一般都不用更改 .以下是截取的部分注释:( 注释前都带#号, 系统在执行代码处理时是不会读取前面带#号的语句的 .)#Post Name : MPFAN#Product : MILL#Machine Name : GENERIC FANUC#Control Name : GENERIC FANUC#Description : GENERIC FANUC MILL POST#Associated Post : NONE#Mill/Turn : NO#4-axis/Axis subs. : YES#5-axis : NO#Subprograms : YES#Executable : MP v9.0##WARNING:THIS POSTIS GENERICANDIS INTENDEDFOR MODIFICATION TO#THE MACHINE TOOL REQUIREMENTSAND PERSONALPREFERENCE.2)系统程序规划部分( Debugging and Factory SetProgram Switches )。
此部分是 MASTERCAM版本的后处理系统规划,每个版本都大同小异 , 一般不需更改 . 以下截取的是 9.0 版的 ) m_one : -1 #Define constantzero : 0 #Define constantone : 1 #Define constanttwo : 2 #Define constantthree : 3 #Define constantfour : 4 #Define constantfive : 5 #Define constant---fastmode : yes #Enable Quick Post Processing, (set to no for debug)bug1 : 2 #0=No display,1=Generic list box, 2=Editorbug2 : 40 #Append postline labels, non-zerois column position?bug3 : 0 #Append whatline no. to each NC line?bug4 : 1 #Append NCI line no. to each NC line?whatno : yes #Do not perform 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 movelinecant_tlchng : 1 #Ignore cantext entry on move with tlchng_aftnewglobal : 1 #Error checking for global variablesgetnextop : 0 #Build the next variable table3)常规后处理设定部分(General Output Settings )。
MasterCAM X版本后置处理及其修改方法详细说明mastercam系统配置的是适应单一类型控制系统的通用后置处理,用户根据数控机床和数控系统的具体情况,可以对其数据库进行修改和编译,定制出适应某一数控机床的专用后置处理程序。
mastercam系统默认发那科后置处理文件的扩展名为pst,称为pst文件。
(一般该文件在共享文档\shared mcamx5\MILL\Posts\MPFAN.pst)根据本人多年使用经验,初次安装后后处理有以下几点要修改。
(1)默认后处理去掉第四轴A0的输出用记事本或任意文本编辑器打开MPFAN.pst,然后搜索Rotary Axis Settings,找到rot_on_x:1#SET_BY_MD Default Rotary Axis Orientation#0=Off,1=About X,2=About Y,3=About Z改成rot_on_x:0#SET_BY_MD Default Rotary Axis Orientation#0=Off,1=About X,2=About Y,3=About Z就可以关闭四轴,没有A0输出。
(2)去掉程序开头的注释输出用记事本或任意文本编辑器打开MPFAN.pst,然后搜索"%",找到"%",e$sav_spc=spaces$spaces$=0中间略掉spaces$=sav_spc改成"%",e$sav_spc=spaces$spaces$=0*progno$,sopen_prn,sprogname$,sclose_prn,e$#sopen_prn,"PROGRAM NAME-",sprogname$,sclose_prn,e$#sopen_prn,"DATE=DD-MM-YY-",date$,"TIME=HH:MM-",time$, sclose_prn,e$#Date and time output Ex.12-02-0515:52#sopen_prn,"DATE-",month$,"-",day$,"-",year$,sclose_prn,e$#Date output as month,day,year-Ex.02-12-05#sopen_prn,"DATE-",*smonth,"",day$,"",*year2,sclose_prn, e$#Date output as month,day,year-Ex.Feb.122005#sopen_prn,"TIME-",time$,sclose_prn,e$#24hour time output-Ex.15:52#sopen_prn,"TIME-",ptime sclose_prn,e$#12hour time output 3:52PMspathnc$=ucase(spathnc$)smcname$=ucase(smcname$)stck_matl$=ucase(stck_matl$)snamenc$=ucase(snamenc$)#sopen_prn,"MCX FILE-",*smcpath$,*smcname$,*smcext$, sclose_prn,e$#sopen_prn,"NC FILE-",*spathnc$,*snamenc$,*sextnc$, sclose_prn,e$#sopen_prn,"MATERIAL-",*stck_matl$,sclose_prn,e$spaces$=sav_spc在不需要的前面加#,就可以去掉注释的输出。
Mastercam软件的后置处理文件及其设定方法Mastercam软件的后置处理文件,简称后处理文件,是一种可以由用户以回答问题的形式自行修改的文件,其扩展名为.pst。
在应用Mastercam软件的自动编程功能之前,必须先对这个文件进行编辑,才能在执行后处理程序时产生符合某种控制器需要和使用者习惯的NC程序,也就是说后处理程序可以将一种控制器的NC程序定义成该控制器所使用的格式。
以FANUC系列的后处理为例,它既可以定义成惯用于FANUC 0M控制器所使用的格式,也可以定义成FANUC6M控制器所使用的格式,但不能用来定义其它系列的控制器(例如西门子系统)。
不同系列的后处理文件在内容上略有不同,但其格式及主体部分是相似的,一般都包括以下几个部分。
1.Annotation(注释)对后处理文件及其设定方法作一般性介绍。
2.问题该部分为后处理文件的主要部分,FANUC系列的后处理文件中共包括200个问题,对这些问题的回答将决定将来输出的NC程序的格式。
3.Commands(指令)指令的作用是对它后面的变量施加影响。
如oldvars和newvars指令,在回答问题3时若写于刀具号码变量t之前,则使用oldvars时将调用前一把刀具的号码,使用newvars时将调用现在所使用的刀具号码。
4.Variables(变量)给出了"问题"中所使用的各种变量的定义.FANUC系列的后处理文件中共定义了26个变量,如prog-n=程序号码,f=进给率,s=主轴转速,t=刀具号码等。
后处理文件的设定方法1.后处理文件编辑的一般规则对后处理文件的编辑和设定只需要对第(4)部分的"问题"进行回答。
PST文件的每个问题前都有一个号码并在号码后加一个小数点。
如果问题前没有号码,那么这个问题在执行后处理时是被忽略不用的。
回答号码20以前的问题时,需要在问题的下一行输入所回答的文字,而且回答的内容可以包括多行,20号以后问题均带有问号且回答时直接写在问号的后面,不得换行,这一类的问题常常是以"y""n"来回答。
回答问题时用到变量,不能用引号,而字符串则必须包围在引号之中(如"G90 G54 G0 Z100.0"),引号中的文字将按字符串的原样写入程序中。
变量和字符之间要用逗号隔开。
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坐标位置,通常用于换刀和程序结束时使刀具返回机械原点。
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_n 1234N,"G90 G54 G49 G40" N100 G90 G54 G49 G40N,"G00 X0 Y0" N102 G00 X0Y0N,"M06" M104 M06 T01N,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程序后去对程序进行修改,不仅浪费时间,而且容易出错导致事故。
下面提供一个修改完成的后处理文件,该文件可直接应用于乔福VMC850加工中心(FANUC 0i系统),如果是其他的FANUC系统,请对照后,自行修改。
-------------------------------------------------------# Post Name : MPFAN# Product : MILL# Machine Name : GENERIC FANUC# Control Name : GENERIC FANUC# Description : GENERIC FANUC MILL POST# Associated Post : NONE# Mill/Turn : NO# 4-axis/Axis subs. : YES# 5-axis : NO# Executable : MP 7.20## --------------------------------------------------------------------------# 特征:# --------------------------------------------------------------------------## 下列 Misc.(杂项) 必须使用整数:## 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 linecant_tlchng : 1 #忽视 cantext 入口 on move with tlchng_aftnewglobal : 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 #每次换刀时强制输出WCSspaces : 1 #各指令之间插入的空格数omitseq : no #省略序号seqmax : 9999 #最大序号stagetool : 0 #0 = 无预先备刀, 1 = 预备刀具use_gear : 0 #输出齿轮交换代码,0=no,1=yesmax_speed : 6000 #最大主轴转速min_speed : 1 #最小主轴转速nobrk : no #Omit breakup of x, y & z rapid movesprogname : 1 #使用大写字母表示程序名max_arc : 50000 #机床允许的最大圆弧半径# -------------------------------------------------------------------------- # 旋转轴设定# --------------------------------------------------------------------------# -------------------------------------------------------------------------- # 允许钻孔固定循环功能# -------------------------------------------------------------------------- usecandrill : yes #使用普通钻孔固定循环usecanpeck : yes #使用啄钻式钻孔固定循环usecanchip : yes #使用断屑钻孔固定循环usecantap : yes #使用攻螺纹固定循环usecanbore1 : yes #使用镗孔固定循环1usecanbore2 : yes #使用镗孔固定循环2usecanmisc1 : yes #使用杂项固定循环1usecanmisc2 : 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 calculationsbld : 0 #单节删除激活result : 0 #Return value for functionssav_spc : 0 #Save spacessav_gcode : 0 #Gcode savedsav_absinc : 0 #Absolute/Incremental Saved Valuesav_coolant : 0 #Coolant savedtoolchng : 1 #On a toolchange flagspdir2 : 1 #Copy for safe spindle direction calculation#Drill variablesdrlgsel : -1 #Drill Select Initializedrillref : 0 #Select drill referencepeckacel : 0 #Fractional percent to reduce peck2 when usecan.. : no drlgcode : 0 #Save Gcode in drillsav_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 statementsfs2 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 placefs2 10 0.2 0.2 #小数, absolute, 2 placefs2 11 0.3 0.3 #小数, absolute, 3 placefs2 12 0.4 0.4 #小数, absolute, 4 placefs2 13 0.5 0.5 #小数, absolute, 5 placefs2 14 0.3 0.3d #小数, delta, 3 placefs2 15 0.2 0.1 #小数, absolute, 2/1 placefs2 16 1 0 1 0n #整数, 强制输出# 输出加工类型字符串定义# -------------------------------------------------------------------------- # 字符串 - 字符串标签必须由 's' 开头,它们没有预先指派# -------------------------------------------------------------------------- #Select operation notesop00 "NULL" # String definitionsop01 "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 stringfstrsel 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"strtextnostrcantext# -------------------------------------------------------------------------- # 错误信息# -------------------------------------------------------------------------- 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 #圆弧插补 CWsg03 G03 #圆弧插补 CCWsg04 G04 #暂停sgcode #Target for stringfstrsel sg00 gcode sgcode# -------------------------------------------------------------------------- # 选择工作平面 G 字串sg17 G17 #XY 平面代码sg19 G19 #YZ 平面代码sg18 G18 #XZ 平面代码sgplane #Target stringfstrsel sg17 plane sgplane# -------------------------------------------------------------------------- #选择英制/米制字串sg20 G20 #英制代码sg21 G21 #米制代码smetric #Target stringfstrsel sg20 met_tool smetric# -------------------------------------------------------------------------- #选择参考点回归字串sg28 G28 #第一参考点回归sg30 G30 #第二参考点回归sg28ref #Target stringfstrsel sg28 mi3 sg28ref# -------------------------------------------------------------------------- # 切削补偿 G 字串选择scc0 G40 #切削补偿取消scc1 G41 #切削左补偿scc2 G42 #切削右补偿sccomp #Target for stringfstrsel 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 stringfstrsel sg81 drlgsel sgdrill# --------------------------------------------------------------------------sg90 G90 #绝对代码sg91 G91 #增量代码sgabsinc #Target stringfstrsel sg90 absinc sgabsinc# -------------------------------------------------------------------------- #钻孔固定循环参考高度sg98 G98 #Z轴回到起始高度sg99 G99 #Z轴回到参考高度sgdrlref #Target for stringfstrsel sg98 drillref sgdrlref # Drill cycle G string select# -------------------------------------------------------------------------- # Generate string for spindlesm04 M04 #主轴反转sm05 M05 #主轴停止sm03 M03 #主轴正转spindle #Target for stringfstrsel sm04 spdir2 spindle# -------------------------------------------------------------------------- # 冷却 M 字符串选择sm09 M09 #冷却液 Offsm08 M08 #冷却液喷射sm08_1 M08 #冷却液喷雾sm08_2 M08 #Coolant Toolscoolant #Target for stringfstrsel sm09 coolant scoolant# -------------------------------------------------------------------------- # 定义齿轮选择代码flktbl 1 3 #Lookup table definition - table no. - no. entries40 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 addressfmt 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 numbersfmt 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 shiftfmt R 2 refht_a #Reference heightfmt 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 tooltnote = ttoffnote = tloffnotlngnote = tlngno"(", *tnote, *tldia, *sopnote, ")", epstrtool #Comment for toolif strtool <> sblank,[strtool = ucase(strtool)*strtool, " "pcomment #Comment from manual entry (must call pcomment2 if booleans)pcomment2pcomment2 #Comment from manual entryscomm = ucase (scomm)if gcode = 1007, "(", scomm, ")"else, "(", scomm, ")", e# --------------------------------------------------------------------------# 文件起始和刀具交换设置# --------------------------------------------------------------------------psof0 #Start of file for tool zeropsofpsof #Start of file for non-zero tool numbertoolchng = oneif ntools = one,[#skip single tool outputs, stagetool must be onstagetool = m_one!next_tool]"%", e*progno, e"(PROGRAM NAME - ", progname, ")", e"(DATE=Day-Month-Year - ", date, " TIME=Hr:Min - ", time, ")", eptoolcommentpbld, n, *sgcode, *sgplane, "G40", "G49", "G80", "G54", *sgabsinc, *smetric, e sav_absinc = absincpcom_movebabsinc = zeropcan1, pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, *zr,*speed, *spindle, pgear, strcantext, epe_inc_calcps_inc_calcabsinc = sav_absincpbld, n, sgabsinc, epretract #刀具路径末尾,换刀absinc = onesav_coolant = coolantcoolant = zero#cc_pos is reset in the toolchange herecc_pos = zerogcode = zeropbld, n, sccomp, *sm05, eabsinc = sav_absinccoolant = sav_coolantpeof0 #End of file for tool zeropeofpeof #End of file for non-zero toolpretractcomment#Remove pound character to output first tool with staged tools # #if stagetool = one, pbld, n, *first_tool, en, "M30", e"%", epwcs #G54+ coordinate setting at toolchangeif workofs <> prv_workofs | (force_wcs & toolchng),[if workofs < 6,[g_wcs = workofs + 54*g_wcs]else,[p_wcs = workofs - five"G54.1", *p_wcs]]!workofspgear #Find spindle gear from lookup tableif use_gear = one,[gear = frange (one, speed)*gear#换刀设置pspindle #主轴转速计算 for RPMspeed = abs(ss)if maxss = zero | maxss > max_speed, maxss = max_speedif speed > max_speed, speed = maxssif speed < min_speed, speed = min_speedspdir2 = fsg3(spdir)pq #Setup post based on switch settingsif stagetool = one, bldnxtool = oneif 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_mvtol = vtol_mmaxfeedpm = maxfeedpm_m]ptoolend #刀具路径末尾,读取新刀具资料之前!speed, !spdir2ptlchg1002 #Call at actual toolchange, end last path here pspindleif gcode = 1000,[#Null toolchange]else,[#Toolchange and Start of fileif gcode = 1002,#Actual toolchangepretract]if stagetool = one, prv_next_tool = m_oneprv_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, eplinout #输出直线运动的NC指令 - 进给pcan1, pbld, n, sgplane, `sgcode, sgabsinc, pccdia,pxout, pyout, pzout, feed, strcantext, scoolant, epcirout #输出圆弧插补的NC指令if arcrad >= max_arc, result = mprint(saxiswarn) pcan1, pbld, n, sgplane, sgcode, sgabsinc, pccdia,pxout, pyout, pzout, parc, feed, strcantext, scoolant, epcom_moveb #Common motion preparation routines, beforepxyzcoutps_inc_calcpncoutput #Movement outputpcom_movebcommentpcanif gcode = zero, prapidoutif gcode = one, plinoutif gcode > one & gcode < four, pciroutpcom_moveapcom_movea #Common motion preparation routines, afterpcan2pe_inc_calcpdwl_spd #Call from NCI gcode 4commentif prv_spdir2 <> spdir2, pbld, n, *sm05, eif prv_speed <> speed | prv_spdir2 <> spdir2,pbld, n, *speed, *spindle, pgear, epcanif fmtrnd(dwell), pcan1, pbld, n, *sgcode, *dwell, strcantext, eelse, pcan1, pbld, n, strcantext, epcan2prapid #输出直线运动的NC指令 - 快速pncoutputpzrapid #输出直线运动的NC指令 - 快速 Z onlypncoutputplin #输出直线运动的NC指令 - 进给pncoutputpz #输出直线运动的NC指令 - 进给 Z onlypncoutputpmx #输出NCI向量的NC指令pncoutputpcir #输出圆弧插补的NC指令pncoutput# -------------------------------------------------------------------------- # Motion output components 运动输出组成# -------------------------------------------------------------------------- pbld #Canned text - 单节删除if bld, '/'pfbld #强制 - 单节删除"/"pccdia #切削补偿#Force Dxx#if prv_cc_pos <> cc_pos & cc_pos, prv_tloffno = c9ksccompif cc_pos, tloffnopfxout #Force X axis outputif absinc = zero, *xabs, !xincpxout #X outputif absinc = zero, xabs, !xincelse, xinc, !xabspfyout #Force Y axis outputif absinc = zero, *yabs, !yincelse, *yinc, !yabspyout #Y outputif absinc = zero, yabs, !yincelse, yinc, !yabspfzout #Force Z axis outputif absinc = zero, *zabs, !zincelse, *zinc, !zabspzout #Z outputif absinc = zero, zabs, !zincelse, zinc, !zabsparc #选择圆弧输出格式if arcoutput = zero,[#圆弧输出为 IJKi, j, k]else,[#圆弧输出为 Rif abs(sweep)<=180 | arcoutput=one, result = nwadrs(srad, arcrad)else, result = nwadrs(srminus, arcrad)*arcrad]# -------------------------------------------------------------------------- # Drilling 钻孔# -------------------------------------------------------------------------- pdrlcommonb #Canned Drill Cycle common call, beforeif gcode = 81,[result = newfs (two, zinc)if drillcyc = three, drlgsel = fsg1(-ss) + drillcyc * twoelse, drlgsel = fsg2(dwell) + drillcyc * twoelse, drillref = oneprv_refht_a = c9kprv_refht_i = c9k]z = depthprv_zia = inithtfeed = fr_posprv_dwell = zero@dwellpcom_movebcommentpcanprdrlout #R drill positionrefht_a = refhtrefht_i = refht - inithtif absinc = zero, refht_a, !refht_ielse, refht_i, !refht_apdrill #钻孔固定循环pdrlcommonbpcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, dwell, *feed, strcantext, epcom_moveappeck #啄式钻孔固定循环pdrlcommonbpcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *peck1, *feed, strcantext, epcom_moveapchpbrk #断屑固定循环pdrlcommonbpcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *peck1, *feed, strcantext, epcom_moveaptap #攻螺纹固定循环pdrlcommonbpcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *feed, strcantext, epcom_moveapbore1 #镗孔固定循环 #1pdrlcommonbprdrlout, dwell, *feed, strcantext, epcom_moveapbore2 #镗孔固定循环 #2pdrlcommonbpcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *feed, strcantext, epcom_moveapmisc1 #Canned Misc #1 Cyclepdrlcommonbpcan1, pbld, n, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, shftdrl, dwell, *feed, strcantext, epcom_moveapmisc2 #Canned Misc #2 Cycle (User Option)pdrillpdrill_2 #Canned Drill Cycle, additional pointspdrlcommonbpcan1, pbld, n, pxout, pyout, pzout, prdrlout, dwell,feed, strcantext, epcom_moveappeck_2 #Canned Peck Drill Cyclepdrill_2pchpbrk_2 #Canned Chip Break Cyclepdrill_2ptap_2 #Canned Tap Cyclepdrill_2pbore1_2 #Canned Bore #1 Cyclepdrill_2pbore2_2 #Canned Bore #2 Cyclepdrill_2pmisc1_2 #Canned Misc #1 Cyclepdrill_2pmisc2_2 #Canned Misc #2 Cyclepdrill_2#Use this postblock to customize drilling cycles 8 - 19pdrlcommonb"CUSTOMIZABLE DRILL CYCLE ", pfxout, pfyout, pfzout, epcom_moveapdrlcst_2 #自定义钻孔循环 8 - 19, additional points (user option) #Use this postblock to customize drilling cycles 8 - 19pdrlcommonb"CUSTOMIZABLE DRILL CYCLE ", pfxout, pfyout, pfzout, epcom_moveapcanceldc #Cancel canned drill cycleresult = newfs (three, zinc)z = inithtprv_zia = inithtpxyzcout!zabs, !zincprv_gcode = zeropbld, n, "G80", e# -------------------------------------------------------------------------- # Canned Text# -------------------------------------------------------------------------- pcan #Canned text - before output callstrcantext = sblankif cant_no > zero,[if cant_pos1 = zero, pcant_1if cant_pos2 = zero, pcant_2if cant_pos3 = zero, pcant_3if cant_pos4 = zero, pcant_4if cant_pos5 = zero, pcant_5if cant_pos6 = zero, pcant_6if cant_pos7 = zero, pcant_7if cant_pos8 = zero, pcant_8if cant_pos9 = zero, pcant_9if cant_pos10 = zero, pcant_10pbld, n, strcantext, estrcantext = sblank]pcan1 #Canned text - with movestrcantext = sblankif cant_no > zero,[if cant_pos2 = one, pcant_2if cant_pos3 = one, pcant_3if cant_pos4 = one, pcant_4if cant_pos5 = one, pcant_5if cant_pos6 = one, pcant_6if cant_pos7 = one, pcant_7if cant_pos8 = one, pcant_8if cant_pos9 = one, pcant_9if cant_pos10 = one, pcant_10]if cstop, strcantext = strcantext + sm00if cgstop, strcantext = strcantext + sm01#Output of strcantext occurs at the end of the output linepcan2 #Canned text - after output callstrcantext = sblankif cant_no > zero,[if cant_pos1 = two, pcant_1if cant_pos2 = two, pcant_2if cant_pos3 = two, pcant_3if cant_pos4 = two, pcant_4if cant_pos5 = two, pcant_5if cant_pos6 = two, pcant_6if cant_pos7 = two, pcant_7if cant_pos8 = two, pcant_8if cant_pos9 = two, pcant_9if cant_pos10 = two, pcant_10pbld, n, strcantext, estrcantext = sblank]pcant_1 #Canned text - output callcantext = cant_val1pcant_outpcant_2 #Canned text - output callcantext = cant_val2pcant_outpcant_3 #Canned text - output callcantext = cant_val3pcant_outpcant_4 #Canned text - output callpcant_outpcant_5 #Canned text - output callcantext = cant_val5pcant_outpcant_6 #Canned text - output callcantext = cant_val6pcant_outpcant_7 #Canned text - output callcantext = cant_val7pcant_outpcant_8 #Canned text - output callcantext = cant_val8pcant_outpcant_9 #Canned text - output callcantext = cant_val9pcant_outpcant_10 #Canned text - output callcantext = cant_val10pcant_outpcant_out #Canned text - build the string for output#Assign string select type outputsif cantext = three, bld = oneif cantext = four, bld = zero#Build the cantext stringif cantext = one, strcantext = strcantext + sm00if cantext = two, strcantext = strcantext + sm01if cantext > four,[strtextno = no2str(cantext)strcantext = strcantext + strm + strtextno]# -------------------------------------------------------------------------- # 坐标计算,通常不需要修改# -------------------------------------------------------------------------- pxyzcout #Map coordinatesxabs = vequ (x)feed = fr_posif feed > maxfeedpm, feed = maxfeedpm#Incremental calculationsps_inc_calc #Incremental calculations, startxia = 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) ? 281. 传输速率 (110,150,300,600,1200,2400,4800,9600,14400,19200,38400)? 960082. 奇偶校验 (E/O/N)? E83. 数据位 (7 or 8)? 784. 停止位 (1 or 2)? 285. Strip line feeds? N86. 每行末延迟(秒)? 087. Ascii, Eia, or Binary (A/E/B)? A88. Echo keyboard to screen in terminal emulation? n89. Strip carriage returns? N90. NC和材料文件所处的磁盘和目录?91. 执行的后置处理器名? MP92. 反向处理器名(nic->nc)? RP93. 反向处理 PST 文件名? RPFAN100. 序号之小数点前的位数? 3101. 序号之小数点后的位数? 0103. 最大的主轴转数? 6000107. 换刀平均时间(seconds)? 2.0#110. 默认的刀具库? TOOLS.TL8158. 挖槽精加工时使用磨损补偿? n159. Compensate the first and last point in cutter comp. in control simulation? y160. Display first and last entity in toolpath when simulating cutter compensation in control? y 161. 打开机械原点按钮? y162. 打开参考点按钮? y163. 打开杂项变数按钮? y164. 打开旋转轴按钮? n165. 打开刀具平面按钮? y166. 打开构图平面按钮? y167. 打开刀具显示按钮? y。