Author Topic: Check for AutoCAD or Bricscad  (Read 1781 times)

0 Members and 1 Guest are viewing this topic.

Atook

  • Swamp Rat
  • Posts: 1027
  • AKA Tim
Check for AutoCAD or Bricscad
« 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)

MatGrebe

  • Mosquito
  • Posts: 16
Re: Check for AutoCAD or Bricscad
« Reply #1 on: April 19, 2018, 02:24:23 AM »
Something like:
(defun IsBrx( / )
   (if (str-pos (getvar "acadver") "BricsCAD")
      T
      Nil
   )
)
Mathias

Atook

  • Swamp Rat
  • Posts: 1027
  • AKA Tim
Re: Check for AutoCAD or Bricscad
« Reply #2 on: April 19, 2018, 02:52:09 AM »
Something like:
(defun IsBrx( / )
   (if (str-pos (getvar "acadver") "BricsCAD")
      T
      Nil
   )
)
Mathias

Perfect. Thanks Mathias!

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Check for AutoCAD or Bricscad
« Reply #3 on: April 19, 2018, 04:06:02 AM »
Another:
Code: [Select]
(= "BRICSCAD" (strcase (getvar 'product)))

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Check for AutoCAD or Bricscad
« Reply #4 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. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Atook

  • Swamp Rat
  • Posts: 1027
  • AKA Tim
Re: Check for AutoCAD or Bricscad
« Reply #5 on: April 23, 2018, 04:43:51 PM »
Both also excellent, thank you.