TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Atook on April 19, 2018, 01:47:46 AM

Title: Check for AutoCAD or Bricscad
Post by: Atook on April 19, 2018, 01:47:46 AM
I'm netloading a .NET dll, and need to change the file name depending on whether the user is running bricscad or autocad. I'm having trouble figuring out how to test that though.

What expressions can I use in place of isAutoCAD and isBricsCAD?

Code - Lisp: [Select]
  1. (if (isAutoCAD)
  2.   (setq dllName "App_AutoCAD.dll")
  3. )
  4.  
  5. (if (isBricsCAD)
  6.   (setq dllName "App_Bricscad.dll")
  7. )
  8.  
  9. ;; netload the dll
  10. (setq dllPath (strcat installFolder "/" dllName))
  11. (command "._NETLOAD" dllPath)
Title: Re: Check for AutoCAD or Bricscad
Post by: MatGrebe on April 19, 2018, 02:24:23 AM
Something like:
(defun IsBrx( / )
   (if (str-pos (getvar "acadver") "BricsCAD")
      T
      Nil
   )
)
Mathias
Title: Re: Check for AutoCAD or Bricscad
Post by: Atook on April 19, 2018, 02:52:09 AM
Something like:
(defun IsBrx( / )
   (if (str-pos (getvar "acadver") "BricsCAD")
      T
      Nil
   )
)
Mathias

Perfect. Thanks Mathias!
Title: Re: Check for AutoCAD or Bricscad
Post by: roy_043 on April 19, 2018, 04:06:02 AM
Another:
Code: [Select]
(= "BRICSCAD" (strcase (getvar 'product)))
Title: Re: Check for AutoCAD or Bricscad
Post by: ronjonp on April 23, 2018, 09:59:29 AM
Assuming the dll has the same name as the product, you could do something like this too:

Code - Auto/Visual Lisp: [Select]
  1. (if (findfile (setq dll (strcat installfolder "\\App_" (getvar 'product) ".dll")))
  2.   ;; NET LOW ADD
  3.   (command "_.NETLOAD" dll)
  4.   (print (strcase (strcat dll " not found!")))
  5. )
Title: Re: Check for AutoCAD or Bricscad
Post by: Atook on April 23, 2018, 04:43:51 PM
Both also excellent, thank you.