找回密码
 注册
Simdroid-非首页
查看: 240|回复: 9

[其他] ansa_python学习贴

[复制链接]
发表于 2015-1-9 10:41:15 | 显示全部楼层 |阅读模式 来自 吉林长春
import os
import ansa
from ansa import base
from ansa import constants

def main():
        # Need some documentation? Run this with F5
        """Docstrings for function help"""
        #Collect the parts
        search_type = ('ANSAPART',)
        parts = base.CollectEntities(constants.NASTRAN, None, search_type, True)
             #Use each part as a container in order to collect its faces
        search_type = ('FACE',)
        faces = list()
        for part in parts:
                 container = [part] #The container must be in a matrix form
                 faces.append(base.CollectEntities(constants.NASTRAN,container,search_type,False))
       
        print(faces)   

       


if __name__ == '__main__':
        main()

print(len(faces))结果为1,这是为什么?
还有,帮助里面的错误也太多了,希腊的beta公司就这态度还能好?
 楼主| 发表于 2015-1-9 10:58:56 | 显示全部楼层 来自 吉林长春
Simdroid开发平台
原因找到了:
        print(faces)
        print(type(faces))
        print((faces[0]))
        print(type(faces[0]))
        print(faces[0][1])
        print(type(faces[0][1]))

结果为:
[[<Entity: 0x00000000105E6350: type: 3908(3908,G_FACE) id:158>, <Entity: 0x00000000105E86F8: type: 3908(3908,G_FACE) id:160>]]
<class 'list'>
[<Entity: 0x00000000105E6350: type: 3908(3908,G_FACE) id:158>, <Entity: 0x00000000105E86F8: type: 3908(3908,G_FACE) id:160>]
<class 'list'>
<Entity: 0x00000000105E86F8: type: 3908(3908,G_FACE) id:160>
<class 'ansa.base.Entity'>
这里是列表包含列表,有没有办法生成只有一个列表的表示啊?
回复 不支持

使用道具 举报

发表于 2015-1-19 16:22:35 | 显示全部楼层 来自 河北保定
                 container = [part] #The container must be in a matrix form
                 faces.append(base.CollectEntities(constants.NASTRAN,container,search_type,False))

这两句你把上面一句去掉,下面一句改为faces.append(base.CollectEntities(constants.NASTRAN,part,search_type,False))
试试
回复 不支持

使用道具 举报

发表于 2015-1-19 16:23:59 | 显示全部楼层 来自 河北保定
yijianluo 发表于 2015-1-9 10:58
原因找到了:
        print(faces)
        print(type(faces))

帮助里错误确实太多,尤其是例子中,最好一个一个调试
回复 不支持

使用道具 举报

发表于 2015-3-12 15:59:19 | 显示全部楼层 来自 上海长宁区
个人意见,仅供参考:
ansa的版本好些,发展时间长, 但是帮助 和script的文件 是累加的 方式写的,所以老斑的,新版就有问题。
而且那个python是基于script改写的,帮助就改了一下,所以问题多得。
那个上面的 例子,有问题的,有些调出来的就是句柄,也就是地址,所以没有什么打印意义的,所以不需要输出的。
回复 不支持

使用道具 举报

发表于 2015-5-4 09:35:24 | 显示全部楼层 来自 河北保定
楼主 NASTRAN做频响分析时,输出的FREQ1改怎么写程序啊?  研究过么?
回复 不支持

使用道具 举报

 楼主| 发表于 2015-5-4 11:22:51 | 显示全部楼层 来自 吉林长春
419435663 发表于 2015-5-4 09:35
楼主 NASTRAN做频响分析时,输出的FREQ1改怎么写程序啊?  研究过么? ...

没用过nastran
回复 不支持

使用道具 举报

发表于 2015-5-4 11:29:54 | 显示全部楼层 来自 河北保定

其他软件做频响分析也得定义频率吧?   有做过么?
回复 不支持

使用道具 举报

发表于 2015-5-10 12:04:38 | 显示全部楼层 来自 贵州贵阳
谢谢楼主的无私奉献!
回复 不支持

使用道具 举报

 楼主| 发表于 2015-5-11 18:25:33 | 显示全部楼层 来自 吉林长春
419435663 发表于 2015-5-4 11:29
其他软件做频响分析也得定义频率吧?   有做过么?

我主要做结构疲劳方面的
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-4-20 01:06 , Processed in 0.036809 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表