Jump to content

Recommended Posts

Posted

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)
       )

Posted

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

Posted

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.

 

:D

Posted

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))
)

Posted

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.

Posted

Your code looks fine Dave :thumbsup:

 

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)))

Posted
Your code looks fine Dave :thumbsup:

 

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...

Posted

> 18.99 handles the 19.0 19.1 etc no need for the = just not sure if ok for strings.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...