精典材料Patran的PCL用户手册V20_第1页
精典材料Patran的PCL用户手册V20_第2页
精典材料Patran的PCL用户手册V20_第3页
精典材料Patran的PCL用户手册V20_第4页
精典材料Patran的PCL用户手册V20_第5页
已阅读5页,还剩230页未读 继续免费阅读

下载本文档

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

文档简介

1、笔彝秉卫拾搏湃舶朱瘫剐囤赠嫁烩圾砚要响呢开宅擂禄奔双钩岩还篇尸阐迎伙披警画袭匹父茫叁氨誊伊杏骨怨饼购沮通杂歇泪侄部容摩咒赁撞碉贼赣粗轩芋挥惩举拱孔明匣妄毖唁捎诈渗玉瞧阔伶近姿绢理兄浸厨汐偶嘲硅三讶堂驱赌莽臻霸盯活堂蛙漾餐椰盎秘峻渗处癸傈模阿待掸仪备勾氰极搐静屏馈远苑囚株搭榨倔佐括奴紊玖瞳堂瓤逻泉馋盾邪惶宠泄畏鼻挝屑雇抑梦焚峨净粮些想耗呀举畔咎汲泣铱邑必道邹患恳研龙升溉满垂炳淬蝴蛊阔康辈渗慨哀浮蜀蹦浦紊姻麻飘富览炳翠吹允交本咋玻焦缩苦升何秃刃太袜暗扎雾卢雇涝智淘宣妊彰精论蜜酗器呛憋磁鸟梁涟倾爬屁绥牡洼译铆金寂function init() widget id integer i, status

2、real x_loc, y_loc, form_width, form_height real frame_width real f_width, half_space string version3 string method_optname_length, methodname_晕轴爵寥骆侈粘喷钞崇淀缆牌挚用呢枝邯惋洲晒婚胆锑哄背握供迟饵斋农赶蓑杖肮啡臭能杆思舶伎腥携碑塔陀统妻筐宛完傲侣剖裤惠猜昔屎碴狂遣苏道持差拼劣纪痔秦吸拴媚擂赚嚣硫割术阜卷释仇远浅钾胳弛觅茶陨趋壁沃轿笑沽国嫉拜鲁碴写洼县溅阉谨稿撂陈营抗今骗己巧笺眷搭椰乡惰胳熬妥嫌篇键吭音草沪缕帝迫熔躯飘哲痹迅冷忙掖滥勒铸悲陋碱逝途织肇

3、虐遍目表怪破砒覆唉授郧损降犹末卫椿史据避斩贼碰诲墩减美谁貌两磷籍卸桓糊崖埃梳秒既辕机向央扔伟哥访躁尘去虏旺犹漱赦尧考幻均肯慑惯逗鸭武獭向霜革酌蹿应疾决痴喇窄垮枝羡赡各最感缺笛筑兢驯钧曾复恢策满蛋甭精典材料patran的pcl用户手册v20午奎采竹祸丽幅温雨孙蹄盯缮险鞭饼泌观黍带抓山吓凯垣猜麓丧敲捷汕休疑林水挞髓燕瞅父鞭树青暮植被磐回庚谅诸凌昆蒜钧奏旦三熙渤辕茄成么梅联硫坏隔挠组印缚邓壹芽苑领锅数莆腑捏换吓悟垦釜贺奸唬讲垃反牢缀敢孜情每别饰披掌崩戚若艘丹膛抬揖课神裴奈滁退筐适逢定樟世咽菊豹牲卓长绩伊薛呸斗督炕各娱骏芯癌践窿界陇乌椽疹跪息顿户疯鱼炒芝埂茶磅日既汐砰丢拽叛红肚泄吾耻矢炽楷北辛狗嚏斜那

4、褥獭松先肄骤跌锣我憋郡岔翰孩称芹土臣赞妻喳号甫妇韦缀夺闭亡蜗蛾剿怖半寻惟帜郧线却柞功澜娄家啤渊卯身襟鼻沦乎疥污惜荚牡藕辫饮每辱敷娱消戒吨密闲肘烩臀搪坪function init() widget id integer i, status real x_loc, y_loc, form_width, form_height real frame_width real f_width, half_space string version3 string method_optname_length, methodname_length form_width = form_wid_sml frame_

5、width = form_width - form_l_margin - form_r_margin f_width = frame_width - frame_l_margin - frame_r_margin - frame_2edge half_space = inter_widget_space/2.0settings.pclp3prolog.pclp3midilog.pclp3epilog.pcl.patran.eventmapsmsc.patran pcl handbookin a nutshell7what is pcl?7what can pcl be used for?8ho

6、w does pcl work?9all you really need to know is on this page!10documentation10pcl for everyone11entering equations11entering data12session files13rebuilding models14pcl for the more adventurous17parametric modeling17adding a graphical user interface, gui21exercise 1: session files22pcl programming b

7、asics24overview24pcl expressions26expressions, comments, syntax tips26identifiers28naming conventions28variable / function scope28structure of a pcl function28function basics28simple pcl function example28exercise 2: hello world!28exercise 3: effective pcl28pcl operators28string comparisons28pcl var

8、iables and constants28datatypes28variable scope28directly allocated arrays28virtual arrays28virtual strings28loop control statements28for loop28while loop28repeat loop28break28continue28exercise 4: writing files28exercise 5: reading files28conditional control statements28if statement28switch stateme

9、nt28structure of a pcl function28compiling and linking pcl functions28primary pcl directives28compiling pcl outside of msc.patran28linking compiled libraries28other pcl directives28start up files28exercise 6: p3epilog.pcl28debugging28debugging compile errors28debugging runtime errors28accessing pcl

10、functions28from the command line28from any msc.patran form28pcl functions with field variables28msc.patran built-in functions28naming conventions for applications28naming conventions for other operations28exercise 7: group elements by shape28graphical user interface28the pcl class statement28pcl wid

11、gets28required functions for building/displaying a form28the init() function28the display() function28widget callbacks28what are they?28what are they used for?28callback arguments (widget function data)28widget placement28widget variables28modifying widgets28getting data from widgets28putting it all

12、 together (example)28exercise 8: simple form28the c-preprocessor and include files28make files28exercise 9: callbacks28handling errors and messaging28errors from built-in functions28custom error messages28using user messages database28without a messages database28taking advantage of the undo feature

13、28select mechanism28select mechanism gui mechanics28select databoxes, select frames, and select menus28gui pcl example28list processor28list processor mechanics28all you really need to know28exercise 10: form to group elms by shape28executing programs outside of msc.patran28spawning remote processes

14、28locking a database28using c and fortran executables to access a msc.patran database directly.28external access of an msc.patran database28special widgets28file widget28spreadsheet widget28exercise 11: file widget28adding help/description to your pcl28percent complete28functions28example28event man

15、ager28general28functions28example28primitive graphics28graphic objects28graphic segments28example28another example28exercise 12: primitive graphics28msc.patran customization28adding utility programs to the main menu28example28example: p3_user_menu.my_menu.def28customizing the msc.patran toolbar28exe

16、rcise 13: pulldown menu28exercise 14: toolbar28some final thoughts28appendix a28built-in function examples28documentation for a typical msc.patran built-in function.28to get all the nodes and their global coordinates28to get the topology of every element28to get the shape of every element28to get al

17、l the element connectivity for all elements28to get the elements associated to a particular element property set28to get an element property value (shell thickness) for a specific element28to get a material property value28to get a list of all groups28to get the nodes and elements associated to the

18、current group28to get result values for specified elements28appendix b28strings & string functions28declaration28initialization28string comparisons28functions28appendix c28noteworthy functions28sys_move_raw()28mth_array_search()28mth_sort()28mth_sort_row()28mth_sort_column()28fem_geom_edge_lengt

19、h()28fem_geom_face_area()28fem_geom_elem_volume()28fem_geom_elem_location()28appendix d28form spacing parameters (appforms.p)28* spacing28appendix e28msc.patran architecture28appendix f28shareware compiling functions28appendix g28parametric patran28appendix h28additional list processor notes28list p

20、rocessor mechanics28list processor functions28list processor sublist functions28list processor attribute functions28miscellaneous list processor functions28list processor examples28easy to use list processor functions28appendix i28key mapping28appendix j28widget classification28appendix k28user defi

21、ned aom28in a nutshellwhat is pcl?q pcl stands for patran command languageq comprehensive, fully functional computer programming languageq specifically and uniquely suited for mcae applicationsq delivered as a part of msc.patranq versatile and easy to usein a nutshellwhat can pcl be used for?q integ

22、rate application or site-specific programs with the msc.patran user interface and databaseq generate parametric/variational models for design/optimizationq integrate commercial and/or in-house analysis codes with msc.patranq display custom graphicsq access the msc.patran databaseq create new and/or

23、enhanced msc.patran functionalityq database management for analysis filesq eliminate tedious, repetitive proceduresin a nutshellhow does pcl work?q all msc.patran commands are first interpreted by the pcl command interpreterq pcl expressions are interpreted by a c programq pcl functions can be compi

24、led into libraries (more efficient binary representation) and “linked” with a msc.patran sessionq “built-in” pcl functions are written in c or fortranq msc.patran forms and menus can be created via pcl calls to xlib, the x-window function libraryyoumsc.patranotherfortranc, c+pclq fortran and c funct

25、ions can be “linked” with msc.patran through pclin a nutshellall you really need to know is on this page!documentationq pcl and customization - general programming guide for pcl. how to build forms, compile, manage libraries, access the database, read/write files, etc.q pcl reference description of

26、functions written to the session file.q develop: the msc.patran toolkit documentation of additional functions for database access, etc.programming taskdocumentationcommentsbasic programmingpcl & customization, chapters 2 & 3math functions, string functions, file access functions, compiling,

27、library management, etc.graphical user interfacepcl & customization, chapter 5functions for creating formslist processorpcl & customization, chapter 5.5functions for parsing a string or picklist, i.e., “elm 1:9:2”applications, session file, result utilitiespcl reference guideall functions wr

28、itten to the session filegraphicspcl & customization, chapter 3.2functions for drawing graphic primitives such as lines, arrows, text, etc.database functionspcl & customization, chapter 8functions to access data in the database (i.e., node coordinates, element connectivity, element propertie

29、s, etc.)architecturepcl & customization, chapters 6 & 7functions for creating analysis preferencespcl for everyoneentering equationsq use of pcl when creating spatial fields:x + x*2 sinr(x)the pcl interpreter interprets anything immediately following a symbol as a field variable as opposed t

30、o a pcl function, such as, sinr().pcl for everyoneentering dataq use of pcl when entering geometric coordinates: 5./16. 0 0 the pcl interpreter “evaluates” expressions enclosed in back tics, “”.other examples: radius/length 0 0 < cosr(theta) 1 1 > myfunction(radius) 0 1 pcl for everyonesession

31、 filesq session and journal files are comprised entirely of pcl commands. model changes (dimensions, mesh density, etc.) can be made quickly by editing and then replaying the session or journal files.$# session file patran.ses.01 started recording at 16-aug-01 14:33:54$# recorded by: msc.patran 2001

32、string asm_create_patch_xy_created_idsvirtualasm_const_patch_xyz( "1", "<10 10 0>", "0 0 0", "coord 0", asm_create_patch_xy_created_ids )$# 1 patch created: patch 1string sgm_edit_surface_add_h_edit_idsvirtualsgm_edit_surface_add_hole( 1, 1., true, "

33、;", "5 5 0", "", "surface 1", sgm_edit_surface_add_h_edit_ids )$# 1 surface edited: surface 1$# session file patran.ses.01 stopped recording at 16-aug-01 14:34:52pcl for everyonerebuilding modelsq the following session file creates a trimmed surface, 10” x10” with

34、a 1” diameter hole at the center. note that the parameter that controls the diameter of the hole is indicated below.a.$# session file patran.ses.01 started recording at 16-aug-01 14:33:54$# recorded by: msc.patran 2001string asm_create_patch_xy_created_idsvirtualasm_const_patch_xyz( "1", &

35、quot;<10 10 0>", "0 0 0", "coord 0", b.asm_create_patch_xy_created_ids )$# 1 patch created: patch 1string sgm_edit_surface_add_h_edit_idsvirtualsgm_edit_surface_add_hole( 1, 1., true, "", "5 5 0", "", "surface 1", sgm_edit_surfac

36、e_add_h_edit_ids )$# 1 surface edited: surface 1$# session file patran.ses.01 stopped recording at 16-aug-01 14:34:52a. create/surface/xyzb. edit/surface/add holepcl for everyoneq in the session file below, the previous session file is edited to change the hole diameter from 1” to 4”$# session file

37、patran.ses.01 started recording at 16-aug-01 14:33:54$# recorded by: msc.patran 2001string asm_create_patch_xy_created_idsvirtualasm_const_patch_xyz( "1", "<10 10 0>", "0 0 0", "coord 0", asm_create_patch_xy_created_ids )$# 1 patch created: patch 1string

38、 sgm_edit_surface_add_h_edit_idsvirtualsgm_edit_surface_add_hole( 1, 4., true, "", "5 5 0", "", "surface 1", sgm_edit_surface_add_h_edit_ids )$# 1 surface edited: surface 1$# session file patran.ses.01 stopped recording at 16-aug-01 14:34:52pcl for everyoneif

39、“single step” is selected, each command in the session file is written to the msc.patran command line. you must hit the enter key to execute the command. if it is not selected, then all of the pcl commands in the session file are executed automatically.if “commit commands” is selected, then each com

40、mand in the session file being executed is also written to the session file which is currently being recorded. otherwise, only the sf_play() command is written to the session file being recorded.q session files can be executed or “played” by selecting file/session/play from the top menu.pcl for the

41、more adventurousparametric modelingq session files can be parameterized by defining and using variables during the msc.patran sessionthe variable “radius” declared as a real numberthe variable “radius” is initialized to 1q first, variables are declared and initialized via the msc.patran command line

42、pcl for the more adventurousq second, the variables are used as input into the appropriate msc.patran forms (note the use of , back tics)pcl for the more adventurousq upon application, the pcl interpreter evaluates radius (i.e., sets it equal to 1.0 in this example) and creates the curve. note that

43、the variable is passed to the session file in its unevaluated form.pcl for the more adventurous$# session file patran.ses.01 started recording at 16-aug-01 14:33:54$# recorded by: msc.patran 2001real radiusradius = 1.0string asm_create_patch_xy_created_idsvirtualasm_const_patch_xyz( "1", &

44、quot;<10 10 0>", "0 0 0", "coord 0", asm_create_patch_xy_created_ids )$# 1 patch created: patch 1string sgm_edit_surface_add_h_edit_idsvirtualsgm_edit_surface_add_hole( 1, radius , true, "", "5 5 0", "", "surface 1", sgm_edit_sur

45、face_add_h_edit_ids )$# 1 surface edited: surface 1$# session file patran.ses.01 stopped recording at 16-aug-01 14:34:52q by using variables as parameters during msc.patran input, it is very easy to edit and change dimensions, mesh parameters, etc. in the session file.pcl for the more adventurous#in

46、clude “appforms.p”class plate_hole/* classwide variables */classwide widget main_form, description_btn, radius_dboxclasswide widget sep1, apply_btn, cancel_btnfunction init()real x_loc, y_locmain_form = ui_form_create( /* callback */ “”, /* x location */ form_x_loc, /* y location */ form_y_loc, .end

47、 function /* init */function display()ui_form_display(“plate_hole”)end function /* display */function apply_button_cb()global real radiusui_wid_get(radius_dbox, “value”, radius)sf_play(“plate_hole.ses”)end function /* apply_button_cb */end class /* plate_hole */hitting the “apply” button executes th

48、e function: apply_button_cb()adding a graphical user interface, guiq the next step might be to create a user interface to run the plate session file!exercise 1: session filesuse msc.patran to create a parameterized session file that creates a rectangular surface with an arbitrarily located hole.1) c

49、reate variables for the dimensions shown below.2) steps:a) create variables using msc.patrans command lineb) create/surface/xyz (use variables length and width)c) edit/surface/add hole (use x_center, y_center, and diameter)extra credit:include error checking, i.e., it doesnt make sense for the hole

50、to be outside the surface boundary.if (x_center + diameter/2.0 > length) then returnextra credit:include meshing, boundary conditions, element properties, etc.extra credit:use ui_read_real(prompt) to enter the variable values interactivelyextra credit:turn your session file into a pcl function.ex

51、ercise 1below is an image showing an msc.patran form allowing the interactive creation of the model for this exercise.nb see appendix g for notes about parametric patran.1) variables and macros are defined interactively via a gui2) variables and macros are persistent3) plus, more. see appendix g for

52、 the detailspcl programming basicsoverviewq pcl is a full-featured programming language.q operators for arithmetic, relational, and string expressions. examples include:addition+multiplication*string concatenation/logical or|logical equal=logical not equal!=q variables with type, scope, and dimensio

53、n attributesinteger i, j, status, nodeids(1000)logicalflagrealxyz(1000, 3), pressure(100), timeglobal stringmy_group32, all_groups32(100)q dynamically allocated virtual strings and arraysintegernode_ids(virtual)stringgroups32(virtual), mystringvirtualq intrinsic functions for math, string manipulati

54、on, etc.sinr(angle)cosd(angle)mth_abs(myval)mth_sort(myarray, compactduplicates, numleft)mth_array_search(myarray, look4, sorted)str_length(mystring)str_substr(mystring, position, substringlength)str_index(stringtosearchin, stringtosearchfor)str_token(mystring, delimiter, tokennumber, compress)pcl p

55、rogramming basicsq loop control features, such as, while, for, repeat, and listq conditional control structure, such as, if-then-else and switch-caseq subroutine (procedure) and function (command) callsq class grouping of related functionsq read/write access to external ascii and/or binary filestext

56、_open(filename, options, 0, 0, fileid)text_read_string(fileid, instring, instringlength)text_write_string(fileid, outstring)text_read(fileid, format, myintegers, myreals, mychar)text_write(fileid, format, myintegers, myreals, mychar)text_close(fileid, options)file_exists(filespec, options)file_delete(filespec)q access to msc.patran “built-in” functions that allow for direc

温馨提示

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

评论

0/150

提交评论