TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Keith™ on May 03, 2006, 08:57:10 PM

Title: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: Keith™ on May 03, 2006, 08:57:10 PM
Ok, I know I have done this in the past, but for some strange reason I am drawing a blank right now.

I have an ActiveX dll that I am loading via lisp to expose the properties and methods defined in the dll to Autocad. The problem is that AutoCAD 2000 requires that all forms be modal while 2002+ allows modeless forms. If I try to start the modeless form in A2k, an error is generated that requires that AutoCAD be restarted. This is obviously not a good thing since this application "may" be used in many different versions. So ... I need to accurately be able to differentiate between A2k and A2k2.  A2k4+ is a breeze because (ver) returns something other than 2000 ... but 2002 returns 2000.

I thank you in advance for your help.
Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: MP on May 03, 2006, 09:01:04 PM
(atoi (getvar "acadver")) ?
Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: Keith™ on May 03, 2006, 09:09:38 PM
Unfortunately acadver returns 15.xx for both AutoCAD 2000 and 2002 .. in order for me to properly distinguish between the two, I would need to know the exact breaking point in the incrementation i.e. AutoCAD 2000 stops at 15.03 and 2002 starts at 15.04 or something along that line.
Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: Chuck Gabriel on May 03, 2006, 09:19:33 PM
How about the undocumented system variable _VERNUM?
Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: MP on May 03, 2006, 09:21:01 PM
See link (http://www.hyperpics.com/downloads/resources/customization/autolisp/AutoCAD%20System%20Variables.pdf).

...
15.0 = 2000
15.05 = 2000i
15.06 = 2002
...

Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: Chuck Gabriel on May 03, 2006, 09:30:21 PM
Oops.  Misread Keith's last post.  Sorry.
Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: Keith™ on May 03, 2006, 09:33:57 PM
Thank you ... that should do the trick

Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: MP on May 03, 2006, 09:47:14 PM
My pleasure sir.
Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: Keith™ on May 03, 2006, 10:00:29 PM
Incidently have you had any experience with deploying an ActiveX exe across multiple versions of AutoCAD?
I have found that if I compile as a DLL, I must make some changes to my code to get it to work with 2000 (I wish the users would just upgrade) but I can use an exe in a seperate thread and just invoke marshalling ... Poor solution, but one that might encourage the users to upgrade ... maybe ... anyway,  If I make it an activeX exe I can get both out of the same executable without any code changes .. at least I think I can ...
Title: Re: Programmatically tell the difference between AutoCAD 2000 and 2002
Post by: MP on May 03, 2006, 11:42:32 PM
Sorry Keith, everything I've done has been for 2002 and above, tho predominantly 2002 (even tho I run 2006 at home client #1 is still using 2002). Also, the dll's I've written have been primarily formless (like wrappers for things like ado or non activex win32 calls). Finally, the activex gui stuff I have done has always been modal (has run successfully in 2002 thru 2006 without need for recompile).

Re: activex exes -- I've never done any because I had the perception (perhaps unfairly) that performance would be sluggish because it wouldn't be run in-process (the marshalling you made reference to). Guess I should profile the difference sometime.

I apologise -- none of the above is useful info.