基于TCL_TK的HyperMesh二次开发
来源:互联网 发布:女生养生知乎 编辑:程序博客网 时间:2024/05/13 13:54
主要介绍一下在项目中常用的TCL开发命令
About TCL
1. hm_entitylistentity_type name_or_id
Returns a list of names or IDs of all entities of the requestedtype.
eg. hm_entitylist dequation names
hm_entitylist nodes id
可以使用本命令配合lsearch命令判断组件存在方式
hm_entitymaxid entity_type ?recalculate?
hm_entitymaxid - Returns the maximum internal ID in use for anentity type.
2. hm_info -appinfo SPECIFIEDPATHTEMPLATES_DIR
return the templates file dir in the local macthion
3. hm_entityinfooption entity_type ?entity_name_or_id? ?search_type?
hm_entityinfo - Returns variousinformation on entities.
####To display information on a selected component:*createmarkpanel components 1 "Select components"set compList [ hm_getmark components 1 ]if { ! [ Null compList ] } { set compId [ lindex $compList 0 ] set name [ hm_entityinfo name components $compId ] set color [ hm_entityinfo color components $compId ] set visible [ hm_entityinfo visible components $compId ] set style [ hm_entityinfo style components $compId ] set graphics [ hm_info graphicsmode ] set colormap [ hm_winfo entitycolors ] set msgBuff "component:\t$name\n" append msgBuff "color:\t\t$color\n" append msgbuff "visible:\t\t$visible\n" append msgBuff "id:\t\t$compId\n" append msgBuff "style:\t\t$style\n\n" append msgBuff "graphics:\t\t$graphics\n\n" append msgBuff "colormap:" regsub -all "{" $colormap "" colormap set cm [ split $colormap "}" ] for { set i 0; set j 1 } { $i < 16 } { incr i; incr j } { append msgBuff "\t\t$j = [ lindex $cm $i ]\n" } tk_messageBox -message $msgBuff}
A new ID Manager has been added in HM 12.0 and will be officially released in HM 12.0.110. The ID range for each entity type in each sub-model (like an include file) can be defined to position the entity IDs. For example, there are two includes in HM. The ID range for include1 is 1001-2000 (min-max) while include2 has 3001-4000. If include1 is set as current, when a new entity is created or imported, the ID for this new entity will be between 1001 to 2000, not the ID with [max id +1] in current HM. Similarly, if include2 is set as current, a new created entity ID will be between 3001-4000.
Because of this, some usage of the commandhm_entitymaxid will not make sense and needs to be updated to use new commands. The commandhm_entitymaxid still returns the maximum database ID in use. However, there are other "unsupported" uses of this command that will no longer work, so it is mandatory to update scripts to use the new APIs for those usages.
Currently there are two main usages of hm_entitymaxid:
proc CreateGRNOD { args } { set d_nodesList [lindex $args 0]; if { [llength $d_nodesList] } { set str_setName [::hwat::utils::GetUniqueName sets [lindex $args 1]]; eval *createmark nodes 1 $d_nodesList; *entitysetcreate "$str_setName" nodes 1; *createmark sets 1 -1; *dictionaryload sets 1 $::str_templatePath "GRNOD"; return [hm_entitymaxid sets]; } else { return 0; }}
proc HandleNewInDefineMaterialProperties { args } { # First find out the maximum material ID used. set max_mat_col_id [hm_entitymaxid mats]; # The new material ID will be one more than the existing maximum mat ID. set ::material_id [ expr { $max_mat_col_id + 1 }]; # Set the default mu value. set ::material_mu 0.2; # Set the Material collector default name by adding name and ID. # This is to make sure that it is a unique name. set ::material_name ""; append ::material_name "TARGET_CONTACT" "_MAT_" $::material_id;}
To cover these two use cases, new commands have been created to replacehm_entitymaxid.
proc CreateGRNOD { args } { set d_nodesList [lindex $args 0]; if { [llength $d_nodesList] } { set str_setName [::hwat::utils::GetUniqueName sets [lindex $args 1]]; eval *createmark nodes 1 $d_nodesList; *entitysetcreate "$str_setName" nodes 1; *createmark sets 1 -1; *dictionaryload sets 1 $::str_templatePath "GRNOD"; return [hm_latestentityid sets]; } else { return 0; }}
proc HandleNewInDefineMaterialProperties { args } { # First find out the maximum material ID used. set max_mat_col_id [hm_entityinfomaxid mats]; # The new material ID will be one more than the existing maximum mat ID. set ::material_id [ expr { $max_mat_col_id + 1 }]; # Set the default mu value. set ::material_mu 0.2; # Set the Material collector default name by adding name and ID. # This is to make sure that it is a unique name. set ::material_name ""; append ::material_name "TARGET_CONTACT" "_MAT_" $::material_id;}
Also, for the use case of generating a unique name, the commandhm_getincrementalname can be used.
A new API, hm_entityrecorder, has also been added to "record" the IDs of the entities created while the recorder is enabled.
In addition, the behavior of selecting recently created entities using negative values using*createmark/hm_createmark has been improved. Previously, the values returned by this functionality were always the highest entity IDs, which is how entities were previously numbered during creation. With the new ID Management functionality, this now more accurately returns the recently created entity IDs and matches the return values ofhm_latestentityid. In essence, this now selects entities in the reverse order they are stored in the database (the order they are created, regardless of ID). However, any operations that affect the order of entities in the database (organize, reorder, etc...) will change the returned/selected entities. As in previous releases, it is recommended to use this option only immediately after entity creation and before any other operations that may modify the database.
更多内容可以关注:
- 基于TCL_TK的HyperMesh二次开发
- HyperMesh二次开发注解【一】---新版本说明
- 基于Visio的二次开发
- 基于MAPGIS组件的二次开发
- 基于.Net的mapinfo二次开发
- 基于VLC SDK的二次开发
- 基于VLC SDK的二次开发
- 基于FiddlerCore的.Net二次开发
- iOS 基于AsyncSocket的二次开发
- 基于C#的Skyline二次开发
- 基于嵌入式微处理器EP9315的二次开发技术
- 基于嵌入式微处理器EP9315的二次开发技术
- 基于VSTO的Visual SourceSafe 2005二次开发
- 基于嵌入式微处理器EP9315的二次开发技术
- 基于SPSS二次开发的Web SPSS系统
- C#基于google earth的二次开发
- 基于VB6的餐卡系统二次开发
- 基于MapGIS的GIS二次开发作业文档
- Linux┊理解devfs、sysfs、udev
- 编译python生成.pyc文件
- hibernate配置文件hibernate.cfg.xml的详细解释
- 菜鸟黑客的第三天——一些很有用的工具
- 数据库中游标的使用
- 基于TCL_TK的HyperMesh二次开发
- ios SDK自带 MD5加密
- ubuntu12.04 架设tftp服务器
- “不明觉厉”的“远景战略规划”
- 【转载】毕业5年决定人的一生-- 大家千万不要错过这篇文章
- On Raspberry Pi , Using Raspbian to install LNMP
- 本人博客,今日开张了!!
- 人龟赛跑
- ResourceBundle