Will HostApplicationServices return the correct instance of AutoCAD?

Will HostApplicationServices return the correct instance of AutoCAD?

soonhui
Advisor Advisor
335 Views
4 Replies
Message 1 of 5

Will HostApplicationServices return the correct instance of AutoCAD?

soonhui
Advisor
Advisor

From the help it says that

The HostApplicationServices class provides various services to host applications at runtime. 

I guess that means that if I have multiple ACAD/C3D version installed, then the HostApplicationServices will return the registry key sets differently, depending on which version that is currently running? It does seem that way, but I need to be sure. 

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Accepted solutions (1)
336 Views
4 Replies
Replies (4)
Message 2 of 5

daniel_cadext
Advisor
Advisor

I use it to load ARX modules in vanilla , hasn’t failed yet

 

    static void loadDBXModules()
    {
        const int version = acdbHostApplicationServices()->releaseMajorVersion();
        const auto acismobj = std::format(_T("acismobj{}.dbx"), version);
        const auto acMPolygonObj = std::format(_T("AcMPolygonObj{}.dbx"), version);
        if (const auto result = acrxLoadModule(acismobj.c_str(), false, false); !result)
            acutPrintf(_T("Failed to load %ls: "), acismobj.c_str());
        if (const auto result = acrxLoadModule(acMPolygonObj.c_str(), false, false); !result)
            acutPrintf(_T("Failed to load %ls: "), acMPolygonObj.c_str());
    }
Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
Message 3 of 5

soonhui
Advisor
Advisor

@daniel_cadext , but this is not .Net though. 

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
Message 4 of 5

ActivistInvestor
Mentor
Mentor
Accepted solution

Yes, it returns the registry keys for the executing product. It doesn't know anything about any other installed products other than the one that is running. 

Message 5 of 5

daniel_cadext
Advisor
Advisor

@soonhui .NET is a wrapper around ARX

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes