2

I am trying to write scripts for CATIA with python(I already used VBA but here I need to do with python only). My code looks like this:

 import win32com.client.dynamic
 import numpy as np

 CATIA = win32com.client.Dispatch("CATIA.Application")
 documents1 = CATIA.Documents
 partDocument1 = documents1.Add("Part")
 part1 = partDocument1.Part

Error is :

IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, 
pythoncom.IID_IDispatch)

com_error: (-2147221005, 'Invalid class string', None, None)

For any help or suggestion thanks in advance!

Disclaimer: I have checked some similar examples but couldn't find my answer. For Example Similar question but without the answer

Juliet.K
  • 95
  • 11

1 Answers1

0

One possibility is that your CATIA DLLs are unregistered. If this is the case, you can register them by running the following from a PowerShell prompt as administrator:

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