UG后处理定制命令英文解说

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

POSTBUILDERCUSTOMCOMMANDSInthisNXAtoZarticle,wearegoingtotalkaboutwritingcustomcommandsinPostBuilder.Customcommandsallowyoutogetjustaboutwhateveryouwantinyourmachinecodefile.WeallknowthatthegraphicaltoolswithinPostBuilderprovideagreatwaytoconfigurethestandardcomponentsofapostprocessor,butwhataboutthenon-standardstuff–thatiswhatcustomcommandsarefor.ForanintroductiontoPostBuilder,clickhere.TCLPostprocessorswrittenforNXarewritteninalanguagecalledTCL(ToolCommandLanguage).TCLisascriptinglanguage,meaningthatitisnotcompiled,andit’ssyntaxresemblesC.TCLisafairlystraightforwardlanguage;however,it’ssyntaxcanbetroublesome.ThelinkbelowisaverygoodresourceforlearningTCL;however,thebestmethodforwritingTCListocopyitfromanexistingcustomcommandthatimplementsthesamefunctionyouaretryingtoimplementandthenchangethevariablesandexpressionsasrequired.Forexample,ifyouaretryingtowriteandif…elseloop,justfindoneinanexistingcustomcommandandchangeitasrequiredtosuityourdesiredfunctionality.Thiswillhelptoeliminatealotoftheheadachesduetosyntaxerrors.(MOM)Beforeyouwritecustomcommands,youfirstneedtounderstandhowNXcommunicateswithyourpostprocessor.WhenyoupostprocessaprogramfromwithNX,NXstartsaprogramcalledNXPost.TheprimarycomponentofNXPostistheManufacturingOutputManager(MOM).MOMisdescribedintheNXHelpDocumentationasfollows:TheManufacturingOutputManager(MOM)isthecentralcoreoftheNXPostpostprocessormodule.MOMconvertstoolpathsfrommodelfilesintomanufacturingoutput(machinecode)byaddingtherequiredfunctionsanddataasdescribedbelow:TheEventGeneratorreadsthroughthetoolpathdata,extractseventsandtheirassociatedvariableinformation,thenpassestheeventstoMOMforprocessing.MOMapplieskinematicstotheoutputthenpassestheeventwithitsassociateddatatotheEventHandler.TheEventHandlercreatestheevent,processesittodeterminetheactionsrequired,thenreturnsthedatatoMOM.MOMreadstheDefinitionFiletodeterminehowtoformattheoutputforthemachinetoolcontrol.MOMwritestheformattedoutputtothespecifiedOutputFileasmachinecode.So,essentially,MOMreadsthetoolpathinNXandthenfeedsthetoolpaththroughthepostprocessortogeneratethemachinecode.Inordertowritecustomcommands,youhavetointercepttheinformationthatMOMissendingtothepostprocessorandthenmanipulateithoweveryouwantandthensendittothemachinecodefile.AlloftheinformationthatMOMsendsisintheformofMOMvariables;furthermore,therearebuilt-incommandsavailableforyoutouseinyourcustomcommandandthesearecalledMOMcommands.Youcanseeallofthesevariablesandbuilt-incommandsandtheirdescriptionsbyclickingontheUtilitiesmenuinPostBuilderandselectBrowseMOMVariables.Youwillseethewindowshownbelow.Thebuilt-incommandsstartwithanuppercaseMOMandthevariableswithlowercasemom.Therearewaytoomanybuilt-incommandsandvariablestogothroughthem.TheapproachthatwewilluseistosetouttodosomethingspecificwithourpostprocessorandthenusedtheMOMVariablesbrowsertofindthevariablesandbuilt-incommandsweneed.SothenextstepistoopenourpostprocessorandselecttheCustomCommandstabasshownbelow.ThisisapostprocessorthatcomeswithNXfora5-axistabletablemill.Mostofthecustomcommandsthatyouseeinthelistarecreatedbydefaultwhenyoucreateanewpostprocessor.Someareusedbydefaultincertainpartsoftheprogramandtherestareavailableshouldyouneedthem.Forexample,thecustomcommandshownbelow,PB_CMD_tool_change_force_addressesisputintothetoolchangeeventbydefaultwhenanewpostiscreated.ItusestheMOM_forcebuilt-incommandtoforcetheoutputofthetoollengthcompensationdata.CustomcommandslikePB_CMD_clamp_fourth_axisaredrivenbymachinecontroleventsinNXanddonotappearinanytoolpathevents.CustomcommandslikePB_CMD_nurbs_initializearenotusedbydefaultandmustbeplacedinaneventmarkeraftertheposthasbeencreatediftheyaretobeused.Thereisalsoalibraryofcustomcommandsavailabletobeimportedintoapostprocessor.IfyouclickImportyouwillseethelistshownbelow.TherealotofcustomcommandsavailableandtheyaredescribedintheDocumentationunderManufacturing-PostBuilder-ProgramandToolPath-CustomCommand-CustomCommandLibrary.Soenoughaboutallthecustomcommandsthatarealreadydone,let’swriteoneofourown.Itisjustasimplecustomcommandtoputnameoftheprogramatthestartofthemachinecodefile.InPostBuilder,clickCreateontheCustomCommandtabandPostBuilderwillcreateacopyofwhatevercustomcommandyouhaveselectedasshownbelow.SodeleteallthecodeandrenamethecustomcommandPB_CMD_program_name.NowweneedavariablethatcomesfromNXwiththenameoftheprogramandabuiltincommandthatwilloutputthenametothemachinecodefile.IfyouopentheMOMVariablesBrowerandsearchprogramname,youwillseethatmom_group_nameisthevariablethatwewantandifyousetthesearchcategorytoMOMCommandandsearchforoutput,youwillseethatMOM_output_literalisthebuildincommandthatwewant.SoinourCustomcommand,wetypeglobalmom_group_nameMOM_output_literal“ProgramName:$mom_group_name”Thefirstlineisavariabledeclaration.Wearedeclaringthevariablemom_group_nameandtheglobalstatementindicatesthescopeofthevariable.TheglobalscopeistheentireMOMprocess,meaningthatifthereisalreadyavariablewiththenamemom_group_namethatexistsan

1 / 9
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功