Thursday, April 19, 2007

Determine programmatically if AutoCAD 2008 is 32-bit or 64-bit

Here are some alternative ways that can help you know if AutoCAD 2008 or another AutoCAD version is 32-bit or 64-bit as well as what the platform is.
Why would you want to do this? One reason is that DOSLib 7.5 has separate ARX files for 32 and 64 bit and you might want to check this using AutoLISP before loading DOSLib if you have users with different OS's.
The system variable PLATFORM might also be used. It indicates which platform is in use. The result can be something like: "Microsoft Windows NT Version 6.0 (x86)"
Windows Environment variable PROCESSOR_ARCHITECTURE is x86 for 32-bit and x64 for 64-bit.
vlax-get-acad-object in 64-bit return a longer object ID number than in the 32-bit so the function Acad64Bit-version will return T if AutoCAD is a 64-bit version.
Acad64Bit-platform will return T if the Windows OS platform is 64-bit.

(defun Acad64Bit-version () (vl-load-com) (> (strlen (vl-prin1-to-string (vlax-get-acad-object))) 40) ) (defun Acad64Bit-platform () (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE")) )

You can call the above like this:

(princ (if (Acad64Bit-version) "AutoCAD 64-bit, " "AutoCAD 64-bit, "))
(princ (if (Acad64Bit-platform) "Windows 64-bit" "Windows 32-bit"))

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner