dbroada Posted June 3, 2014 Posted June 3, 2014 I have a test in our netwok ACAD.LSP that checks the AutoCAD version and then loads either a 16 bit or 32 bit .dll file. (setq dir "P:\\Design_Office\\SupportFiles\\" dll (if (= 19.0 (atof (getvar 'acadver))) "RA_DesignOffice(2013).dll" "RA_DesignOffice.dll") loc (strcat "C:\\" dll) net (strcat dir dll) ) It has been revealed today that at least one macine in the company is ACADVER = 19.1 Therefore I want to check for versions above 19.0 but am confused by the syntax. Is the following correct? (setq dir "P:\\Design_Office\\SupportFiles\\" dll (if (>= (atof (getvar 'acadver)) 19.0) "RA_DesignOffice(2013).dll" "RA_DesignOffice.dll") loc (strcat "C:\\" dll) net (strcat dir dll) ) Quote
MSasu Posted June 3, 2014 Posted June 3, 2014 Yes, your syntax is right; that is equivalent with: (atof (getvar 'acadver)) >= 19.0 One note, the ACADVER system variable may contains non-numeric characters, too; but don't have to worry on that since AutoLISP will not reject such input, but will return the leading numerical part. (atof "19.0x") ;return 19.0 Quote
dbroada Posted June 3, 2014 Author Posted June 3, 2014 Thanks Mircea. I thought I had got it right but as some of the machines are in India and some in the UK I thought I had better check first. I had spotted that the ACADVER did give some extra non-numeric characters and was about to find how to strip them away but realised that it already worked (no surprise there, Lee put it right for me last time) so I expected it to work this time. Quote
VVA Posted June 3, 2014 Posted June 3, 2014 Some functions to check the bit version of AutoCAD (defun Acad64Bit-version () ;;;http://forum.dwg.ru/showthread.php?t=31568 ;;; Return T if Acad x64 or nil if Acad x32 (vl-load-com) (> (strlen (vl-prin1-to-string (vlax-get-acad-object))) 40) ) (defun gc:IsAcad64 () (vlax-property-available-p (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) 'ObjectId32 ) ) And version (defun whatAcadVer ( / Aver) ;;;Get from Elpanov Evgeniy http://www.theswamp.org/index.php?topic=36606.msg416187 (atoi (substr (ver) 13)) ) Quote
dbroada Posted June 3, 2014 Author Posted June 3, 2014 Thanks VVA. That will certainly be more flexible for us. My way was fine when we just had 4 identical machines in one office. Now the variations are coming along and the machines are now overseas it is not so easy. The worldwide company policy is for all machines to have identical software installed but this is clearly not the case here. Quote
Lee Mac Posted June 3, 2014 Posted June 3, 2014 Your code looks fine Dave Personally, I very rarely use the > & >= functions (if at all), as I find it far more readable to use only So your example could be written: (<= 19 (atof (getvar 'acadver))) Quote
LibertyOne Posted June 3, 2014 Posted June 3, 2014 Your code looks fine Dave Personally, I very rarely use the > & >= functions (if at all), as I find it far more readable to use only So your example could be written: (<= 19 (atof (getvar 'acadver))) interesting way to look at that, Lee... Quote
BIGAL Posted June 4, 2014 Posted June 4, 2014 > 18.99 handles the 19.0 19.1 etc no need for the = just not sure if ok for strings. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.