我正在尝试用python为CATIA编写脚本(我已经使用了VBA,但这里我只需要用python)。我的代码如下所示:
import win32com.client.dynamic
import numpy as np
CATIA = win32com.client.Dispatch("CATIA.Application")
documents1 = CATIA.Documents
partDocument1 = documents1.Add("Part")
part1 = partDocument1.Part错误是:
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)如有任何帮助或建议,请提前致谢!
免责声明:我已经检查了一些类似的例子,但找不到我的答案。For Example Similar question but without the answer
发布于 2019-05-07 02:58:14
一种可能是您的CATIA DLL未注册。如果是这种情况,您可以通过在PowerShell提示符下以管理员身份运行以下命令来注册它们:
& "<CATIA installation path>\win_b64\code\bin\V5RegServer" -set CATIAhttps://stackoverflow.com/questions/53064942
复制相似问题