后处理POST

更新时间:2024-06-24 16:40:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

[POST_VERSION] #不要移动或改变这条线 # V11.00 E1 P0 T1114789915 M11.00

# Post Name : Generic Fanuc 3X Mill.pst # Product : Mill

# Machine Name : Generic # Control Name : Fanuc

# Description : Generic 3 Axis Mill Post # 4-axis/Axis subs. : No # 5-axis : No # Subprograms : Yes # Executable : MP 11.0 #

# 警告:这篇文章是通用的,是为了修改

#机床的要求和个人喜好。 #

# 这篇文章需要一个有效的3轴机器定义。

#如果旋转轴检测,收到错误信息

#主动轴组合。 #

# 相关文件列表$#

# 通用发那科3X mill.control #

# 相关 File List$ #

# -------------------------------------------------------------------------- # 修订日志:

# -------------------------------------------------------------------------- # CNC 06/09/05 - 在Mastercam X初始安装后

#数控10 / 06 / 05改变参数的读取min_speed,改性pspindle,Pprep美元,pset_mach

#数控02 / 03 / 06添加逻辑高速刀具路径工具检查(见prapidout和plinout)

#数控06 / 26 / 06的初始安装后对MasterCAM X2

#数控02 / 26 / 07改性系统

#数控11 / 02 / 07美元增加prv_shftdrl =零

#数控04 / 08 / 08 -释放-删除检查write_ops X3

#

# -------------------------------------------------------------------------- #特征:

# -------------------------------------------------------------------------- # 这个帖子支持通用发那科代码为3轴铣削。

它的目的是支持# Mastercam X厂的特点。 #

X #新特点: # -子程序支持

#机定义,定义刀具路径参数读取和控制组的部分添加。

#岗位设置最小/最大转速和最大进给率从MD和CD。

# - cd_var变量初始化是从CD直接读取。改变这些初始值

#在后不会影响输出。这些值只在更新后的例行程序中处理。

# - set_by_md或set_by_cd变量初始化是覆盖在这后的参数或

#变量设置从MD或CD。

#增强工具信息添加开关工具评论而已,没有工具在头tooltable

#在工具的评论在换刀头更换工具或tooltable评论(见tool_info)

# tooltable输出包括刀具补偿型和股票离开信息

#增强工具分期选择启用或禁用CD。stagetltype后输出类型设置:

# 不期第一阶段第一工具工具,最后换刀或第一级工具在文件结束(peof)#支持X的评论,包括机器名,组名,组输出(见pcomment2)评论

# -额外的日期,时间和数据路径输出选项(见pheader)

#附加刚性攻丝循环(从原来的攻丝循环分离)和初始自定义钻

#周期支持(见pmisc2美元,pdrlcst美元)

# - 10额外的罐头文本选项X的支持

# -序列号输出十进制支持(设置“增量序列号”在CD十进制值

# 输出。即“增量序列号”。5,“开始序号”= 10:N10,n10.5,N11,n11.5, etc...)

# - 在工具转变为M00或M01输出开关(3位置开关,关闭,M00,M01看到prog_stop) # -支持分离XY,XZ和YZ平面/弧变量(CD看到弧页)

# -支持X型冷却液。允许多达10个不同的冷却剂是打开/关闭之前,或之后, 像

#罐头文本。冷却液输出是由“冷却”变量和字符串V9式冷却液选择,

#”coolantx”变量和字符串选择X式冷却。 #

# -------------------------------------------------------------------------- # 杂项。价值:

# -------------------------------------------------------------------------- # 整数: #

# mi1 - 工作坐标系

# 0 = 引用返回生成和G92与

# X,Y和Z的家的位置在文件头。

# 1 =基准收益率产生G92与

# X,Y和Z的家的位置在每个工具。

# 2 = WCS的G54,G55的?基于MasterCAM的设置。 #

# mi2 - 绝对或增量定位在顶部 # 0 = 绝对的 # 1 = 增加的; #

# mi3 - 选择G28或G30回参考点. # 0 = G28, 1 = G30 #

# mi4 - mi10(未使用) #

# 实数: #

# mr1 - mr10 (NOT USED) #

# -------------------------------------------------------------------------- #Canned text:

# 进入一个轮廓点加拿大在MasterCAM的允许

#以下功能启用/禁用。 # Cantext价值:

# 1 = Program Stop = 输出“M00”停止代码

# 2 = Optional Stop = 输出“M01”可选的停止代码 # 3 = Block Delete on =数控线中的块删除代码

# 4 = Block Delete off = 在数控线中关闭块删除代码 #

# -------------------------------------------------------------------------- #增加额外的注释:

# 1)G54调用生成的工作抵销分录 of 0 = G54, # 1 = G55, etc.

# 2)度量是NCI的met_tool变量的应用. # 3)增量模式计算修改从家位置运动。

#家的位置是用来定义刀具的最后位置

#所有修改。

# 4)变量的absinc现在是预定义的,集MI2(MISC。整数)

#“顶级”绝对/增量程序输出。子程序

#更新通过子程序MasterCAM对话框设置。

# 5)变换子程序用G54 ..workshifts。 #

# end_header美元 #

# -------------------------------------------------------------------------- # Debugging和出厂设置程序开关s

# -------------------------------------------------------------------------- #Define Constants m_one := -1 zero := 0 one := 1 two := 2 three := 3 four := 4 five := 5 c9k := 9999

fastmode$ : yes$ #CD_VAR 启用快速后处理,(设置为无调试) bug1$ : 2 # 0 =无显示,1 =一般的列表框,2 =编辑 bug2$ : 40 #追加postline标签,非零列的位置? bug3$ : 0 #追加何种数各数控线? bug4$ : 1 #在NCI的线数各数控线? whatno$ : yes$ #不执行何种分支?(如是)

linktolvar$ : 0 #副X公差变量V9变量?

linkplnvar$ : 0 #副X飞机的具体变量V9变量? skp_lead_flgs$ : 0 #D不要使用V9风格轮廓的旗帜 get_1004$ : 1 #Find gcode 1004 with getnextop?

rpd_typ_v7$ : 0 #使用版本7样式的轮廓标志/处理? strtool_v7$ : 2 #使用7版本+ toolname? tlchng_aft$ : 2 #延迟调用换刀直到移动线

cant_tlchng$ : 1 #忽略 cantext entry on move with tlchng_aft newglobal$ : 1 #错误的检查全局变量 getnextop$ : 1 #构建下一个变量表

tooltable$ : 3 #预读, call the pwrtt postblock

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

# 一般输出设置# -------------------------------------------------------------------------- sub_level$ : 1 #cd_var启用自动子程序支持

breakarcs$ : 2 #打破cd_var弧, 0 = no, 1 = 90度, 2 = 180度. 最大弧arctype$ # cd_var电弧中心1 = ABS,2 = ST CTR,3 = CTR ST,4=unsigned inc., # 5 = 6 = R R不签字,签字后。超过180 do_full_arc$ : 0 #cd_var充分循环输出?0 = 1 =是的

helix_arc$ : 2 #cd_var支持螺旋弧输出,0 =无,1 =所有的飞机, 2=XY plane only arccheck$ : 1 #CD_VAR 检查小弧,转换为线性 atol$ : 0.01 #CD_VARArcCheck倾斜度公差为 ltol$ : 0.002 #CD_VaR的长度公差为ArcCheck vtol$ : 0.0001#容错系统

maxfeedpm : 500 #在英寸/分钟进给set_by_md极限 ltol_m : 0.05 #对于ArcCheck长度公差,公制 vtol_m : 0.0025#系统公差

maxfeedpm_m : 10000 #SET_BY_MD 在毫米/分钟的进给限 force_wcs : yes$ #Force WCS输出每次换刀?

spaces$ : 1 #CD_VAR 字段之间添加的空格数 omitseq$ : yes$ #CD_VAR 省略序列号? seqmax$ : 9999 #CD_VAR 最大。序列号

stagetool : 0 #SET_BY_CD 0 =不预先阶段工具,1 =阶段工具 stagetltype : 1 #0 = Do not stage 1st tool

#1 = 阶段第一工具最后换刀

#2 = Stage 1st tool在文件结束 (peof)

: 2

use_gear : 0 #输出齿轮选择代码,0 =不,1 =是的 min_speed : 50 #set_by_md最低转速

nobrk$ : no$ #CD_VAR 省略了×,和快速移动

progname$ : 1 #使用大写字母的程序名(sprogname)

prog_stop : 1 #在换刀停机程序:0 =无,1 = 2 = M00 M01,

tool_info : 2 #输出tooltable信息? #0 = Off 不输出任何工具或toolpable评论

#1 =工具注释

# 2 = tooltable在头-在T / C没有工具评论 # 3 = tooltable在头与工具的评论在T / C

tlchg_home : no$ #零返回×和轴之前 换刀?

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

# 启用屏蔽钻循环开关# -------------------------------------------------------------------------- usecandrill$ : yes$ #CD_VAR 使用周期为钻

usecanpeck$ : yes$ #CD_VAR Use canned cycle for Peck usecanchip$ : yes$ #CD_VAR Use canned cycle for 断屑 usecantap$ : yes$ #CD_VAR Use canned cycle for Tap usecanbore1$ : yes$ #CD_VAR Use canned cycle for Bore1 usecanbore2$ : yes$ #CD_VAR Use canned cycle for Bore2 usecanmisc1$ : yes$ #CD_VAR Use canned cycle for Misc1 usecanmisc2$ : yes$ #CD_VAR Use canned cycle for Misc2

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

# 通用用户定义变量初始化 (不开关!)

# -------------------------------------------------------------------------- xia : 0 #用于增量计算的格式化绝对值

yia : 0 #Formatted absolute value for Y incremental calculations zia : 0 #Formatted 绝对的 value for Z incremental calculations

bld : 0 #Block delete active

result : 0 #Return value for functions sav_spc : 0 #Save spaces sav_gcode : 0 #显示保存

sav_absinc : 0 #绝对/增量保存值 sav_coolant : 0 #冷却液 saved

sav_frc_wcs : 0 #强制工作偏移标志保存 toolchng : 1 #On a toolchange flag

spdir2 : 1 #安全主轴方向复制 计算

#Drill variables

drlgsel : -1 #钻头选择初始化 drillref : 0 #选择钻头参考

peckacel$ : 0 #CD_VAR分数百分比减少peck2时

usecan.. : no

drlgcode : 0 #Save Gcode in drill sav_dgcode : 0 #Drill gcode saved

#子程序变量

mr_rt_actv : 0 #标志如果G51 / G68活跃 #0=Off, 1=Toolchange, 2=子程序调用/开始, G68 #3=Absolute start, both

rt_csav : 0 #C 保存值

end_sub_mny : 0 #在变换子端捕获的许多工具设置

comp_type : 0 #Cutter compensation type - 0=computer, 1=control, 2=wear, 3=reverse wear, 4=off

#Coolant variables for X style coolant

cant_pos : 0 #从目前的罐头文本阅读(cant_pos1 - cant_pos20) coolant_bin : 0 #当前冷却液命令的二进制值

coolant_on : 0 #Binary value holding the sum of all coolants currently on coolantx : 0 #Selector variable for coolant string selector

local_int : 0 #Local variable for output of coolant off commands result2 : 0 #Return value for functions

suppress : 0 #Flag used to suppress redundant coolant on commands all_cool_off : 0 #First coolant off command shuts off ALL coolant options

#Variables to capture parameter values - use to set post switches in pset_mach

rotaxerror : 0 #Error flag - Output error message if rotary axis is detected in active axis combination

rot_ax_cnt : 0 #Rotary axis counter component_type : 0 #组件类型:(查看完整列表文件)# 0 =机 # 1 = stock_component

# 2 = misc_component

# 3 = machine_base_component

# 4 = linear_axis_component

# 5 = rotary_axis_component

# 6 = rect_table_component

# 12 = chuck_component

# 24 = tool_spindle_component

# 23 = atc_component

ra_error : 0 #Flag for aggregate operation

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

#用于数控输出的字符串和字符串选择器定义-------------------------------------------------------------------------- #Address string definitions strm \strn \stro \strp \srad \srminus \sblank

#Cantext string definitions (spaces must be padded here) sm00 \sm01 \strtextno strcantext

#Transform mirror and rotate codes

strns_mir_on \

strns_mir_off \strns_rot_on \ #Coordinate System Rotation

strns_rot_off \ #Coordinate System Rotation Cancel

#Misc. string definitions

sopen_prn \ #开括号字符串“(” sclose_prn \ #闭括号”字符串)” sdelimiter \ #字符串分隔符 sg94 \ #单位每分钟 sg95 \ #每次旋转进给

sm29 \ #刚性攻丝技术支持功能 sg80 \ #取消钻井周期 sg43 \ #刀具长度补偿 sg49 \ #刀具长度补偿 sg92 \ #设置工件坐标系 sm06 \ #Toolchange

# -------------------------------------------------------------------------- # 错误信;

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

shomeserror \sprgnerror \

#

sra_error \

srotaxerror \SUPPORT ROTARY AXIS

OUTPUT\

# -------------------------------------------------------------------------- # General G and M Code String select tables

# -------------------------------------------------------------------------- # Motion G code selection

sg00 G0 #快速

sg01 G1 #线性feed

sg02 G2 #圆弧插补 CW sg03 G3 #圆弧插补 CCW sg04 G4 #Dwell

sgcode #目标字符串

fstrsel sg00 gcode$ sgcode 5 -1

# -------------------------------------------------------------------------- # Select work plane G code

sg17 G17 #Xy平面代码 sg19 G19 #Yz平面代码 sg18 G18 #XZ平面编码 sgplane #目标字符串

fstrsel sg17 plane$ sgplane 3 -1

# -------------------------------------------------------------------------- #Select english/metric code sg20 G20 #英寸的代码

sg21 G21 #度量代码

smetric #Target string

fstrsel sg20 met_tool$ smetric 2 -1

# -------------------------------------------------------------------------- #Select reference return code sg28 G28 #第一参考点返回

sg30 G30 #二回参考点

sg28ref #Target string

fstrsel sg28 mi3$ sg28ref 2 -1

# -------------------------------------------------------------------------- # Cutter compensation G code selection

# scc0 G40取消刀具补偿

# SCC1 G41刀具补偿左

G42刀具补偿权# Scc2

sccomp #Target for string

fstrsel scc0 cc_pos$ sccomp 3 -1

# -------------------------------------------------------------------------- # Canned drill cycle string select # 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 #细口径不停留

sgm1d G76 #细钻与停留

sgm2 g84 #刚性攻丝右手

sgm2d G74 #刚性攻丝-左手sgdrill #Target for string

fstrsel sg81 drlgsel sgdrill 16 -1

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

# -------------------------------------------------------------------------- # Tool Comment / Manual Entry Section

# -------------------------------------------------------------------------- ptoolcomment #Comment for tool

tnote = t$, toffnote = tloffno$, tlngnote = tlngno$ if tool_info = 1 | tool_info = 3,

sopen_prn, pstrtool, sdelimiter, *tnote, sdelimiter, *toffnote, sdelimiter, *tlngnote, sdelimiter,

*tldia$, sclose_prn, e$

ptooltable #Tooltable output

sopen_prn, *t$, sdelimiter, pstrtool, sdelimiter, *tlngno$,

[if comp_type > 0 & comp_type < 4, sdelimiter, *tloffno$, sdelimiter, *scomp_type, sdelimiter, *tldia$],

[if xy_stock <> 0 | z_stock <> 0, sdelimiter, *xy_stock, sdelimiter, *z_stock], sclose_prn, e$

pstrtool #Comment for tool if strtool$ <> sblank, [

strtool$ = ucase(strtool$) *strtool$ ]

pcomment$ #Comment from manual entry (must call pcomment2) pcomment2 #Required if doing boolean 'if' logic testing!

pcomment2 #Output Comment from manual entry scomm$ = ucase (scomm$)

if gcode$ = 1005, sopen_prn, scomm$, sclose_prn, e$ #Manual entry - as comment if gcode$ = 1006, scomm$, e$ #Manual entry - as code

if gcode$ = 1007, sopen_prn, scomm$, sclose_prn #Manual entry - as comment with move NO e$

if gcode$ = 1026, scomm$ #Manual entry - as code with move NO e$ if gcode$ = 1008, sopen_prn, scomm$, sclose_prn, e$ #Operation comment if gcode$ = 1051, sopen_prn, scomm$, sclose_prn, e$ #Machine name if gcode$ = 1052, sopen_prn, scomm$, sclose_prn, e$ #Group comment if gcode$ = 1053, sopen_prn, scomm$, sclose_prn, e$ #Group name if gcode$ = 1054, sopen_prn, scomm$, sclose_prn, e$ #File Descriptor

# -------------------------------------------------------------------------- # Start of File and Toolchange Setup

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

ptime #Convert 24-hour time format into 12-hour AM/PM format if time$ >= 13, time2 = (time$ - 12) else, time2 = time$

hour = int(time2), min = frac(time2) *hour, \ if time$ > 12, \ else, \

pheader$ #Call before start of file \

sav_spc = spaces$ spaces$ = 0

*progno$, sopen_prn, sprogname$, sclose_prn, e$

#sopen_prn, \

sopen_prn, \and time output Ex.

12-02-05 15:52

#sopen_prn, \- \month$, \day$, \year$, sclose_prn, e$ #Date output as month,day,year - Ex.

02-12-05

#sopen_prn, \- \*smonth, \day$, \*year2, sclose_prn, e$ #Date output as month,day,year -

Ex. Feb. 12 2005

#sopen_prn, \ #24 hour time output - Ex. 15:52 #sopen_prn, \ #12 hour time output 3:52 PM spathnc$ = ucase(spathnc$) smcname$ = ucase(smcname$) stck_matl$ = ucase(stck_matl$) snamenc$ = ucase(snamenc$)

sopen_prn, \ sopen_prn, \ sopen_prn, \ spaces$ = sav_spc

psof0$ #Start of file for tool zero psof$

psof$ #Start of file for non-zero tool number if ra_error = 1, [if mprint(sra_error, 2) = 2, exitpost$] toolchng = one

if ntools$ = one, [

#skip single tool outputs, stagetool must be on stagetool = m_one !next_tool$ ]

pbld, n$, *smetric, e$

pbld, n$, *sgcode, *sgplane, scc0, sg49, sg80, *sgabsinc, e$ sav_absinc = absinc$

if mi1$ <= one, #Work coordinate system [

absinc$ = one

pfbld, n$, sgabsinc, *sg28ref, \ pfbld, n$, *sg28ref, \ pfbld, n$, sg92, *xh$, *yh$, *zh$, e$ absinc$ = sav_absinc ]

pcom_moveb pcheckaxis

c_mmlt$ #Multiple tool subprogram call ptoolcomment comment$ pcan

pbld, n$, *t$, sm06, e$

if mi1$ > one, absinc$ = zero

pcan1, pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, [if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$ pbld, n$, sg43, *tlngno$, pfzout, scoolant, pstagetool, e$ absinc$ = sav_absinc pcom_movea toolchng = zero

c_msng$ #Single tool subprogram call

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

c_mmlt$ #Multiple tool subprogram call comment$ pcan

result = newfs(15, feed) #Reset the output format for 'feed' pbld, n$, sgplane, e$ pspindchng

pbld, n$, scoolant, e$

if mi1$ > one & workofs$ <> prv_workofs$,

[

sav_absinc = absinc$ absinc$ = zero

pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, e$ pe_inc_calc ps_inc_calc

absinc$ = sav_absinc ]

if gcode$ = one, plinout else, prapidout pcom_movea

c_msng$ #Single tool subprogram call

ptlchg$ #Tool change toolchng = one

if mi1$ = one, #Work coordinate system [

pfbld, n$, *sg28ref, \ pfbld, n$, sg92, *xh$, *yh$, *zh$, e$ ]

if prog_stop = 1, pbld, n$, *sm01, e$ if prog_stop = 2, pbld, n$, *sm00, e$ pcom_moveb pcheckaxis

c_mmlt$ #Multiple tool subprogram call ptoolcomment comment$ pcan

result = newfs(15, feed) #Reset the output format for 'feed' pbld, n$, *t$, sm06, e$ sav_absinc = absinc$

if mi1$ > one, absinc$ = zero

pcan1, pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, [if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$ pbld, n$, sg43, *tlngno$, pfzout, scoolant, pstagetool, e$ absinc$ = sav_absinc pcom_movea toolchng = zero

c_msng$ #Single tool subprogram call

pstagetool #Pre-stage tools if stagetool = 1, [

if ttblend$, #Check for last toolchange

[

if stagetltype = 1, *next_tool$ #stage first tool at last toolchange ]

else, *next_tool$ #stage tool at every toolchange ]

pretract #End of tool path, toolchange sav_absinc = absinc$ absinc$ = one

sav_coolant = coolant$ coolant$ = zero

# if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless [ # explicitely turned off through a canned text edit if all_cool_off, [

#all coolant off with a single off code here if coolant_on, pbld, n$, *sall_cool_off, e$ coolant_on = zero ] else, [

local_int = zero coolantx = zero while local_int < 20, [

coolantx = and(2^local_int, coolant_on) local_int = local_int + one if coolantx > zero, [

coolantx = local_int pbld, n$, scoolantx, e$ ]

coolantx = zero ]

coolant_on = zero ] ]

#cc_pos is reset in the toolchange here cc_pos$ = zero gcode$ = zero

pbld, n$, sccomp, *sm05, psub_end_mny, e$

pbld, n$, sgabsinc, sgcode, *sg28ref, \

if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, \

absinc$ = sav_absinc coolant$ = sav_coolant

peof0$ #End of file for tool zero peof$

peof$ #End of file for non-zero tool pretract comment$

if stagetool = 1 & stagetltype = 2, pbld, n$, *first_tool$, e$ n$, \ mergesub$ clearsub$ mergeaux$ clearaux$ \

pwcs #G54+ coordinate setting at toolchange if mi1$ > one, [

sav_frc_wcs = force_wcs

if sub_level$ > 0, force_wcs = zero

if workofs$ <> prv_workofs$ | (force_wcs & toolchng), [

if workofs$ < 6, [

g_wcs = workofs$ + 54 *g_wcs ] else, [

p_wcs = workofs$ - five \ ] ]

force_wcs = sav_frc_wcs !workofs$ ]

pgear #Find spindle gear from lookup table if use_gear = one, [

gear = frange (one, speed) *gear

]

#Toolchange setup

pspindchng #Spindle speed change

if prv_spdir2 <> spdir2 & prv_speed <> zero, pbld, n$, *sm05, e$ if prv_speed <> speed | prv_spdir2 <> spdir2, [

if speed, pbld, n$, *speed, *spindle, pgear, e$ ]

!speed, !spdir2

pspindle #Spindle speed calculations for RPM speed = abs(ss$) if speed, [

if speed > maxss$, speed = maxss$

if speed < min_speed, speed = min_speed ]

spdir2 = fsg3(spdir$)

pq$ #Setup post based on switch settings

stagetool = bldnxtool$ #Set stagetool from CD setting

ptoolend$ #End of tool path, before reading new tool data !speed, !spdir2

ptlchg1002$ #Call at actual toolchange, end last path here if op_id$ <> prv_op_id$, pset_mach #Read machine def parameters pspindle

whatline$ = four #Required for vector toolpaths 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 ] !op_id$

# -------------------------------------------------------------------------- # Motion NC output

# -------------------------------------------------------------------------- #The variables for absolute output are xabs, yabs, zabs. #The variables for incremental output are xinc, yinc, zinc. # --------------------------------------------------------------------------

prapidout #Output to NC of linear movement - rapid pcan1, pbld, n$, sgplane, `sgcode, sgabsinc, pccdia, pxout, pyout, pzout, strcantext, scoolant, e$

#Modify following line to customize output for high-speed toolpath #tool inspection/change points

if rpd_typ$ = 7, pbld, n$, \\INSPECTION POINT - POST CUSTOMIZATION REQUIRED)\

plinout #Output to NC of linear movement - feed pcan1, pbld, n$, sgplane, `sgcode, sgabsinc, pccdia, pxout, pyout, pzout, feed, strcantext, scoolant, e$

#Modify following line to customize output for high-speed toolpath #tool inspection/change points

if rpd_typ$ = 7, pbld, n$, \\INSPECTION POINT - POST CUSTOMIZATION REQUIRED)\

pcirout #Output to NC of circular interpolation 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

if mr_rt_actv, #Restore absolute/incremental for G51/G68 [

absinc$ = sav_absinc

mr_rt_actv = zero ]

pcom_movea

pcom_movea #Common motion preparation routines, after pcan2

pe_inc_calc

pdwl_spd$ #Call from NCI gcode 4 pspindle comment$ pspindchng pcan

if fmtrnd(dwell$), pcan1, pbld, n$, *sgcode, *dwell$, strcantext, e$ else, pcan1, pbld, n$, strcantext, e$ pcan2

prapid$ #Output to NC of linear movement - rapid pncoutput

pzrapid$ #Output to NC of linear movement - rapid Z only pncoutput

plin$ #Output to NC of linear movement - feed pncoutput

pz$ #Output to NC of linear movement - feed Z only pncoutput

pmx$ #Output to NC of vector NCI pncoutput

pcir$ #Output to NC of circular interpolation pncoutput

# -------------------------------------------------------------------------- # Motion output components

# -------------------------------------------------------------------------- pbld #Canned text - block delete if bld, '/'

pfbld #Force - block delete \

pccdia #Cutter Compensation #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, !yabs

pfzout #Force Z axis output if absinc$ = zero, *zabs, !zinc else, *zinc, !zabs

pzout #Z output

if absinc$ = zero, zabs, !zinc else, zinc, !zabs

parc #Select the arc output

if (plane$ = zero & (arctype$ = one | arctype$ = four)) | #XY Plane (plane$ = one & (arctypeyz$ = one | arctypeyz$ = four)) | #YZ Plane (plane$ = two & (arctypexz$ = one | arctypexz$ = four)), #XZ Plane [

result = newfs(two, iout) result = newfs(two, jout) result = newfs(two, kout) ] else, [

result = newfs(three, iout) result = newfs(three, jout) result = newfs(three, kout)

]

if (plane$ = 0 & arctype$ < five) | (plane$ = 1 & arctypeyz$ < five) | (plane$ = 2 & arctypexz$ < five) | full_arc_flg$ | arc_pitch$, [

#Arc output for IJK

# If you do NOT want to force out the I,J,K values, # remove the \ if plane$ = zero, *iout, *jout, kout #XY plane code - G17 if plane$ = one, iout, *jout, *kout #YZ plane code - G19 if plane$ = two, *iout, jout, *kout #XZ plane code - G18 !i$, !j$, !k$ ] else, [

#Arc output for R

if abs(sweep$)<=180 | (plane$ = 0 & arctype$ = five) | (plane$ = 1 & arctypeyz$ = five) |

(plane$ = 2 & arctypexz$ = five), result = nwadrs(srad, arcrad$) else, result = nwadrs(srminus, arcrad$) *arcrad$ ]

# -------------------------------------------------------------------------- # Drilling

# -------------------------------------------------------------------------- pdrlcommonb #Canned Drill Cycle common call, before if initht$ <> refht$, drillref = zero else, drillref = one if gcode$ = 81, [

result = newfs(two, zinc)

if drillcyc$ = three | drillcyc$ = 7, drlgsel = fsg1(-ss$) + drillcyc$ * two else, drlgsel = fsg2(dwell$) + drillcyc$ * two prv_refht_a = c9k prv_refht_i = c9k prv_dwell$ = zero prv_shftdrl$ = zero ]

z$ = depth$ prv_zia = initht$ pcom_moveb feed = fr_pos$ 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$ #Canned Drill Cycle pdrlcommonb

pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, dwell$, *feed, strcantext, e$ pcom_movea

ppeck$ #Canned Peck Drill Cycle pdrlcommonb

pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *peck1$, *feed, strcantext, e$ pcom_movea

pchpbrk$ #Canned Chip Break Cycle pdrlcommonb

pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *peck1$, *feed, strcantext, e$ pcom_movea

ptap$ #Canned Tap Cycle pdrlcommonb

result = newfs(17, feed) # Set for tapping Feedrate format pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *feed, strcantext, e$ pcom_movea

pbore1$ #Canned Bore #1 Cycle pdrlcommonb

pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, dwell$, *feed, strcantext, e$ pcom_movea

pbore2$ #Canned Bore #2 Cycle pdrlcommonb

pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *feed, strcantext, e$ pcom_movea

pmisc1$ #Canned Fine Bore (shift) Cycle pdrlcommonb

pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, shftdrl$, dwell$, *feed, strcantext, e$ pcom_movea

pmisc2$ #Canned Rigid Tapping Cycle pdrlcommonb

#RH/LH based on spindle direction pbld, n$, sg95, e$

pbld, n$, sm29, *speed, e$

if met_tool$, pitch = n_tap_thds$ #Tap pitch (mm per thread) else, pitch = 1/n_tap_thds$ #Tap pitch (inches per thread) pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, *pitch, !feed, strcantext, e$ pcom_movea

pdrlcst$ #Custom drill cycles 8 - 19 (user option) #Use this postblock to customize drilling cycles 8 - 19 if drillcyc$ = 8, pdrlcst8 else, [

pdrlcommonb

sopen_prn, \e$

pcom_movea ]

pdrlcst8 #Custom drill cycle 8 - example custom cycle pdrlcommonb

sopen_prn, \ pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, prdrlout, shftdrl$, dwell$, *feed, strcantext, e$ pcom_movea

# Additional Holes

pdrill_2$ #Canned Drill Cycle, additional points pdrlcommonb

pcan1, pbld, n$, pxout, pyout, pzout, prdrlout, 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 Fine Bore (shift) Cycle pdrill_2$

pmisc2_2$ #Canned Rigid Tapping Cycle pdrlcommonb

pcan1, pbld, n$, pxout, pyout, pzout, prdrlout, strcantext, e$ pcom_movea

pdrlcst_2$ #Custom drill cycles 8 - 19, additional points (user option) #Use this postblock to customize drilling cycles 8 - 19 if drillcyc$ = 8, pdrlcst8_2 else, [

sopen_prn, \e$

pdrill_2$ ]

pdrlcst8_2 #Custom drill cycle 8 - example custom cycle

sopen_prn, \ pdrill_2$

pcanceldc$ #Cancel canned drill cycle result = newfs(three, zinc) z$ = initht$

prv_zia = initht$ pxyzcout !zabs, !zinc

prv_gcode$ = zero pcan

pcan1, pbld, n$, sg80, strcantext, e$ if drillcyc$ = 7, pbld, n$, sg94, e$

pcan2

# -------------------------------------------------------------------------- #Subprogram postblocks

#sub_trnstyp - 0=mirror, 1=rotate, 2=scale, 3=translate #sub_trnmthd (mirror) - 0=X axis, 1=Y axis, 2=line

#sub_trnmthd (rotate) - 0=tplane, 1=tplane origin only, 2=coordinates # -------------------------------------------------------------------------- psub_call_m$ #Call to main level, single tool psub_call_trans

psub_call_mm$ #Call to main level, multiple tools psub_call_trans

psub_call_trans #Translate level calls from toolchange, user if mi1$ <= one, result = mprint(shomeserror) sav_absinc = absinc$

#Mirror or Rotate Coord's

if sub_trnstyp$ = zero | (sub_trnstyp$ = one & mr_rt_actv), [

#The original pattern is not mirrored or rotated if sub_sec_no$, [

absinc$ = zero

if sub_trnstyp$, psub_rotate else, psub_mirror ]

mr_rt_actv = three ]

else, #Translate [

if sub_mny_t$, [

if mi1$ > one, absinc$ = zero

pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfzout, e$ pe_inc_calc ps_inc_calc ] ]

absinc$ = sav_absinc

result = nwadrs(strp, main_prg_no$)

if progno$ = main_prg_no$, result = mprint(sprgnerror) pbld, n$, \ prv_feed = c9k #Force feed in sub

pcant_12 #Canned text - output call cant_pos = cant_pos12$ cantext$ = cant_val12$ pcant_out

pcant_13 #Canned text - output call cant_pos = cant_pos13$ cantext$ = cant_val13$ pcant_out

pcant_14 #Canned text - output call cant_pos = cant_pos14$ cantext$ = cant_val14$ pcant_out

pcant_15 #Canned text - output call cant_pos = cant_pos15$ cantext$ = cant_val15$ pcant_out

pcant_16 #Canned text - output call cant_pos = cant_pos16$ cantext$ = cant_val16$ pcant_out

pcant_17 #Canned text - output call cant_pos = cant_pos17$ cantext$ = cant_val17$ pcant_out

pcant_18 #Canned text - output call cant_pos = cant_pos18$ cantext$ = cant_val18$ pcant_out

pcant_19 #Canned text - output call cant_pos = cant_pos19$ cantext$ = cant_val19$ pcant_out

pcant_20 #Canned text - output call cant_pos = cant_pos20$ cantext$ = cant_val20$ pcant_out

pcant_out #Canned text - build the string for output #Assign string select type outputs

if cant_pos < three, #cant_pos indicates canned text output [

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 ] ]

else, #cant_pos indicates coolant output [

coolant_bin = flook (two, cantext$) #Create binary value for each coolant using lookup table

if frac(cantext$/two), [

if all_cool_off, [

if coolant_on, pbld, n$, *sall_cool_off, e$ coolant_on = zero ]

else, coolant_on = coolant_on - coolant_bin/2 #Odd = off command, subtract appropriate binary value. ]

else, #Even = on command [ #Determine if this coolant is already on local_int = zero coolantx = zero while local_int < 20, [

result2 = and(2^local_int, coolant_on) local_int = local_int + one

if result2 = coolant_bin, suppress = one ] ]

if suppress <> 1, #Don't output an on code for a coolant that is already on [

if not(frac(cantext$/two)), coolant_on = coolant_on + coolant_bin #Maintain binary

sum of all coolants

currently on

coolantx = cantext$ - 50 #Create a coolantx value for string

select

pbld, n$, *scoolantx, e$ ]

suppress = zero ]

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

# Position calculations, generally these do not need to be modified # --------------------------------------------------------------------------

pmiscint$ #Capture the top level absinc for subprograms if sub_level$ <= zero, absinc$ = mi2$

pcheckaxis #Check for valid rotary axis

#If selected axis combination has more than 0 rotary axes and toolpath has rotation

if (mill5$ | rotary_type$ = 1 | rotary_type$ = 2) & rotaxerror = 1, [if mprint(srotaxerror, 2) = 2,

exitpost$]

pxyzcout #Map coordinates

xabs = vequ(x$) #Retrieve X,Y,Z positions into xabs,yabs,zabs iout = vequ(i$) 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)

pe_inc_calc #Incremental calculations, end !xia, !yia, !zia

!x$, !y$, !z$, !cc_pos$

# -------------------------------------------------------------------------- # Parameter read postblocks:

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

pprep$ #Pre-process postblock - Allows post instructions after the post is parsed but before the NC and

NCI file are opened.

#DO NOT ATTEMPT TO OUTPUT TO THE NC FILE IN THIS POSTBLOCK (OR ANY POSTBLOCKS YOU MAY CALL FROM HERE) BECAUSE

THE NC OUTPUT FILE IS NOT YET OPENED! rd_cd$ #Read CD Parameters

rd_mch_ent_no$ = 0 #Read only the machine base parameters (use to collect common parameters from

CNC_MACHINE_TYPE)

rd_md$ #Read machine definition parameters

pwrtt$ #Pre-read NCI file

if tool_info > 1 & t$ > 0 & gcode$ <> 1003, ptooltable

if ra_type$, ra_error = 1 #Aggregates NOT supported in this post

pwrttparam$ #Pre-read parameter data

#\

if prmcode$ = 15346, comp_type = rpar(sparameter$, 1) #Cutter compensation type - 0=computer, 1=control,

2=wear, 3=reverse wear, 4=off

if prmcode$ = 10010, xy_stock = rpar(sparameter$, 1) #Capture stock to leave (XY) if prmcode$ = 10068, z_stock = rpar(sparameter$, 1) #Capture stock to leave (Z)

pparameter$ #Read operation parameters

#rd_params is used to call pparameter postblock and read the parameters of the operation specified in

rd_param_op_no

#\

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

# Parameter lookup tables - You must adjust the size value if you add or remove any parameters to/from these

tables!

# -------------------------------------------------------------------------- # Machine Definition Parameters

fprmtbl 17000 4 #Table Number, Size

# Param Variable to load value into

17605 min_speed #Minimum spindle speed 17643 maxfeedpm #Limit for feed in inch/min 17651 maxfeedpm_m #Limit for feed in mm/min

17101 all_cool_off #First coolant off command shuts off ALL coolant options

# Control Definition Parameters

fprmtbl 18000 0 #Table Number, Size # Param Variable to load value into

# Toolpath Group Parameters

fprmtbl 19000 0 #Table Number, Size # Param Variable to load value into

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

pset_mach #Set post switches by reading machine def parameters rot_ax_cnt = 0 rotaxerror = 0

#maxfeedpm = 999999 #Uncomment these variables to force use of machine def values as initial lowest

max feedrate value

#maxfeedpm_m = 9999999 #Otherwise the default (post) initialization setting is used as initial value

!maxfeedpm, !maxfeedpm_m

rd_mch_ent_no$ = syncaxis$ #Retrieve machine parameters based on current axis combination - read from

.nci G950 line

rd_md$ #Read machine definition parameters - calls pmachineinfo$

#We only need this set at toolchange (and start of file). No need to set them each time a user may call

rd_md

if met_tool$ = 1, maxfeedpm = maxfeedpm_m #Set limit for feed in mm/min

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

# Machine definition and control definition parameter capture: # --------------------------------------------------------------------------

pmachineinfo$ #Machine information parameters postblock

#rd_md is used to call pmachineinfo postblock and read the parameters of the selected axis

本文来源:https://www.bwwdw.com/article/t153.html

Top