• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk ObjectARX

    Reply
    Contributor
    Posts: 23
    Registered: ‎09-20-2005

    Determine AutoCAD Type

    221 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
    Please use plain text.
    Distinguished Contributor
    Posts: 199
    Registered: ‎11-28-2003

    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
    Please use plain text.
    *Deelip Menezes

    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
    Please use plain text.
    Distinguished Contributor
    Posts: 303
    Registered: ‎09-26-2004

    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
    Please use plain text.
    Contributor
    Posts: 23
    Registered: ‎09-20-2005

    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.
    Please use plain text.
    Active Contributor
    Posts: 30
    Registered: ‎09-13-2012

    Re: Determine AutoCAD Type

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

    What is this: CRegistry ??

    error C2065: 'CRegistry' : undeclared identifier

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,178
    Registered: ‎04-09-2008

    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

    Please use plain text.