您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > 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
本文标题:UG后处理定制命令英文解说
链接地址:https://www.777doc.com/doc-2864493 .html