ProgID

ProgID

softBYLHY
Explorer Explorer
3,219 Views
9 Replies
Message 1 of 10

ProgID

softBYLHY
Explorer
Explorer

Helllo Autodesk Support,

We are currently facing an issue with running two different versions of AutoCAD on the same machine: AutoCAD 2021 for automation purposes and AutoCAD 2024 for manual drawing tasks. Such setup is needed due to the different configurations, plugins, and locales each version requires.

Before the dual installation, our automation scripts were running smoothly as they engaged AutoCAD 2021 only as a Win32 COM Server. However, after installing AutoCAD 2024, we noticed that it has overridden the Windows Registry records related to the AutoCAD 2021 COM servers, such as HKEY_CLASSES_ROOT\AutoCAD.Application, among others. As a result, AutoCAD 2024 launches every time we try to execute our automation scripts.

We've attempted to address this by using the ProgID: "AutoCAD.Application.24.0", as suggested in the official guide: https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-0EDC04D5-2ACB-4555-B5AC-936D54A9FF61. However, when we tried to create an AutoCAD instance using this ProgID, we encountered an "Invalid class string" error. Upon checking the Windows Registry, we found that the record "AutoCAD.Application.24.0" was absent, and all existing "AutoCAD.Application.*" records with corresponding CLSID's pointed to "C:\Program Files\Autodesk\AutoCAD 2024\acad.exe" only.

Could you please assist us with configuring our registry or AutoCAD instances to ensure the AutoCAD 2021 version is always used for our automation scripts? Additionally, we would appreciate guidance to ensure this configuration isn't overridden by manual runs of AutoCAD 2024 or by the installation of any other versions in the future.

Thank you in advance for your support and guidance.

0 Likes
3,220 Views
9 Replies
Replies (9)
Message 2 of 10

norman.yuan
Mentor
Mentor

Firstly, this discussion forum is peer-to-peer support among AutoCAD users voluntarily, not for official Autodesk technical support. Secondly, the topics of this forum are for AutoCAD .NET API customized programming. So, if you are seeking official Autodesk technical support, you'd better find right place rather than here.

 

With that said, here are some things about AutoCAD application's ProgID in Windows Registry:

 

If a Windows computer has multiple versions of AutoCAD installed, there will be multiple "ProgIDs" registered in the Registry (Computer\HKEY_CLASSES_ROOT). For example, in my computer, there are Acad2020 to Acad2023 installed, thus the AutoCAD's registries look like:

 

normanyuan_0-1688059148715.png

 

The item "AutCAD.Application.2x.x" are for each version of AutoCAD (23 for 2020, 24 for 2021...). They have fixed CLSID. However, the CLSID of the item "AutoCAD.Application" IS NOT FIXED. Its CLSID is the version of AutoCAD of LAST RUNNING. That is, if you run AutoCAD 2021, the Acad2021's CLSID is updated to "AutoCAD.Application". Then, if you run Acad2023, the CLSID of "AutoCAD.Application" changes to the CLSID of Acad2023.

 

So, if your application (the one does the automating) is somehow depending on the registry "AutoCAD.Application", then, yes, it may start different version of AutoCAD, when the computer is used by actual CAD user, who could use different versions of AutoCAD.

 

So, it sounds to me, it is your application design/development issue (e.g. not coded properly). Since you did not provide more details on how the application is developed, nor showed relevant code, there isn't much more I can say.

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 10

softBYLHY
Explorer
Explorer

Hey norman.yuan. Firstly, my apologies for initially posting this query in an incorrect thread.

I'm experiencing an issue that I initially detailed regarding the lack of the ProgID "AutoCAD.Application.24.0" for AutoCAD 2021, which should be present as per the official guide.

I'd like to emphasize that our usage isn't dependent on the general ProgID "AutoCAD.Application". We don't attempt to use it, aware of the potential changes. The assumption that we were leveraging it was perhaps a misunderstanding. We merely brought up this key to illustrate that all keys were overridden post-installation. We're in search of a stable ProgID, ideally "AutoCAD.Application.24.0", but it appears to be absent.

To provide you with more context, although it's mainly dependent on the registry's ProgID's, we utilize Python to operate COM-applications in the usual manner via the win32com library: 'win32com.client.Dispatch("AutoCAD.Application")'

0 Likes
Message 4 of 10

norman.yuan
Mentor
Mentor

Are you saying that in the Windows registry (HKEY_CLASSES_ROOT) there is no "AutoCAD.Application.24.0" in spite AutoCAD 2021 indeed installed? Now that AutoCAD 2024 installed, is there item "AutoCAD.Application.24.3" in the HKEY_CLASSES_ROOT? Or even both are not there, and only "AutoCAD.Application"? I have multiple computers with multiple versions of AutoCAD installed, I do not see a case where the ProgID of installed AutoCAD is missing. Oppositely, I do see cases where older AutoCAD version has been uninstalled, the its ProgID is is still there. The picture showed in my previous reply showing ProgID "AutoCAD.Application.23" for AutoCAD 2020, but I had already uninstalled Acad2020 from that computer. You might want to go to other computers with multiple AutoCAD version installed to verify. 

 

This code: of yours:

'win32com.client.Dispatch("AutoCAD.Application")'

CLEARLY INDICATES that your python app DEPENDS ON the ProgID "AutoCAD.Application", which would start different version of AutoCAD, determined the AutoCAD version of last running AutoCAD session running in this computer. If your Python must only runs with AutoCAD 2021, you must use AutoCAD 2021 specific ProgID "AutoCAD.Application.24" when the computer has multiple Acad version installed. Well, if you say/claim "AutoCAD.Application.24" do not exist in spite Acad2021 is installed, then I do not know what happened to that computer. Maybe uninstall/reinstall, or repair is needed?

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 10

Jeff_M
Consultant
Consultant

I believe the documentation is incorrect. There are no "*.0" application entries. I have Autocad 2018-2024 installed and not one "*.0" in the registry. This image shows that 2016 & 2017 are also installed but those have been uninstalled with the registry entries getting left behind.

2023-06-30_07-16-17.png

 

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 6 of 10

norman.yuan
Mentor
Mentor

Ah, seeing the picture posted by @Jeff_M , I need to correct minor mistake in my reply: in my computer with the picture I showed, "AutoCAD.Application.23" is Acad2019, I did not installed Acad2020 in the computer, thus the missing "AutoCAD.Application.23.1".

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 10

l.nikiforov
Explorer
Explorer

Hey norman.yuan and Jeff_M. I'm writing from my personal work account instead of corporate one.

 

Just to clarify, the 'win32com.client.Dispatch("AutoCAD.Application")' was merely an example from back when we used that particular ProgID in our code. Now we tried to switch to other versions, e.g. 'win32com.client.Dispatch("AutoCAD.Application.24.0")'. But as I wrote, no luck so far, unfortunately.

 

 

I've attached a screenshot that displays both AutoCAD 2021 and 2024 installed on our computer.

 

lnikiforov_0-1689840888825.jpeg

 

 

Also, I'm attaching another screenshot of our computer's registry. It shows an old 2020 entry, which we don't use anymore, and a bunch of entries for the 2024 version. You'll notice there's no entry for the 2021 version, even though we have it installed too:

 

lnikiforov_1-1689840898234.jpeg

 

 

AutoCAD.Application {8B4929F8-076F-4AEC-AFEE-8928747B7AE3} C:\Program Files\Autodesk\AutoCAD 2024\acad.exe /Automation

AutoCAD.Application.23 {4AC6DFE1-607B-45B2-B289-D7FBCD44169C} C:\Program Files\Autodesk\AutoCAD 2020\acad.exe /Automation

AutoCAD.Application.24 {8B4929F8-076F-4AEC-AFEE-8928747B7AE3} C:\Program Files\Autodesk\AutoCAD 2024\acad.exe /Automation

AutoCAD.Application.24.1 {AA46BA8A-9825-40FD-8493-0BA3C4D5CEB5} C:\Program Files\Autodesk\AutoCAD 2024\acad.exe /Automation

AutoCAD.Application.24.2 {169B5B8E-E315-41C7-9574-66FC7E530D10} C:\Program Files\Autodesk\AutoCAD 2024\acad.exe /Automation

AutoCAD.Application.24.3 {AF18D91C-A699-4578-ADC6-972F3BA007F0} C:\Program Files\Autodesk\AutoCAD 2024\acad.exe /Automation

 

 

As a workaround, we attempted to manually generate the CLSID and create a corresponding registry key for the 2021 version (with LocalServer32 and ProgID keys under the CLSID). Unfortunately, this approach has proven unsuccessful, as AutoCAD won't start, returning the error code 2146959355 after some timeout: "Error executing application-server" (translated from OS main language).

0 Likes
Message 8 of 10

l.nikiforov
Explorer
Explorer

Hello Autodesk Community,

Are there alternative solutions we might consider implementing?

Is it possible to configure AutoCAD Installation in a specific way to guarantee the creation of a dedicated ProgID in the registry? Or is there a manual process for generating and creating such registry manually?
Thank you in advance

0 Likes
Message 9 of 10

ntclmain
Advocate
Advocate

Seems that the "automation scripts" use the GetObject() function to call Acad Application (?)

Here, I think we need to clarify 2 cases:

- Case 1:   "automation scripts" needs to Identify AutoCAD 2021 and AutoCAD 2024 ==> This is topic's question.

- Case 2:  "automation scripts" needs to identify a specific instance among multiple instances of the same AutoCAD versions ==> This is impossible with COM Object.

*

For case 1, should we try a series of "blind" GetObject(,"AutoCAD.Application.x.x") function.   If the function sucessful, then the parameter "AutoCAD.Application.x.x" will be used to determine which AutoCAD version is running.

 

Public Shared Function GetObject_Universal_ProgID(ByRef myAcadApp As IAcadApplication) As Boolean
        'https://forums.autodesk.com/t5/net/system-invalidcastexception-on-all-objects/td-p/8198484
        'Remove ".0" from 17.0, 18.0, 19.0.....version number
        Dim arrCadVersions As String() = {"AutoCAD.Application.16.1", "AutoCAD.Application.16.2", "AutoCAD.Application.17", "AutoCAD.Application.17.1",
                                       "AutoCAD.Application.17.2", "AutoCAD.Application.18", "AutoCAD.Application.18.1", "AutoCAD.Application.18.2", "AutoCAD.Application.19",
                                       "AutoCAD.Application.19.1", "AutoCAD.Application.20", "AutoCAD.Application.20.1", "AutoCAD.Application.21", "AutoCAD.Application.22",
                                       "AutoCAD.Application.23", "AutoCAD.Application.23.1", "AutoCAD.Application.24", "AutoCAD.Application.24.1", "AutoCAD.Application.24.2", "AutoCAD.Application.24.3"}

        Dim j As Int32 
        Dim myresult As Boolean = False
        For j = arrCadVersions.Length - 1 To 0 Step -1
            Try
                myAcadApp = Interaction.GetObject(, arrCadVersions(j))
                myresult = True
                Exit For
            Catch ex As Exception
                Continue For  
            End Try
        Next
        Return myresult
     End Function

 

 

0 Likes
Message 10 of 10

l.nikiforov
Explorer
Explorer
No, it's not. There wasn't an issue in identifying AutoCAD version at all, and moreover automatically.
The problem is that there's no corresponding AutoCAD ProgID in Windows Registry and the question was how could we add it manually or re-configure installation wizards/scripts to ensure the new ProgID will be present there
0 Likes