I've recently started doing a bit of Python coding, using VS Code, to create macros / applications for CATIA (using it's COM interface). In CATIA itself, I can use the included VBA editor to write macros, and in that editor I get full "intellisense" as expected. But when working in VS Code, there is no intellisense for the CATIA COM objects when editing the code, and so it is necessary to keep consulting the API documentation for objects types, methods, properties, enums constants etc ...
Based on research I've done, I believe it is possible to get intellisense working for these CATIA COM objects, but I've so far failed to actually get it working - hence I am here (for intelligence of the ACTUAL kind, and not the artificial kind!).
Here's a snippet of code to connect to a runing instance of the CATIA application:
from win32com.client.gencache import EnsureDispatch
CATIA = EnsureDispatch("CATIA.Application")
oActiveWindow = CATIA.ActiveWindow
My full python code works as expected at runtime. I'm just trying to get intellisense working in VS Code for easier coding.
I have the same issue if I try to work with Excel using win32com. After xlApp = EnsureDispatch("Excel.Application") intellisense doesn't present any methods / properties for xlApp.
If anybody can offer some guidance it would be much appreciated!
The code snippet I provided results in the required CATIA registered type libraries getting converted to python classes in %LOCALAPPDATA%\Temp\gen_py\3.13. Based on the research I've done, if I create a .env file in my python project folder and set PYTHONPATH to this folder path, then intellisense should work ... but it's not for me.