CATIA.Windows Error. Possible V5 vs. 3DX conflict

Ryan Binter

CATIA.Windows Error. Possible V5 vs. 3DX conflict

I am getting error 430 "Class does not support Automation or does not support expected interface" when running this simple macro in the V5 visual basic editor.


 

Sub CATMain()
Dim Wins As Windows
Set Wins = CATIA.Windows 'This line throws error 430
End Sub

Sub CATMain()
Dim App As Application
Set App = CATIA 'this line runs fine

Dim Wins As Windows
Set Wins = App.Windows 'this line throws error 430
End Sub

I noticed that the issue arose when I referenced the Windows object not when I referenced the CATIA Application object. I looked at the V5 automation documentation and saw that the Windows object is part of the InfInterfaces Framework and opened up the Tools>References menu in the VBA editor and saw that the file path to the CATIA INFInterfacesTLB Object Library was not referencing the same file path as my other V5 references.

CATIA INFInterfacesTLB Object Library Is located in C:\Program Files\Dassault Systemes\B421\win_b64\code\bin

My other V5 references are located in C:\Catia\B20B\win_b64\code\bin

 

I suspect that the issue is that VBA is trying to use 3DX versions of the library instead of the V5 version of the library since it is newer. Is there a way i can manually change the reference to the InfInterfaces library in the V5 folder without uninstalling 3DX?

 

Josh Bender

RE: CATIA.Windows Error. Possible V5 vs. 3DX conflict
(in response to Ryan Binter)

I just tried both circumstances with V5 R2018. I don't have 3DX installed. No issues - so your guess is probably pretty good about it conflicting with the 3DX library.

Is the issue strictly due to the object definition? What if you changed Wins to type variant?

Another thing to look into - I don't have an object library called "INFInterfacesTLB" as an option in my reference library, but I do have CATIA V5 infInterfaces Object Library. Perhaps just removing that as a reference will fix the issue?

Ryan Binter

RE: CATIA.Windows Error. Possible V5 vs. 3DX conflict
(in response to Josh Bender)

Defining all the variables as object or as variant seemed to work for some reason so I guess I will be able to continue the macro I was working on however, I don't enjoy having to throw away intellisense and any compile-time error checking just to work around this issue. Thanks for the advice though. Others can easily do this if they run into the same issue.

I cant seem to find the CATIA V5 infInterfaces Object Library but removing the reference to CATIA INFInterfacesTLB Object Library didnt allow the program to compile since it no longer recognized the Application or Windows objects. 

 

This code ran just fine with or without any InfInterfaces references:


Sub CATMain()
Dim App As Object 'Application
Set App = CATIA

Dim Wins As Object 'Windows
Set Wins = App.Windows
End Sub