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

[子程序/二次开发] python报错TypeError。

[复制链接]
发表于 2019-4-1 10:49:31 | 显示全部楼层 |阅读模式 来自 上海
大家好,我在marc中运行python时,一直报TypeError的错,求助,谢谢。
报错信息如下:TypeError:main()takes exactly 3 arguments(0 given)。我实际上给了三个值了啊。
程序如下:
  1. #!/user/bin/python
  2. # -*- coding:utf-8 -*-
  3. from py_mentat import *
  4. from py_post import *
  5. import os,os.path,glob
  6. def main(inpPath,facePath,pointPath):
  7.     py_send("*new_model  yes")
  8.     py_send("*import abaqus %s "%(inpPath))
  9.     py_send("*select_elements_class quad4")
  10.     py_send("*invisible_selected")
  11.     py_send("*remove_elements   all_visible")
  12.     py_send("*remove_nodes   all_visible")
  13.     py_send("*sweep_all")
  14.     py_send("*remove_unused_points")
  15.     py_send("*remove_unused_nodes")
  16.     py_send("*invisible_selected")
  17.     py_send("*face_surfaces  all_existing")
  18.     py_send("*sweep_all")
  19.     py_send("*remove_unused_points")
  20.     py_send("*remove_unused_nodes")
  21.     py_send("*renumber_all")
  22.     py_send("*clear_mesh")
  23.     # 导出模型面igs
  24.     py_send("*set_length_unit millimeter")
  25.     py_send("*export iges %s yes" %(facePath ))
  26.     # 导出模型点igs
  27.     py_send("*remove_surfaces all_visible")
  28.     py_send("*fill_view")
  29.     py_send("*set_length_unit millimeter")
  30.     py_send("*export iges %s yes" %(pointPath ))

  31. if __name__ == '__main__':
  32.     inpfiles = [eachinp.split('.')[0] for eachinp in glob.glob('*.inp') if 'result' in eachinp]
  33.     print(inpfiles)
  34.     path = r'F:\VV\sy midline\result\igs'
  35.     for each in inpfiles:
  36.         # extra = each.split('.')[0]
  37.         file = os.path.join(path,each)
  38.         inpPath =file+'.inp'
  39.         facePath = file + '.igs'
  40.         pointPath = file + '-point.igs'
  41.         main(inpPath, facePath, pointPath)
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

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

本版积分规则

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

GMT+8, 2024-4-26 18:29 , Processed in 0.026650 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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