UGNX后置处理器定制培训_第1页
UGNX后置处理器定制培训_第2页
UGNX后置处理器定制培训_第3页
UGNX后置处理器定制培训_第4页
UGNX后置处理器定制培训_第5页
已阅读5页,还剩163页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

UG后置处理器定制培训刘其荣优集系统(中国)Qirong.liu@ugs800-810-1970Helpdesk_cn@ugs内容后置处理概述后置处理器创建TCL语言介绍车铣加工中心后置处理器创建多轴铣后置处理创建后置处理概述基本概念后置处理TOOLPATH/FIXED_CONTOUR_2,TOOL,MILLTLDATA/MILL,30.0000,0.0000,75.0000,0.0000,0.0000MSYS/0.0000,0.0000,0.0000,1.0000000,0.0000000,0.0000000,0.0000000,1.0000000,0.0000000PAINT/PATHPAINT/SPEED,10LOAD/TOOL,1,ZOFF,150.0000PAINT/COLOR,186RAPIDGOTO/51.5000,-12.6421,12.1213,0.5000000,0.5000000,0.7071068PAINT/COLOR,211RAPIDGOTO/95.0000,30.8579,73.6396PAINT/COLOR,42FEDRAT/MMPM,250.0000GOTO/50.0000,-14.1421,10.0000PAINT/COLOR,31GOTO/-14.1421,50.0000,10.0000PAINT/COLOR,37RAPIDGOTO/30.8579,95.0000,73.6396PAINT/SPEED,10PAINT/TOOL,NOMOREEND-OF-PATH%N0010G40G17G94G90G71N0020G91G28Z0.0:0030T01M06N0040G0G90X45.355Y37.426A-45.C-45.S1000M03N0050G43Z213.858H00N0060Z300.858N0070G1Z210.858F250.M08N0080X-45.355N0090G0Z300.858N0100M02%UG刀位数据数控加工指令后置处理UG/PostUG/POST的结构UGDataStorageUGPostEventGeneratorEventHandler.tclDefinitionFile.defOutputFileEventNamevariableUserDefinedvariablevariablePostBuilder.puiUG/POST的结构UGDataStorageLinearMovex=100y=50z=75UGPostEventGeneratorprocMOM_linear_move{}{MOM_do_templateLinear}FormatSocket%0.3fAddressX{FormatSocketMin0Max550}BLOCK_TEMPLATELinear{G01X[$x]Y[$y]Z[$z]}G01X100.Y50.Z75.Linear_Movex=100y=50z=7554321基本概念Event(事件)–特定的机床动作SpindleOn主轴转动;linearmove直线进给;toolchange换刀…UnigraphicsEventGenerator(事件生成器)UG内置的功能,用来提取UG刀位数据将参数传递到事件处理器进行处理EventHandler(ATCLscript)——事件处理器与特定机床有关的程序,将刀位数据转换为机床指令代码DefinitionFile——定义文件给定事件处理输出的格式,被事件处理器TCL所调用EVENT——事件一个事件是从UG文件中提取的一个数据集合每一事件都与一组变量关联对每一事件生成器识别的事件,都有一对应的TCL子程序进行处理传递给事件处理器的变量将作为全局变量进行处理EventGenerator——事件生成器从UG中提取刀轨数据将后处理命令分解成全局变量利用运动学处理刀位点将事件和变量传递给UGPost进行处理事件实例(1)后处理命令:SPINDL/RPM,100,CLW时间和变量Event事件MOM_spindle_rpmVariables变量mom_spindle_speed=100mom_spindle_direction=CLW事件实例(2)StartofprogramEventMOM_start_of_programVariablesmom_datemom_logname…StartofanewpathEventMOM_start_of_pathVariablesmom_path_namemom_tool_name…EventHandler——事件处理器TCL子程序,决定刀轨事件如何被处理事例:procMOM_start_of_program{}{MOM_output_literal“G28G00G91Z0”MOM_output_literal“X0Y0”MOM_output_literal“G90”}UGPostExtensionstoTCL(1)一些有用的扩展命令MOM_ask_env_varMOM_ask_env_varUGII_CAM_DEBUG_DIRMOM_output_literalMOM_output_literal“Createdby$mom_logname”MOM_do_templateMOM_do_templatelinear_moveUGPostExtensionstoTCL(2)MOM_forceMOM_forceONCE

XY

MOM_forceALWAYS

XYmotion_gMOM_forceOFF

motion_gMOM_suppressMOM_suppressONCE

cutcom_gMOM_suppressALWAYS

NMOM_suppressOFF

IJK定义文件中的关键字MACHINEINCLUDEWORD_SEPARATOREND_OF_LINESEQUENCEFORMATADDRESSBLOCKTEMPLATEMachine,Include&WordSeparatorMACHINE机床的名字MACHINEsiemen_3axisINCLUDE继承的定义文件INCLUDEgeneric.defstandard.defWORD_SEPARATOR分割字符WORD_SEPARATOR“”Endofline&SequenceEND_OF_LINE每一行的结束符END_OF_LINE“\012”SEQUENCE输出序号格式:SEQUENCEformatstartincrementfrequencySEQUENCEseq_no1011定义文件基本概念BlockG01X54.11Y-28.059Z55.B0.0Address(Word)X54.11FormatX54.11FORMAT语法FORMATnameformat_string事例FORMATseq_no“&__5_00”FORMATComFed“%7.2f”FORMATSocket_2“&_02_00”Formatstring&abcdefa=+or_输出或不输出+号b=0or_ 输出或不输出前面的0c=0-9 小数点左边最大位数d=.or_ 输出或不输出小数点e

=0-9 小数点右边最大位数f=0or_ 输出或不输出后面的0C语言格式任何合法的C语言printf格式Address语法ADDRESSname{ FORMATname ZERO_FORMATname

FORCE<ALWAYS|ONCE|OFF>

MAX number<Abort|Warning|Truncate> MIN number<Abort|Warning|Truncate> LEADER<string|TCL_expression> TRAILER<string|TCL_expression> INCREMENTAL <ON|OFF> OMIT value}Address实例FORMATSocket_2 “&_02_00”

ADDRESScutcom_register{ FORMATSocket_2 FORCEOFF MAX99 MIN0 LEADER“D”}BlockTemplate语法BLOCK_TEMPLATEname{ Address_name[address_expression] \nows (nowordseparator) \opt (optional) \ldr=string (leader) \trlr=string (trailer) “string” (stringoutputliterally)}BlockTemplate实例BLOCK_TEMPLATErapid_XY{ cutcom_g[$mom_cutcom_code]\opt motion_g[0] X[$mom_pos(0)] Y[$mom_pos(1)] cutcom_register[$mom_cutcom_adjust_register]\opt}后置处理调试调试信息输出mom_information.outMove(orcopy)wish83.exeto:…\mach\auxiliary\ugwish.exeSourcethefollowingTCLscriptfilesinUGII_CAM_DEBUG_DIR mom_debug.tcl or mom_review.tclTurnthedebugmodeonMOM_set_debug_modeON用mom_debug.tcl进行调试mom_debug_all.out

willbegenerated用mom_review.tcl进行调试login12345_debug.out

willbegenerated常用的事件处理器和参数常用的事件处理器MOM_start_of_program —— 处理程序头MOM_end_of_program —— 处理程序尾MOM_start_of_path —— 处理操作头MOM_end_of_path —— 处理操作尾MOM_initial_move —— 处理初始运动MOM_before_output —— 在输出前进行处理MOM_before_motion —— 在运动前进行处理常用的参数mom_pos —— 当前位置数据mom_prev_pos —— 上一位置数据mom_motion_type —— 运动类型mom_machine_time —— 加工时间mom_tool_number —— 刀具号mom_operation_type —— 操作类型查找更多参数?ChecktheDocumentationUsingPostBuilderUtilities->BrowseMOMVariablesUsingdebugtools后置处理器创建创建一后置处理器的流程获取机床和控制系统数据PostBuilder测试输出机床类型合格的后置处理器创建/编辑TCL文件创建/编辑def文件测试输出错误错误正确正确特殊机床铣、车、车铣复合、线切割STOP针对PostBuilder中不包含的功能PostBuilder生成UG后置处理器的工具PostBuilder生成的文件:.pui——记忆PostBuilder的设定.tcl&.def——后置处理器PostBuilderMy.puiMy.tclMy.def创建一新后置处理器的基本步骤创建一检验零件,将通过该零件测试后置处理器覆盖的功能。启动PostBuilder利用一基础机床配置创建一新的后处理器对新后置处理器进行测试修正发现的错误启动PostBuilderStart->Program->Unigraphics->PostTools->PostBuilder创建新的后处理器112345679创建新的后处理器(续)设定参数创建新的后处理器(续)保存后处理器123创建新的后处理器(续)注册新的后处理器到UG系统中1234创建新的后处理器(续)注册新的后处理器到UG系统中(续)1234创建新的后处理器(续)注册新的后处理器到UG系统中(续)1新建后置处理器的测试启动UG软件打开文件pbt_mill_test.prt进入Manufacturing应用选取一操作选取出现后处理对话框后置处理器参数设定后置处理器参数设定MachineToolProgram&ToolPathN/CDataDefinitionsOutputSettingsPostFilesPreviewMachineTool机床的运动极限圆弧输出机床精度轴是否镜象如果是多轴机床,则完成轴的设定Program&ToolPathProgramGCodeMCodeWordSummaryWordSequencingCustomCommandLinkedPosts兰色背景表示该行在其它地方也有应用ProgramProgramStartSequence定义程序头ProgramOperationStartSequence定义每一操作开始部分ProgramToolPathMachineControl机床控制命令ProgramToolPathMotion机床运动命令LinearMoveCircularMoveRapidMoveCycleDefineProgramOperationEndSequence定义操作结束部分ProgramProgramEndSquence定义程序结束部分GCodes定义G代码MCodes定义M代码WordSummaryWordSequencingCustomCommandLinkedPostsN/CDataDefinitionsN/CDataDefinitionsN/CDataDefinitionsN/CDataDefinitionsOutputSettingsPostFilesPreviewPostFilesPreview实例将程序头由“%”变为“#”增加信息thisNCisforFanucController实例去除G01G28Z0.去除预选刀等实例调整进行输出和行号输出实例调整输出顺序实例输入用户命令实例创建用户命令实例将用户命令插入程序中实例将用户命令插入程序中实例创建攻丝指令G84.112实例创建攻丝指令G84.13456实例创建攻丝指令G84.17实例创建攻丝指令G84.18实例创建攻丝指令G84.1910TCL介绍TCL介绍TCL——ToolCommandLanguage刀具命令语言DevelopedByJohnK.OusterhoutatUniversityofCalifornia,Berkeley解释性语言用于UG/Post,ProcessAssistants,ShopDocumentation,Clsf文件创建和后置处理创建中可从网站scriptics/software/tcltk下载Tcl8.3进行安装运行也可运行\mach\auxiliary目录下的ugwish进入TCL命令环境TCL命令(Command)结构Built-incommandorprocedureFormatcommandargarg...Example:setx10getsstdinyputsstdout“Hello,World!”

TCLScripts由一系列命令组成由“#”表示注释Variable(1)NospecificdatatypeNotnecessarytodeclarevariablesbeforeyouusethemVariablenameiscase-sensitiveUsesetcommandtoassignavaluetoavariable:setmessage“Thisisamessage”A=10SetA10Variable(2)Use$toobtainthevalueofavariable(dollar-signvariablesubstitution)puts$messageUseunsettodeleteavariableunsetxyzVariable(3)LocalvariablesareusedinsideofaprocGlobevariablesareusedinthetotaltclscriptsglobenameVariable(4)Mathematicaloperatorscanbeused:+,-,*,/Mathematicalexpressionsareperformedbyexprcommandsetb[expr$a+$b]TCLinNT(1)TCLShellforexecutingTCLcommandsinteractively.tclsh83.exe%%setx10%10%puts“Hello,World!”%Hello,World!TCLinNT(2)ScriptingCreateascriptfilewithseriesofcommandssomething.tclputs-nonewlinestdout“Yourage:“

flushstdout

getsstdinage

if{$age<10}{

putsstdout“Youaretooyoung”

}else{putsstdout“Youaretooold”}Executethescripttclsh83.exesomething.tclCommandSubstitutionNestedcommandisdelimitedbysquarebrackets[]setstr“Tobeornottobe”

setlen[stringlength$str]MathexpressionsexprcommandisusedtoevaluatemathexpressionsAnswerisreturnedasastringExample:settool_d25.0

setper50

setstepover[expr$tool_d*$per/100]Precisioncontrol(1)Alloperandsareinintegerformatsetres[expr4/3]Retrun1Oneoperandisindoubleformatsetres[expr4.0/3]Return1.33333333333Precisioncontrol(2)Castingsetres[expr4/double(3)]Return1.33333333333[exprdouble([expr4/3])]Return1Onemoreexamplesetx3.333

setres[exprint($x)/2]Return1Precisioncontrol(3)tcl_precision

internalvariableControlnumberofsignificantdigitsdefaultvalueis12Examplesettcl_precision4

expr4/3.0Return1.333OperatorsMathematical*/%+-Boolean<,>,<=,>=,==,!=Bit-wise&(AND),|(OR),^(exclusiveOR)Logical&&(AND),||(OR)If-then-elsex?y:zMathandconversionfunctionssin,cos,tantanh,cosh,sinhasin,acos,atan,atan2log,log10,expsqrt,floor,ceil…abs,double,intArrayFormat:arrayname(index)Indexcanbeanystringsettool(diameter)10

settool(radius)2

settool(length)50Arraycommand(1)Setpairsofelementsofindexnameanvaluesofanarrayarray

set

arraynamelistsethd“sg3gb10sg5gb20ibm3gb12ibm5gb22”

arraysetHardDisk$hdResultHardDisk(sg3gb) 10HardDisk(sg5gb) 20HardDisk(ibm3gb) 12HardDisk(ibm5gb) 22Arraycommand(2)Askforexistenceofanarrayarrayexistsarrayname

Return1ifarrayexist,otherwise0Getindexnamesofanarrayarraynames

arrayname?pattern?arraynamesHardDisk*3gbReturnastringsg3gbibm3gbArraycommand(3)Getpairsofelementcontainingnamesandvaluesofanarrayarraygetarrayname?pattern?

arraygetHardDiskReturnibm3gb12sg5gb20ibm5gb22sg3gb10Theorderofthepairsisundefined.incrcommandFormatincrvariable?increment?Bothvariableandincrementmustbeinteger,positiveornegativeExampleseta5

incra (a=6)

incra2 (a=8)

incra–5 (a=3)BackslashsubstitutionToquotespecialcharactersputs“Giveme\$100”Result:Giveme$100Non-visiblecharacterssetbell\x07

puts$bellMulti-linecontinuationsetlooongstring\

“veryloooooooooooooooongstring”Grouping(1)GroupingwithdoublequotesAllowsubsitutionstooccurinsidetheqroupseta“something”

setb“Thisis$a”Result:b=ThisissomethingAnotherexampleseta5

setb2

setc[expr2*“$a.$b”]Result:10.4Grouping(2)GroupingwithcurlybracesPreventsubsitutiontooccurinsidetheqroupseta“something”

setb{Thisis$a}Result:b=Thisis$aApplytocommand,variableandbackslashsubstitutionsProcedure(1)Todefineaprocedure:procnameparametersbody

Exampleprocdiag{ab}{

setc[exprsqrt($a*$a+$b*$b)]

return$c

}Procedure(2)AprocedureisusedjustlikeanyotherTCLcommandsetres[diag34]

puts“Diagonalofa3x4rectangleis$res”ArgumentsarepassedbytherevalueVariablesdefinedinsideaprocedurearelocalvariablesLifespanforthedurationoftheprocedurecallonlyNotvisibleoutsidetheprocedureProcedure(3)VariablesdefinedoutsideanyprocedureareglobalNotvisibleinsideanyprocedureautomaticallyuse

global

commandtomakeitvisibleinsideaproceduresetpi[expr2*asin(1.0)]

proccircumference{d}{

globalpi

expr$d*$pi

}

Procedure(4)Returnresultfromlastcommandprocadd{}{

expr1+2}puts[add] (3)Returnresultusingreturncommandprocadd{}{expr1+2return5}puts[add] (5)ControlStructureCommands(1)If{boolean}{body}if{boolean}{body}else{body}if{boolean}{

body}elseif{boolean}{

...

body}else{

body}

ControlStructureCommands(2)while{boolean}{body}for{start}{test}{next}{body}for{seti0}{$i<10}{incri}{puts$i}switchcatcherrorControlStructureCommands(2)for{start}{test}{next}{body}for{seti0}{$i<10}{incri}{puts$i}ControlStructureCommands(3)while{boolean}{body}ControlStructureCommands(4)SwitchControlStructureCommands(3)foreach{variable}{list}{body}setstr“dia10rad5len50”

arraysettool$str

foreach{keyvalue}[arraygettool]{

puts“$key:$value”}Result: dia:10

rad:5

len:50stringcommandFirstcharacterisindexnumber0stringcomparestring1string2stringlengthstringstringindexstringindexstringtrimleftstringcharsstringtrimrightstringcharsstringrangestringij

formatcommandSimilartosprintfinCformat

formatString

arg1arg2…Example:setres[expr1.0/3]puts[format“Result:%.3f”$res]Output:Result:0.333

Procedure(5)Calledbynameusingupvarcommandupvar?level?passed-variablevariableprocuv{a}{

upvar$ab

incrb;puts$b

}

setx10;uvx

puts$xBothputsoutput11Procedure(6)Defaultvalueofparametersprocdiscount{p{d0.9}}{

expr$p*$d

}

puts[discount100](output90.0)

puts[discount1000.8](output80.0)parameterswithoutdefaultvaluemustbeputinfrontProcedure(7)Variablenumberofargumentproctest{abargs}{

puts-nonewline[llength$args]

foreacharg$args{

puts-nonewline$arg

}

}

testabcdeOutput:3cdeargsmustbethelastargumentFile(1)opencommandopenfileaccessreturnafileIDsetfid[open“d:\\test.txt”“RDWRCREAT”]

puts$fid“Something”AccessRDONLY(readonly),WRONLY(writeonly)RDWR(read/write),APPEND,CREATTRUNC(truncated)File(2)close

commandtocloseanopenedfileclose$fidinfocommandinfoexistsvariable-nameinfohostnameinfotclversioninfolevel?number?evalcommandEvaluateaTCLscriptsetcmd“puts[infohostname]”

eval$cmdReturnthehostnameoflocalmachineSimpleTkprogramPowerfultoolforbuildingGUIwish83.exeCreateatkscriptfile,e.g.my.tk button.b-textHello-commandexit

pack.bExecutethetkscriptwish83my.tkBi-directionalpipesusingopenopencommandcanbeusedforopeningachannelsetfid[open“|wish83my.tk”“RDWR”]Bothstdinandstdoutofmy.tkwillberedirectedtothecurrentprogramThecurrentprogramuseputs$fidand

gets$fidtocommunicatewithmy.tkBi-directionalpipesexample(1)my.tkproccal{}{

getsstdinexp

putsstdout[expr$exp]

exit

}

button.c-textCalculate-commandcal

pack.cBi-directionalpipesexample(2)my.tclsetfid[open“|wish83my.tk”“RDWR”]

fconfigure$fid-bufferingline

puts$fid“1.0/7”

gets$fidresult

puts$resultResourcesTclDeveloperXchange://dev.scripticsBooksPracticalProgramminginTcl&TkBrentWelch(PrenticeHall)EffectiveTcl/TkProgramming:

WritingBetterProgramswithTclandTkMarkHarrisonandMichaelMcLennan(Addison-Wesley)车铣加工中心后置处理器创建创建步骤创建一2轴车削后置处理器创建一铣削后置处理器,选用mill-turn选项设置需要的参数保存铣车后置处理器确保所有的车削操作位于节点MCS_SPINDLE下确保所有的铣削操作位于节点MCS_MIL

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论