文稿说明案例5retrieving data from hypermesh_第1页
文稿说明案例5retrieving data from hypermesh_第2页
文稿说明案例5retrieving data from hypermesh_第3页
文稿说明案例5retrieving data from hypermesh_第4页
文稿说明案例5retrieving data from hypermesh_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

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

文档简介

1、Chapter 5: Retrieving Data from HyperMesh EntitiesRetrieving Data from HyperMesh Entities - OverviewTopics Presented:HyperMesh Entities and Their Data NamesUsing the hm_getentityvalue command Pointers and FlagsProcess for Creating a HyperMesh Tcl Script to Retrieve Data on HyperMesh EntitiesExample:

2、 Automate Computing the Vector Sum of ForcesHyperMesh Entities and Their Data NamesWhat are Data Names?Generic references to the information that physically defines an entity in the HyperMesh environment Example: The x, y, and z coordinates that define a nodes location in three-dimensional space. Th

3、is information is part of the entitys definition and is consistent for all solvers. Data Names can change from one HyperMesh version to the next. For this reason, please refer to the online help. Information on the data names can be found in the following location:HyperMesh Reference Guide Scripts C

4、reating Scripts Tcl Using Data NamesHyperMesh Entities and Their Data NamesHow to access Data Names?hm_getentityvalue command accesses data names and template info associated with an entityReturns a string or floating point valuehm_getentityvalue entity_type name_or_id data_name_string flagExample:S

5、et the x component of a force with ID 12 to the variable force_x:set force_x hm_getentityvalue loads 12 comp1 0Several Data Names available for force loads:nodewhen a load is applied to a node, this serves as a pointer to the nodecomp1x component of the vectorcomp2y component of the vectorcomp3z com

6、ponent of the vectormagnitudemagnitude of the load vectorcollectorcollector that owns the load (load collector pointer)HyperMesh Entities and Their Data NamesExample: Tcl script which prompts the user to select several nodes and then displays their x, y, and z coordinates hm_markclear nodes 1*create

7、markpanel nodes 1set nodes hm_getmark nodes 1if ! Null nodes foreach node $nodes set xVal hm_getentityvalue nodes $node x 0 set yVal hm_getentityvalue nodes $node y 0 set zVal hm_getentityvalue nodes $node z 0 tk_messageBox -message Node $node = $xVal $yVal $zVal Several Data Names available for nod

8、es:idThe ID of the node (integer).inputsystemPointer to the node input system (pointer).outputsystemPointer to the node output system (pointer).xThe x coordinate of the node in its local system (real).yThe y coordinate of the node in its local system (real).zThe z coordinate of the node in its local

9、 system (real).Pointers and FlagsSeveral of the data names in the two tables are defined as pointers. A pointer is used to directly access another data name. For example, the collector and node data names for force loads are pointers. This means they “point” to data names available for either collec

10、tors or nodes. In order to retrieve any data from a pointer, the data name requested for the particular pointer must also be supplied. The additional data names are separated by a period or dot (.).Pointers and FlagsThe following are a few examples on how a pointer is used. To retrieve the node id t

11、hat load 12 is applied to :set node_id hm_getentityvalue loads 12 node.id 0To retrieve the y coordinate of the node that load 12 is applied to:set node_id hm_getentityvalue loads 12 node.y 0To retrieve the load collector name that contains load 12:set ld_col hm_getentityvalue loads 12

12、 1For the collector name, notice the flag value is set to 1 as the expected return value is a string value as opposed to a numeric value. In the node example above, the flag value is set to 0, indicating that a floating point number is to be returned.Pointers and FlagsAnother example is with compone

13、nt collectors. There is no data name associated with a component collector to get the material name, only the material ID. The following set of commands is used to get the material ID:set matID hm_getentityvalue comps 12 materialid 0A second set of commands would then be required to get the name of

14、the material with that ID:set matName hm_getentityvalue mats $matID name 1Alternatively, the component collector has a material pointer data name. From this pointer, any valid material data name can be substituted by separating the pointer and the new data name with a period (.). From the example ab

15、ove the following line can replace the previous two lines:set matName hm_getentityvalue comps 12 1Process for Creating a HyperMesh Tcl Script to Retrieve Data on HyperMesh EntitiesDefine the task to be automated.Write the commands to a user-created *.tcl text fileSkip doing the task in

16、 HyperMesh as there are likely no commands to capture to the command.cmf file; the task is to retrieve information, not to perform a HyperMesh action.Use HyperMesh Tcl commands to extract data on HyperMesh entities.Use core Tcl commands to store extracted data in variables, retrieve, manipulate, and

17、 display it.Test the script from the Command Window.Define the Utility menu button for the macro in userpage.mac file.In the current HyperMesh session, reload the hm.mac file (this also reloads userpage.mac).Run the script from the Utility menu.Example: Automate Computing the Vector Sum of ForcesReq

18、uest the user to select forces.If the user does not select loads, display a message stating this.Retrieve the X, Y, and Z component information from the user-selected forces.Sum the X, Y, and Z components.Display the resulting X, Y, and Z components.The following HyperMesh commands are modified in t

19、his exercise.*clearmark()*createmarkpanel()The following HyperMesh Tcl commands are used in this exercise.hm_getentityvaluehm_getmarkhm_usermessagehm_errormessageThe following core Tcl commands are used in this exercise.brackets exprforeachifsetreturnllengthPractical ExercisesExercise 5aDescription:

20、 Create a HyperMesh Tcl script to automate the following task: Request the user to select a component to be translated.Request the user to select a HyperMesh defined vector along which the component is to be translated.Get the p p and p of the selected vector from the HyperMesh database.Request the

21、user to enter in a translation distance.Use all of the above information to translate the given component.HyperMesh commands used*createmarkpanelhm_getfloathm_getmarkhm_getentityvalue*createvector*translatemark*clearmarkTCL/TK commands usedsetHintsUse the provided c_channel-tcl_vector.hm file as it

22、has a vector defined in it.Practical ExercisesExercise 5bDescriptionCreate a HyperMesh Tcl script to automate the following task:Request the user to select elements on which to create system.Calculate the centroidal coordinates of each element.Create a node at each of these centroidal locations.Crea

23、te systems with these nodes as an orientation node.HyperMesh commands used*createmarkpanel*createnode*clearmark*hm_nodelisthm_getmark*systemcreatehm_entityinfoTCL/TK commands usedsetforforeachevallindexllengthHintsThe majority of this assignment will be discovering where to find information about commands and how to apply the information you find. Be patient and use the resources available to you, including the HyperWorks online help.Practical ExercisesExercise 5c:DescriptionStarting with the results of Exercise 4b:Create a node at the centroid of the element. Translat

温馨提示

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

评论

0/150

提交评论