为了账号安全,请及时绑定邮箱和手机立即绑定

Python - 使用方法和函数

Python - 使用方法和函数

幕布斯7119047 2021-07-16 17:08:31
我想编写一个能够从 AutoDesk Inventor 模型读取结构的脚本。Inventor 已安装并运行,并通过 win32.com 建立到它的连接。加载模型后,设置了一些变量,我被卡住了。我有这个列表 oStructuredBOMView.BOMRows>> print(len(oStructuredBOMView.BOMRows))2我可以参考一项>> print(oStructuredBOMView.BOMRows.Item(1))<win32com.gen_py.Autodesk Inventor Object Library.BOMRow instance at 0x88831536>使用目录我可以显示所有函数/方法>> print(dir(oStructuredBOMView.BOMRows.Item(1)))['CLSID', 'GetReferenceKey', '_ApplyTypes_', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_get_good_object_', '_get_good_single_object_', '_oleobj_', '_prop_map_get_', '_prop_map_put_', 'coclass_clsid']这是我不能超越的点。如何使用此函数/方法来提取更多信息?例子:>> oStructuredBOMView.BOMRows.Item(1).sizeofTraceback (most recent call last):  File "<pyshell#22>", line 1, in <module>    oStructuredBOMView.BOMRows.Item(1).sizeof  File "C:\python\Python35\lib\site-packages\win32com\client\__init__.py", line 473, in __getattr__    raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr))AttributeError: '<win32com.gen_py.Autodesk Inventor Object Library.BOMRow        instance at 0x88417896>' object has no attribute 'sizeof'>> sizeof(oStructuredBOMView.BOMRows.Item(1))Traceback (most recent call last):  File "<pyshell#23>", line 1, in <module>sizeof(oStructuredBOMView.BOMRows.Item(1))NameError: name 'sizeof' is not defined
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 190 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号