HyperWorks二次开发API-孔的识别
HyperWorks二次开发API-孔的识别
前段时间学习了HyperWorks的二次开发方法,HyperWorks的二次开发语言为TCL,参考资料较少,主要通过某站的官方教学视频、《Tcl_Tk入门经典(第2版)》、帮助文档进行学习。
发文的目的一是记笔记,二是学习分享,欢迎大家交流。写得简单,后续有空再补充
以下是TCL语言编写的代码,仅能识别带壳单元washer的孔,并生成rigid。实际通过自带Blot建rigid连接更加便捷
*createmarkpanel nodes 1 "select nodes to creat rigidlink";#通过面板标记点
set node_in_elems [hm_getmark nodes 1];#将选择的点ID提取出来
*findmark nodes 1 1 1 components 1 2;#标记节点对应的component
*findmark components 2 257 1 elements 0 1;#标记component包含单元
hm_holedetectioninit;#初始化孔识别程序
hm_holedetectionsetentities elems 1;#设置检测的实体类型
hm_holedetectionsetholeparams hole_shape=31;#设置需要识别孔的参数
hm_holedetectionfindholes 1;#找到实体包含的孔
foreach every_node $node_in_elems {set hole_info [hm_holedetectionidentifyhole $every_node ];#获取含该节点的孔编号set washer [ hm_holedetectiongetwasherelementslist $hole_info ];#得到孔的washerset washer [split $washer \{\}];#得到孔washer的单元编号append rigidelems [lindex $washer 2];#收集每个孔washer的单元}
hm_createmark elements 1 $rigidelems ;#标记孔的washer单元
*findmark elements 1 1 1 nodes 0 2;#标记孔washer节点
*rigidlinkinodecalandcreate 2 0 0 123456;#生成rigid
*clearmarkall 1
*clearmarkall 2
hm_holedetectionend;#结束孔识别
参考:
HyperWorks Desktop Reference Guides-HyperMesh - Scripts - Commands and Functions - Tcl Query Commands
HyperWorks关系孔的API命令如下:
hm_holedetectioninit
——初始化孔检测模块
——调用其他hm_holedetection* api之前必须使用,并且必须在调用hm_holedetectionend
hm_holedetectionend
——清除内存,结束孔检测模块
——在此之前必须有对hm_holedetectioninit和其他hm_holedetection* api的调用
hm_holedetectionsetentities
——定义检测孔的实体
——可以多次调用,每次调用结果进行叠加
——在调用hm_holedetectioninit/hm_holedetectionend时,选择的实体被清除
——在此之前必须调用hm_holedetectioninit
——hm_holedetectionsetentities entity_type mark_id
——entity_type:用于寻找孔的实体类型。有效值是comps、surfs、solid和elems。如果指定了comps,几何和FE都要考虑
——mark_id:包含实体标记的ID。有效值为1和2
hm_holedetectionsetholeparams
——在几何和有限元中定义二维孔的参数
——可以多次调用此命令来覆盖或重新定义每个孔形状的参数
——在调用hm_holedetectioninit/hm_holedetectionend时,设置被清除。
——在此之前必须调用hm_holedetectioninit
——hole_shape是强制性的。所有其他参数都是可选的并具有默认值
——参数可以按任意顺序指定。
——hm_holedetectionsetholeparams hole_shape=<> ?parameter1=<>? ?parameter2=<>?
——hole_shape= (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3 + 16*Bit4)
Bit1
0 – 不考虑圆孔
1 – 考虑圆孔
Bit2
0 - Do not consider rounded holes.
1 - Consider rounded holes.
Bit3
0 – 不考虑方孔.
1 – 考虑方孔.
Bit4
0 – 不考虑矩形孔.
1 - 考虑矩形孔.
——hole_type= (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3)
Bit0
0 – 不考虑表面孔.
1 - 考虑表面孔.
Bit1
0 – 不考虑法兰面孔
1 - 考虑法兰面孔
Bit2
0 – 不考虑圆柱孔.
1 - 考虑圆柱孔.
Bit3
0 – 不考虑锥形孔.
1 - 考虑锥形孔.
——其他用于定义孔类型的参数:如角度、容差等
hm_holedetectionsettubeparams
——定义在几何和FE中管的参数
hm_holedetectionfindholes
——执行孔检测工具
——根据输入实体和参数寻找孔。调先用hm_holedetectioninit、hm_holedetectionsetenties、hm_holedetectionsetholparams或hm_holedetectionsettubeparams
——hm_holedetectionfindholes find
——find:(Bit0 + 2*Bit1 + 4*Bit2):
Bit0
0 – 不查找孔
1 - 查找孔
Bit1
0 – 不查找 2D 管
1 - 查找 2D 管
Bit2
0 – 不查找 3D 管
1 - 查找 3D 管
hm_holedetectionidentifyhole
——返回含给定节点或线的孔索引
——在此之前必须调用hm_holedetectionfindholes
——hm_holedetectionidentifyhole id
——id :需要查询的节点或线的ID
hm_holedetectiongetholedetails
——返回孔的详细信息
——在此之前必须调用hm_holedetectionfindholes
——hm_holedetectiongetholedetails index
——index:孔的索引号
General hole:
0 0 {center x/y/z} {axis x/y/z} {entities ordered lines/nodes} {0 - No washer elements, 1 - Washer elements; Always 0 for geometry holes}
Circular hole:
0 1 radius {center x/y/z} {axis x/y/z} {entities ordered lines/nodes} {0 - No washer elements, 1 - Washer elements; Always 0 for geometry holes}
Square hole:
0 3 length {center x/y/z} {axis x/y/z} {entities ordered lines/nodes} {0 - No washer elements, 1 - Washer elements; Always 0 for geometry holes}
……
hm_holedetectiongetnumberofholes
——返回孔的数量
——在此之前必须调用hm_holedetectionfindholes
hm_getholedetectionwasherelementslist
——返回Washer单元的ID
——在此之前必须调用hm_holedetectionfindholes
——输出格式为:
{Number of layers {layer 1 elem IDs…} {layer 2 elem IDs…} {layer 3 elem IDs…} etc...}
For example:
{2 { 430 429 428 427 426 425 424 423 }{ 418 417 416 415 414 413 412 411 }}
——hm_getholedetectionwasherelementslist index
——index:孔的编号
hm_holedetectionfindmates
——执行孔配合工具
——运行孔检测匹配功能,寻找孔匹配的'groups'
——在此之前必须调用hm_holedetectionfindholes
——所有其他参数都是可选的并具有默认值
——参数可以按任意顺序指定。
——hm_holedetectionfindmates ?parameter1=<>? ?parameter2=<>? Etc
max_angle:孔中心线之间的最大夹角,默认值1.0。
max_distance:孔中心之间的最大法向距离,默认值10.0。
max_lateral_distance:允许的最大横向距离,默认值1.0。
max_lateral_factor:允许的最大侧向距离系数,默认不使用
allow_hole_to_tube:0-不允许孔和管配合(默认);1-允许孔和管配合
allow_mismatched_shapes:0-不允许不同形状间配合(默认);1-允许不同形状间配合
allow_self:0-不允许同一组件间配合(默认);1-允许同一组件间配合
hm_holedetectiongetmatedetails
——返回指定孔/管配合'groups'的详细信息
——之前必须有一个hm_holedetectionfindmates调用
——hm_holedetectiongetmatedetails index
——index:配对索引号
——具体返回如下:
total_length {center_top x/y/z} {center x/y/z} {center_bottom x/y/z} number_of_indices {ordered_indices top-to-bottom}
其中total_length是配合孔的完整长度,从孔到孔测量,包括管深度;而center是连接孔中心线的中心。
hm_holedetectiongetnumberofmates
——返回匹配'groups'的孔/管的数量
——hm_holedetectiongetnumberofmates
——之前必须有一个对hm_holedetectionfindmates的调用
HyperWorks二次开发API-孔的识别相关推荐
- 微信API接口、微信二次开发API调用
微信API接口.微信二次开发API调用 微信协议接口调用-加微信好友及通过好友请求 加微信好友 /** * 微信自动添加好友 * @author wechatno:tangjin ...
- SaltStack二次开发api
salt-api官方文档: http://www.unixhot.com/docs/saltstack/ref/netapi/all/salt.netapi.rest_cherrypy.html#a- ...
- php离线地图,如何发布百度离线地图及二次开发API
相关教程: 1.说明 离线地图开发环境支持谷歌地图.百度地图.高德地图等等所有常用地图类型,支持在局域网内的地图部署.二次开发. 2.实现 第一步:下载安装离线地图开发环境 下载安装好之后,启动软件, ...
- 微信公众平台二次开发 API开发 服务账号开发 订阅号开发
移动互联网时代已经到来,微信已经有6亿多的用户,是移动端最大的入口.微网站,微商城建设,提供定制化服务,根据客户需求开发.客户很方便就能了解到公司的所有信息和最新动态,随时随地都可以跟公司进行互动,增 ...
- ArcEngine二次开发API之Bug集(一 )
今天,在本集(一)中给大家讲三个bug的集,这三个bug害的我弄了好几天,这几天的教训,也让我明白了今后的开发中,也不能完全相信API,难免API也会出现使用描述的错误. 1.GP之ExtractBy ...
- C# SolidWorks 二次开发 API --- 2018版 中文翻译 之官方示例
这是2018版 自带帮助文件的API例子中文导航,如果有错误的,请指出来 时间原因,我没有一一测试,只是大概过滤了一下. 共计750个例 子: 中文标题 Web Link 将绘图表缩放到窗口中的最大尺 ...
- C# SolidWorks 二次开发 API --- 2018版 中文翻译 ModelDocExtension 方法
AddAngularRunningDim Method (IModelDocExtension) 为选定实体添加指定的角度运行标注. AddComment Method (IModelDocExten ...
- C# SolidWorks 二次开发 API --- 2018版 中文翻译-完整版共享
这是2018的api帮助文档看了一下翻译版,我把之前翻译的文件免费共享下,希望能对大家有所帮助. 如果大家想查找快速了解某个功能,可以直接在Excel表中查找全部. 之前有两篇共享了官方示例与Mode ...
- C# SolidWorks 二次开发 API --- 实例:打包文件
我们开发的程序使用过程中经常要使用一些做好的模板,尤其是参数化的时候,这样就难免有一些文件需要从指定的地方复制过来,或者说还要把文件名替换掉,还可以加一些前缀或者后缀.这个例子也只是一个最简单的打包方 ...
最新文章
- ASP.NET页面指令
- 宝塔ssl验证域名失败_申请一年期限的AlphaSSL泛域名证书 – 安装第三方证书
- aix oracle 10.2.0.1 升级 10.2.0.4,AIX Oracle RAC 升级到10.2.0.4.0要特别注意的问题 - 爱肯的专栏 ......
- Python 集合(set) 介绍
- 关于SpringMvc实践的一些体会和总结
- POST+JSON+JS下载Excel或CSV
- 【实习之T100开发】T100 双档程序开发流程
- Linux-sed command
- iOS - JSON 数据解析
- fileupload控件的属性_FileUpload上传控件用法详解
- Eclipse 中Alt+/快捷键失效的解决办法。
- e盘根目录出现个Msdia80.dll怎么办?
- Bada项目的目录结构
- 计算机网络协议教案反思,《TCP/IP协议分析》教学实践与反思
- android 百度地图定位图标素材,百度地图定位开发图标大全 百度地图开发可以用到的一些实用标注/图标(baidu map development) - 下载 - 搜珍网...
- 模拟夜间灯光-科目三-灯光口令(9选5)
- SQLiteSpy软件学习sql语句Group by的各种用法。
- Java 水果排序
- Fuchsia OS 编译教程 2019 年版
- 一、计算机程序申请专利注意事项解读
热门文章
- 致敬我奋起直追的2016
- k8s安全 认证 鉴权 准入控制之二:授权(Authorization)
- Skype Translator上线 多语言实时翻译
- 企业微信会话归档接入 结构设计
- mMySQL中触发器和游标的介绍与使用L8.0.23免安装版配置详细教程 msi安装超详细教程
- C++各大著名库介绍
- mysql数据库替换语句_Mysql数据库字符串替换常用语句
- java网络编程入门到精通
- php实现五维雷达图,甲贺忍法帖人物数据分析+五维雷达图【个人向】
- 计算机软件算法的定义,软件算法