收藏 分享(赏)

UG后置处理器定制培训.ppt

上传人:暖洋洋 文档编号:1613683 上传时间:2018-08-12 格式:PPT 页数:168 大小:5.92MB
下载 相关 举报
UG后置处理器定制培训.ppt_第1页
第1页 / 共168页
UG后置处理器定制培训.ppt_第2页
第2页 / 共168页
UG后置处理器定制培训.ppt_第3页
第3页 / 共168页
UG后置处理器定制培训.ppt_第4页
第4页 / 共168页
UG后置处理器定制培训.ppt_第5页
第5页 / 共168页
点击查看更多>>
资源描述

1、UG后置处理器定制培训,刘其荣 优集系统(中国)有限公司 精艺工作室,内容,后置处理概述 后置处理器创建 TCL语言介绍 车铣加工中心后置处理器创建 多轴铣后置处理创建,后置处理概述,基本概念,后置处理,TOOL PATH/FIXED_CONTOUR_2,TOOL,MILL TLDATA/MILL,30.0000,0.0000,75.0000,0.0000,0.0000 MSYS/0.0000,0.0000,0.0000,1.0000000,0.0000000,0.0000000,0.0000000,1.0000000,0.0000000 PAINT/PATH PAINT/SPEED,10 L

2、OAD/TOOL,1,ZOFF,150.0000 PAINT/COLOR,186 RAPID GOTO/51.5000,-12.6421,12.1213,0.5000000,0.5000000,0.7071068 PAINT/COLOR,211 RAPID GOTO/95.0000,30.8579,73.6396 PAINT/COLOR,42 FEDRAT/MMPM,250.0000 GOTO/50.0000,-14.1421,10.0000 PAINT/COLOR,31 GOTO/-14.1421,50.0000,10.0000 PAINT/COLOR,37 RAPID GOTO/30.85

3、79,95.0000,73.6396 PAINT/SPEED,10 PAINT/TOOL,NOMORE END-OF-PATH,% N0010 G40 G17 G94 G90 G71 N0020 G91 G28 Z0.0 :0030 T01 M06 N0040 G0 G90 X45.355 Y37.426 A-45. C-45. S1000 M03 N0050 G43 Z213.858 H00 N0060 Z300.858 N0070 G1 Z210.858 F250. M08 N0080 X-45.355 N0090 G0 Z300.858 N0100 M02 %,UG刀位数据,数控加工指令

4、,后置处理 UG/Post,UG/POST的结构,UG Data Storage,UG Post,Event Generator,Event Handler .tcl,Definition File .def,Output File,Event Name,variable,User Defined,variable,variable,Post Builder .pui,UG/POST的结构,基本概念,Event (事件) 特定的机床动作 Spindle On主轴转动; linear move直线进给; tool change换刀 Unigraphics Event Generator (事件生

5、成器) UG内置的功能,用来提取UG刀位数据 将参数传递到事件处理器进行处理 Event Handler (A TCL script)事件处理器 与特定机床有关的程序,将刀位数据转换为机床指令代码 Definition File定义文件 给定事件处理输出的格式,被事件处理器 TCL所调用,EVENT事件,一个事件是从UG文件中提取的一个数据集合 每一事件都与一组变量关联 对每一事件生成器识别的事件,都有一对应的TCL子程序进行处理 传递给事件处理器的变量将作为全局变量进行处理,Event Generator事件生成器,从UG中提取刀轨数据 将后处理命令分解成全局变量 利用运动学处理刀位点 将事

6、件和变量传递给UG Post进行处理,事件实例(),后处理命令: SPINDL/RPM,100,CLW 时间和变量 Event事件 MOM_spindle_rpm Variables变量 mom_spindle_speed = 100 mom_spindle_direction = CLW,事件实例(),Start of program Event MOM_start_of_program Variables mom_date mom_logname Start of a new path Event MOM_start_of_path Variables mom_path_name mom_

7、tool_name ,Event Handler事件处理器,TCL子程序,决定刀轨事件如何被处理 事例: proc MOM_start_of_program MOM_output_literal “G28G00G91Z0”MOM_output_literal “X0Y0”MOM_output_literal “G90” ,UG Post Extensions to TCL (1),一些有用的扩展命令 MOM_ask_env_var MOM_ask_env_var UGII_CAM_DEBUG_DIR MOM_output_literal MOM_output_literal “Created

8、by $mom_logname” MOM_do_template MOM_do_template linear_move,UG Post Extensions to TCL (),MOM_force MOM_force ONCE X Y MOM_force ALWAYS X Y motion_g MOM_force OFF motion_g MOM_suppress MOM_suppress ONCE cutcom_g MOM_suppress ALWAYS N MOM_suppress OFF I J K,定义文件中的关键字,MACHINE INCLUDE WORD_SEPARATOR EN

9、D_OF_LINE SEQUENCE FORMAT ADDRESS BLOCK TEMPLATE,Machine , Include & Word Separator,MACHINE 机床的名字 MACHINE siemen_3axis INCLUDE 继承的定义文件 INCLUDE generic.def standard.def WORD_SEPARATOR 分割字符 WORD_SEPARATOR “ ”,End of line & Sequence,END_OF_LINE 每一行的结束符 END_OF_LINE “012” SEQUENCE 输出序号 格式: SEQUENCE forma

10、t start increment frequency SEQUENCE seq_no 10 1 1,定义文件,基本概念,Block G01 X54.11 Y-28.059 Z55. B0.0 Address (Word) X54.11Format X54.11,FORMAT,语法 FORMAT name format_string 事例 FORMAT seq_no “&_5_00” FORMAT ComFed “%7.2f” FORMAT Socket_2 “&_02_00”,Format string,&abcdef a = + or _ 输出或不输出号 b = 0 or _ 输出或不输出

11、前面的 c = 0 - 9 小数点左边最大位数 d = . or _ 输出或不输出小数点 e = 0 - 9 小数点右边最大位数 f = 0 or _ 输出或不输出后面的 C 语言格式 任何合法的 C语言 printf格式,Address,语法 ADDRESS name FORMAT nameZERO_FORMAT name FORCE MAX number MIN number LEADER TRAILER INCREMENTAL OMIT value ,Address 实例,FORMAT Socket_2 “&_02_00” ADDRESS cutcom_register FORMAT S

12、ocket_2FORCE OFFMAX 99MIN 0LEADER “D” ,Block Template,语法 BLOCK_TEMPLATE name Address_name address_expression nows (no word separator)opt (optional)ldr = string (leader)trlr = string (trailer)“string” (string output literally) ,Block Template 实例,BLOCK_TEMPLATE rapid_XY cutcom_g$mom_cutcom_codeoptmoti

13、on_g0X$mom_pos(0)Y$mom_pos(1)cutcom_register$mom_cutcom_adjust_registeropt ,后置处理调试,调试,信息输出 mom_information.out Move (or copy) wish83.exe to: machauxiliaryugwish.exe Source the following TCL script files in UGII_CAM_DEBUG_DIRmom_debug.tcl ormom_review.tcl Turn the debug mode on MOM_set_debug_mode ON,

14、用 mom_debug.tcl进行调试,mom_debug_all.out will be generated,用 mom_review.tcl进行调试,login12345_debug.out will be generated,常用的事件处理器和参数,常用的事件处理器,MOM_start_of_program 处理程序头 MOM_end_of_program 处理程序尾 MOM_start_of_path 处理操作头 MOM_end_of_path 处理操作尾 MOM_initial_move 处理初始运动 MOM_before_output 在输出前进行处理 MOM_before_mot

15、ion 在运动前进行处理,常用的参数,mom_pos 当前位置数据 mom_prev_pos 上一位置数据 mom_motion_type 运动类型 mom_machine_time 加工时间 mom_tool_number 刀具号 mom_operation_type 操作类型,查找更多参数 ?,Check the DocumentationUsing Post Builder Utilities - Browse MOM VariablesUsing debug tools,后置处理器创建,创建一后置处理器的流程,获取机床和控制系统数据,Post Builder,测试输出,机床类型,合格的

16、后置处理器,创建编辑TCL文件,创建编辑def文件,测试输出,错误,错误,正确,正确,特殊机床,铣、车、车铣复合、线切割,STOP,针对Post Builder中不包含的功能,Post Builder,生成UG后置处理器的工具 Post Builder生成的文件: .pui 记忆Post Builder的设定 .tcl & .def 后置处理器,Post Builder,My.pui,My.tcl My.def,创建一新后置处理器的基本步骤,创建一检验零件,将通过该零件测试后置处理器覆盖的功能。 启动Post Builder 利用一基础机床配置创建一新的后处理器 对新后置处理器进行测试 修正发

17、现的错误,启动Post Builder,Start - Program - Unigraphics - Post Tools - Post Builder,创建新的后处理器,创建新的后处理器(续),设定参数,创建新的后处理器(续),保存后处理器,创建新的后处理器(续),注册新的后处理器到UG系统中,2,3,4,创建新的后处理器(续),注册新的后处理器到UG系统中(续),2,3,4,创建新的后处理器(续),注册新的后处理器到UG系统中(续),新建后置处理器的测试,启动UG软件 打开文件pbt_mill_test.prt 进入Manufacturing应用 选取一操作 选取 出现后处理对话框,后置

18、处理器参数设定,后置处理器参数设定,Machine Tool Program & Tool Path N/C Data Definitions Output Settings Post Files Preview,Machine Tool,机床的运动极限 圆弧输出 机床精度 轴是否镜象 如果是多轴机床,则完成轴的设定,Program & Tool Path,Program G Code M Code Word Summary Word Sequencing Custom Command Linked Posts,兰色背景表示该行在其它地方也有应用,Program,Program Start S

19、equence 定义程序头,Program,Operation Start Sequence 定义每一操作开始部分,Program,Tool Path Machine Control 机床控制命令,Program,Tool Path Motion 机床运动命令,Linear Move,Circular Move,Rapid Move,Cycle Define,Program,Operation End Sequence 定义操作结束部分,Program,Program End Squence 定义程序结束部分,G Codes,定义G代码,M Codes,定义M代码,Word Summary,W

20、ord Sequencing,Custom Command,Linked Posts,N/C Data Definitions,N/C Data Definitions,N/C Data Definitions,N/C Data Definitions,Output Settings,Post Files Preview,Post Files Preview,实例,将程序头由“%”变为“#” 增加信息 this NC is for Fanuc Controller,实例,去除G01 G28 Z0. 去除预选刀等,实例,调整进行输出和行号输出,实例,调整输出顺序,实例,输入用户命令,实例,创建用

21、户命令,实例,将用户命令插入程序中,实例,将用户命令插入程序中,实例,创建攻丝指令G84.1,2,实例,创建攻丝指令G84.1,3,4,5,6,实例,创建攻丝指令G84.1,7,实例,创建攻丝指令G84.1,8,实例,创建攻丝指令G84.1,9,10,TCL介绍,TCL介绍,TCL Tool Command Language刀具命令语言 Developed By John K. Ousterhout at University of California, Berkeley 解释性语言 用于UG/Post, Process Assistants,Shop Documentation,Clsf文

22、件创建和后置处理创建中 可从网站 也可运行machauxiliary目录下的ugwish进入TCL命令环境,TCL命令(Command)结构,Built-in command or procedure Format command arg arg . Example: set x 10 gets stdin y puts stdout “Hello, World!”,TCL Scripts,由一系列命令组成 由“#”表示注释,Variable (1),No specific data type Not necessary to declare variables before you use

23、them Variable name is case-sensitive Use set command to assign a value to a variable: set message “This is a message”,A=10,Set A 10,Variable (2),Use $ to obtain the value of a variable (dollar-sign variable substitution) puts $message Use unset to delete a variable unset x y z,Variable (3),Local var

24、iables are used inside of a proc Globe variables are used in the total tcl scripts globe name,Variable (4),Mathematical operators can be used: +, -, *, / Mathematical expressions are performed by expr command set b expr $a + $b,TCL in NT (1),TCL Shell for executing TCL commands interactively. tclsh8

25、3.exe % % set x 10 % 10 % puts “Hello, World!” % Hello, World!,TCL in NT (2),Scripting Create a script file with series of commands something.tcl puts -nonewline stdout “Your age: “ flush stdout gets stdin age if $age 10 puts stdout “You are too young” else puts stdout “You are too old” Execute the

26、script tclsh83.exe something.tcl,Command Substitution,Nested command is delimited by square brackets set str “To be or not to be” set len string length $str,Math expressions,expr command is used to evaluate math expressions Answer is returned as a string Example: set tool_d 25.0 set per 50 set stepo

27、ver expr $tool_d * $per / 100,Precision control (1),All operands are in integer format set res expr 4 / 3 Retrun 1 One operand is in double format set res expr 4.0 / 3 Return 1.33333333333,Precision control (2),Casting set res expr 4 / double(3) Return 1.33333333333 expr double(expr 4 / 3) Return 1

28、One more example set x 3.333 set res expr int($x) / 2 Return 1,Precision control (3),tcl_precision internal variable Control number of significant digits default value is 12 Example set tcl_precision 4 expr 4 / 3.0 Return 1.333,Operators,Mathematical * / % + - Boolean , =, =, != Bit-wise & (AND), |

29、(OR), (exclusive OR) Logical & (AND), | (OR) If-then-else x?y:z,Math and conversion functions,sin, cos, tan tanh, cosh, sinh asin, acos, atan, atan2 log, log10, exp sqrt, floor, ceil abs, double, int,Array,Format : arrayname(index) Index can be any string set tool(diameter) 10 set tool(radius) 2 set

30、 tool(length) 50,Array command (1),Set pairs of elements of index name an values of an array array set arrayname list set hd “sg3gb 10 sg5gb 20 ibm3gb 12 ibm5gb 22” array set HardDisk $hd Result HardDisk(sg3gb) 10 HardDisk(sg5gb) 20 HardDisk(ibm3gb) 12 HardDisk(ibm5gb) 22,Array command (2),Ask for e

31、xistence of an array array exists arrayname Return 1 if array exist, otherwise 0 Get index names of an array array names arrayname ?pattern? array names HardDisk *3gb Return a string sg3gb ibm3gb,Array command (3),Get pairs of element containing names and values of an array array get arrayname ?patt

32、ern? array get HardDisk Return ibm3gb 12 sg5gb 20 ibm5gb 22 sg3gb 10 The order of the pairs is undefined.,incr command,Format incr variable ?increment? Both variable and increment must be integer, positive or negative Example set a 5 incr a ( a = 6) incr a 2 ( a = 8 ) incr a 5 ( a = 3 ),Backslash su

33、bstitution,To quote special characters puts “Give me $100” Result: Give me $100 Non-visible characters set bell x07 puts $bell Multi-line continuation set looongstring “very loooooooooooooooong string”,Grouping (1),Grouping with double quotes Allow subsitutions to occur inside the qroup set a “somet

34、hing” set b “This is $a” Result: b = This is something Another example set a 5 set b 2 set c expr 2 * “$a.$b” Result: 10.4,Grouping (2),Grouping with curly braces Prevent subsitution to occur inside the qroup set a “something” set b This is $a Result: b = This is $a Apply to command, variable and ba

35、ckslash substitutions,Procedure (1),To define a procedure: proc name parameters body Example proc diag a b set c expr sqrt($a * $a + $b * $b) return $c ,Procedure (2),A procedure is used just like any other TCL command set res diag 3 4 puts “Diagonal of a 3 x 4 rectangle is $res” Arguments are passe

36、d by there value Variables defined inside a procedure are local variables Life span for the duration of the procedure call only Not visible outside the procedure,Procedure (3),Variables defined outside any procedure are global Not visible inside any procedure automatically use global command to make

37、 it visible inside a procedure set pi expr 2 * asin(1.0) proc circumference d global pi expr $d * $pi ,Procedure (4),Return result from last command proc add expr 1 + 2 puts add ( 3 ) Return result using return command proc add expr 1 + 2return 5 puts add ( 5 ),Control Structure Commands (1),If bool

38、ean body if boolean body else body if boolean body elseif boolean . body else body,Control Structure Commands (2),while boolean body for start test next body for set i 0 $i 10 incr i puts $i switch catch error,Control Structure Commands (2),for start test next body for set i 0 $i 10 incr i puts $i ,

39、Control Structure Commands (3),while boolean body,Control Structure Commands (4),Switch,Control Structure Commands (3),foreach variable list body set str “dia 10 rad 5 len 50” array set tool $str foreach key value array get tool puts “$key: $value” Result: dia: 10 rad: 5 len: 50,string command,First

40、 character is index number 0 string compare string1 string2 string length string string index string index string trimleft string chars string trimright string chars string range string i j,format command,Similar to sprintf in C format formatString arg1 arg2 Example: set res expr 1.0 / 3 puts format

41、 “Result: %.3f” $res Output: Result: 0.333,Procedure (5),Called by name using upvar command upvar ?level? passed-variable variable proc uv a upvar $a b incr b; puts $b set x 10; uv x puts $x Both puts output 11,Procedure (6),Default value of parameters proc discount p d 0.9 expr $p * $d puts discoun

42、t 100 (output 90.0) puts discount 100 0.8 (output 80.0) parameters without default value must be put in front,Procedure (7),Variable number of argument proc test a b args puts -nonewline llength $args foreach arg $args puts -nonewline $arg test a b c d e Output: 3cde args must be the last argument,F

43、ile (1),open command open file access return a file ID set fid open “d:test.txt” “RDWR CREAT” puts $fid “Something” Access RDONLY (read only), WRONLY (write only) RDWR (read/write), APPEND, CREAT TRUNC (truncated),File (2),close command to close an opened file close $fid,info command,info exists var

44、iable-name info hostname info tclversion info level ?number?,eval command,Evaluate a TCL script set cmd “puts info hostname” eval $cmd Return the hostname of local machine,Simple Tk program,Powerful tool for building GUI wish83.exe Create a tk script file, e.g. my.tkbutton .b -text Hello -command ex

45、it pack .b Execute the tk script wish83 my.tk,Bi-directional pipes using open,open command can be used for opening a channel set fid open “| wish83 my.tk” “RDWR” Both stdin and stdout of my.tk will be redirected to the current program The current program use puts $fid and gets $fid to communicate wi

46、th my.tk,Bi-directional pipes example (1),my.tk proc cal gets stdin exp puts stdout expr $exp exit button .c -text Calculate -command cal pack .c,Bi-directional pipes example (2),my.tcl set fid open “| wish83 my.tk” “RDWR” fconfigure $fid -buffering line puts $fid “1.0 / 7” gets $fid result puts $re

47、sult,Resources,Tcl Developer Xchange http:/ Books,Practical Programming in Tcl & Tk Brent Welch (Prentice Hall),Effective Tcl/Tk Programming: Writing Better Programs with Tcl and Tk Mark Harrison and Michael McLennan (Addison-Wesley),车铣加工中心后置处理器创建,创建步骤,创建一2轴车削后置处理器 创建一铣削后置处理器,选用mill-turn选项 设置需要的参数 保

48、存铣车后置处理器 确保所有的车削操作位于节点MCS_SPINDLE下 确保所有的铣削操作位于节点MCS_MILL下 对刀轨进行后置处理,创建一2轴车削后置处理器,创建一2轴车削后置处理器,3,4,5,6,创建一2轴车削后置处理器,3,创建一铣削后置处理器,2,3,4,5,6,创建一铣削后置处理器,2,创建一铣削后置处理器,创建一铣削后置处理器,3,注册后处理器,测试,多轴铣后置处理创建,Machine Kinematics,Which one is the fourth axis, and which is the fifth,Dual Table,Independent Axis = 4th Axis,Dependent Axis = 5th Axis,Dual Head,Pivoting Head = 4th Axis,Post-Builder shows this is the 4th axis, but it should be the 5th axis,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 专业基础教材

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报