ObjectARX

Reply
Contributor
schneider
Posts: 23
Registered: ‎09-20-2005
Message 1 of 7 (268 Views)

Determine AutoCAD Type

268 Views, 6 Replies
09-06-2006 07:13 AM
Hi all,

is there a possibility to determine what type of AutoCAD is running? Standard AutoCAD or Map3D or Civil3D or whatever? I already drag the version info from the currently running acad.exe file, but there is to information about the AutoCAD type saved in the version info. I could parse the path, but that's not a solution for me since everyone can change the pathname to whatever he likes.
Any ideas?
Thanks in advance!

Cheers, Hannes
Distinguished Contributor
davidm_adn
Posts: 208
Registered: ‎11-28-2003
Message 2 of 7 (267 Views)

Re: Determine AutoCAD Type

09-06-2006 08:58 AM in reply to: schneider
Hannes,

Its in the registry:
HKLM\Software\Autodesk\R**.*\ACAD-****:***\ProductName
*Deelip Menezes
Message 3 of 7 (267 Views)

Re: Determine AutoCAD Type

09-06-2006 09:15 AM in reply to: schneider
How about the AutoCAD _VERNUM variable?

Deelip Menezes

wrote in message news:5319201@discussion.autodesk.com...
Hi all,

is there a possibility to determine what type of AutoCAD is running?
Standard AutoCAD or Map3D or Civil3D or whatever? I already drag the version
info from the currently running acad.exe file, but there is to information
about the AutoCAD type saved in the version info. I could parse the path,
but that's not a solution for me since everyone can change the pathname to
whatever he likes.
Any ideas?
Thanks in advance!

Cheers, Hannes
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 4 of 7 (267 Views)

Re: Determine AutoCAD Type

09-06-2006 09:54 AM in reply to: schneider
It's code maybe useful for you:
[code]
static public void AInfo()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
string AcadVer = Autodesk.AutoCAD.ApplicationServices.Application.Version.ToString();
ed.WriteMessage("\nAcadVersion: {0}", AcadVer);
string ProductKey = Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.ProductKey;
ed.WriteMessage("\nProductKey: {0}", ProductKey);
RegistryKey key = Registry.LocalMachine.OpenSubKey(ProductKey);
string ProductName = key.GetValue("ProductName").ToString();
ed.WriteMessage("\nProductName: {0}", ProductName);
string ProductId = key.GetValue("ProductId").ToString();
ed.WriteMessage("\nProductId: {0}", ProductId);
string ProductCode = key.GetValue("ProductCode").ToString();
ed.WriteMessage("\nProductCode: {0}", ProductCode);
}
[/code]
In ObjectARX you can use:
AcDbHostApplicationServices::getRegistryProductRootKey()
AcDbHostApplicationServices::smileytongue:roduct()
and so on. Message was edited by: Alexander Rivilis
Contributor
schneider
Posts: 23
Registered: ‎09-20-2005
Message 5 of 7 (267 Views)

Re: Determine AutoCAD Type

09-07-2006 01:56 AM in reply to: schneider
Thanks for all replies. I've found a way to definitely distinguish between different AutoCAD releases and versions. For those also facing this problem, here is the way to go:

CString regRootKey = acdbHostApplicationServices()->getRegistryProductRootKey();
CRegistry reg;
reg.Open(HKEY_LOCAL_MACHINE, regRootKey, KEY_READ);
TCHAR buf[200];
ULONG bufSize = 200;
reg.QueryStringValue(_T("ProductName"), buf, &bufSize);
reg.Close();

Now buf is "AutoCAD 200x" for standard AutoCAD-Releases, "Autodesk Map 3D 200x" for Map3D, "Autodesk Civil 3D 200x" for Civil3D and so on.

Thanks everyone for pointing me to the right direction.

Cheers, Hannes.
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 6 of 7 (154 Views)

Re: Determine AutoCAD Type

09-13-2012 05:43 AM in reply to: schneider

What is this: CRegistry ??

error C2065: 'CRegistry' : undeclared identifier

Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 7 of 7 (139 Views)

Re: Determine AutoCAD Type

09-15-2012 07:48 AM in reply to: ZK_BUDiKOM

ZK_BUDiKOM wrote:

What is this: CRegistry ??

error C2065: 'CRegistry' : undeclared identifier


Registry Wrapper Class (CRegistry)

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community