UGNX后置處理器定制培訓(xùn)_第1頁
UGNX后置處理器定制培訓(xùn)_第2頁
UGNX后置處理器定制培訓(xùn)_第3頁
UGNX后置處理器定制培訓(xùn)_第4頁
UGNX后置處理器定制培訓(xùn)_第5頁
已閱讀5頁,還剩163頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

UG后置處理器定制培訓(xùn)劉其榮優(yōu)集系統(tǒng)(中國)Qirong.liu@ugs800-810-1970Helpdesk_cn@ugs內(nèi)容后置處理概述后置處理器創(chuàng)建TCL語言介紹車銑加工中心后置處理器創(chuàng)建多軸銑后置處理創(chuàng)建后置處理概述基本概念后置處理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刀位數(shù)據(jù)數(shù)控加工指令后置處理UG/PostUG/POST的結(jié)構(gòu)UGDataStorageUGPostEventGeneratorEventHandler.tclDefinitionFile.defOutputFileEventNamevariableUserDefinedvariablevariablePostBuilder.puiUG/POST的結(jié)構(gòu)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(事件)–特定的機(jī)床動作SpindleOn主軸轉(zhuǎn)動;linearmove直線進(jìn)給;toolchange換刀…UnigraphicsEventGenerator(事件生成器)UG內(nèi)置的功能,用來提取UG刀位數(shù)據(jù)將參數(shù)傳遞到事件處理器進(jìn)行處理EventHandler(ATCLscript)——事件處理器與特定機(jī)床有關(guān)的程序,將刀位數(shù)據(jù)轉(zhuǎn)換為機(jī)床指令代碼DefinitionFile——定義文件給定事件處理輸出的格式,被事件處理器TCL所調(diào)用EVENT——事件一個事件是從UG文件中提取的一個數(shù)據(jù)集合每一事件都與一組變量關(guān)聯(lián)對每一事件生成器識別的事件,都有一對應(yīng)的TCL子程序進(jìn)行處理傳遞給事件處理器的變量將作為全局變量進(jìn)行處理EventGenerator——事件生成器從UG中提取刀軌數(shù)據(jù)將后處理命令分解成全局變量利用運(yùn)動學(xué)處理刀位點(diǎn)將事件和變量傳遞給UGPost進(jìn)行處理事件實例(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)一些有用的擴(kuò)展命令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定義文件中的關(guān)鍵字MACHINEINCLUDEWORD_SEPARATOREND_OF_LINESEQUENCEFORMATADDRESSBLOCKTEMPLATEMachine,Include&WordSeparatorMACHINE機(jī)床的名字MACHINEsiemen_3axisINCLUDE繼承的定義文件INCLUDEgeneric.defstandard.defWORD_SEPARATOR分割字符WORD_SEPARATOR“”Endofline&SequenceEND_OF_LINE每一行的結(jié)束符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 小數(shù)點(diǎn)左邊最大位數(shù)d=.or_ 輸出或不輸出小數(shù)點(diǎn)e

=0-9 小數(shù)點(diǎn)右邊最大位數(shù)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}后置處理調(diào)試調(diào)試信息輸出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進(jìn)行調(diào)試mom_debug_all.out

willbegenerated用mom_review.tcl進(jìn)行調(diào)試login12345_debug.out

willbegenerated常用的事件處理器和參數(shù)常用的事件處理器MOM_start_of_program —— 處理程序頭MOM_end_of_program —— 處理程序尾MOM_start_of_path —— 處理操作頭MOM_end_of_path —— 處理操作尾MOM_initial_move —— 處理初始運(yùn)動MOM_before_output —— 在輸出前進(jìn)行處理MOM_before_motion —— 在運(yùn)動前進(jìn)行處理常用的參數(shù)mom_pos —— 當(dāng)前位置數(shù)據(jù)mom_prev_pos —— 上一位置數(shù)據(jù)mom_motion_type —— 運(yùn)動類型mom_machine_time —— 加工時間mom_tool_number —— 刀具號mom_operation_type —— 操作類型查找更多參數(shù)?ChecktheDocumentationUsingPostBuilderUtilities->BrowseMOMVariablesUsingdebugtools后置處理器創(chuàng)建創(chuàng)建一后置處理器的流程獲取機(jī)床和控制系統(tǒng)數(shù)據(jù)PostBuilder測試輸出機(jī)床類型合格的后置處理器創(chuàng)建/編輯TCL文件創(chuàng)建/編輯def文件測試輸出錯誤錯誤正確正確特殊機(jī)床銑、車、車銑復(fù)合、線切割STOP針對PostBuilder中不包含的功能PostBuilder生成UG后置處理器的工具PostBuilder生成的文件:.pui——記憶PostBuilder的設(shè)定.tcl&.def——后置處理器PostBuilderMy.puiMy.tclMy.def創(chuàng)建一新后置處理器的基本步驟創(chuàng)建一檢驗零件,將通過該零件測試后置處理器覆蓋的功能。啟動PostBuilder利用一基礎(chǔ)機(jī)床配置創(chuàng)建一新的后處理器對新后置處理器進(jìn)行測試修正發(fā)現(xiàn)的錯誤啟動PostBuilderStart->Program->Unigraphics->PostTools->PostBuilder創(chuàng)建新的后處理器112345679創(chuàng)建新的后處理器(續(xù))設(shè)定參數(shù)創(chuàng)建新的后處理器(續(xù))保存后處理器123創(chuàng)建新的后處理器(續(xù))注冊新的后處理器到UG系統(tǒng)中1234創(chuàng)建新的后處理器(續(xù))注冊新的后處理器到UG系統(tǒng)中(續(xù))1234創(chuàng)建新的后處理器(續(xù))注冊新的后處理器到UG系統(tǒng)中(續(xù))1新建后置處理器的測試啟動UG軟件打開文件pbt_mill_test.prt進(jìn)入Manufacturing應(yīng)用選取一操作選取出現(xiàn)后處理對話框后置處理器參數(shù)設(shè)定后置處理器參數(shù)設(shè)定MachineToolProgram&ToolPathN/CDataDefinitionsOutputSettingsPostFilesPreviewMachineTool機(jī)床的運(yùn)動極限圓弧輸出機(jī)床精度軸是否鏡象如果是多軸機(jī)床,則完成軸的設(shè)定Program&ToolPathProgramGCodeMCodeWordSummaryWordSequencingCustomCommandLinkedPosts蘭色背景表示該行在其它地方也有應(yīng)用ProgramProgramStartSequence定義程序頭ProgramOperationStartSequence定義每一操作開始部分ProgramToolPathMachineControl機(jī)床控制命令ProgramToolPathMotion機(jī)床運(yùn)動命令LinearMoveCircularMoveRapidMoveCycleDefineProgramOperationEndSequence定義操作結(jié)束部分ProgramProgramEndSquence定義程序結(jié)束部分GCodes定義G代碼MCodes定義M代碼WordSummaryWordSequencingCustomCommandLinkedPostsN/CDataDefinitionsN/CDataDefinitionsN/CDataDefinitionsN/CDataDefinitionsOutputSettingsPostFilesPreviewPostFilesPreview實例將程序頭由“%”變?yōu)椤?”增加信息thisNCisforFanucController實例去除G01G28Z0.去除預(yù)選刀等實例調(diào)整進(jìn)行輸出和行號輸出實例調(diào)整輸出順序?qū)嵗斎胗脩裘顚嵗齽?chuàng)建用戶命令實例將用戶命令插入程序中實例將用戶命令插入程序中實例創(chuàng)建攻絲指令G84.112實例創(chuàng)建攻絲指令G84.13456實例創(chuàng)建攻絲指令G84.17實例創(chuàng)建攻絲指令G84.18實例創(chuàng)建攻絲指令G84.1910TCL介紹TCL介紹TCL——ToolCommandLanguage刀具命令語言DevelopedByJohnK.OusterhoutatUniversityofCalifornia,Berkeley解釋性語言用于UG/Post,ProcessAssistants,ShopDocumentation,Clsf文件創(chuàng)建和后置處理創(chuàng)建中可從網(wǎng)站scriptics/software/tcltk下載Tcl8.3進(jìn)行安裝運(yùn)行也可運(yùn)行\(zhòng)mach\auxiliary目錄下的ugwish進(jìn)入TCL命令環(huán)境TCL命令(Command)結(jié)構(gòu)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)]

proccircumferencephvgrqe{

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)車銑加工中心后置處理器創(chuàng)建創(chuàng)建步驟創(chuàng)建一2軸車削后置處理器創(chuàng)建一銑削后置處理器,選用mill-turn選項設(shè)置需要的參數(shù)保存銑車后置處理器確保所有的車削操作位于節(jié)點(diǎn)MCS_SPINDLE下確保所有的銑削操作位于節(jié)點(diǎn)MCS_MIL

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論