【问题标题】:Want to use python with CATIA? This approach CATIA = win32com.client.Dispatch("CATIA.Application") giving me an error?想在 CATIA 中使用 python?这种方法 CATIA = win32com.client.Dispatch("CATIA.Application") 给我一个错误?
【发布时间】:2019-05-07 02:58:13
【问题描述】:

我正在尝试使用 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

【问题讨论】:

    标签: scripting python-3.6 catia


    【解决方案1】:

    一种可能是您的 CATIA DLL 未注册。如果是这种情况,您可以通过在 PowerShell 提示符下以管理员身份运行以下命令来注册它们:

    & "<CATIA installation path>\win_b64\code\bin\V5RegServer" -set CATIA
    

    【讨论】:

      猜你喜欢
      • 2014-04-22
      • 1970-01-01
      • 1970-01-01
      • 2015-11-07
      • 1970-01-01
      • 2021-08-30
      • 1970-01-01
      • 1970-01-01
      • 2012-06-18
      相关资源
      最近更新 更多