ObjectARX

Reply
Contributor
23 Posts
0 Kudos
Registered: ‎09-20-2005
Post 1 of 7

Determine AutoCAD Type

288 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
209 Posts
0 Kudos
Registered: ‎11-28-2003
Post 2 of 7

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
Post 3 of 7

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
303 Posts
1 Kudo
Registered: ‎09-26-2004
Post 4 of 7

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
23 Posts
0 Kudos
Registered: ‎09-20-2005
Post 5 of 7

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
30 Posts
0 Kudos
Registered: ‎09-13-2012
Post 6 of 7

Re: Determine AutoCAD Type

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

What is this: CRegistry ??

error C2065: 'CRegistry' : undeclared identifier

Moderator
1,465 Posts
277 Kudos
Registered: ‎04-09-2008
Post 7 of 7

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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post