Author Topic: Detect autocad express tools installed  (Read 4347 times)

0 Members and 1 Guest are viewing this topic.

RAIN CODE

  • Guest
Detect autocad express tools installed
« on: November 02, 2014, 07:16:19 AM »
Hi guys,

Just wondering - can autolisp able to detect if AutoCad Express Tools is installed ??

Thanks

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Detect autocad express tools installed
« Reply #1 on: November 02, 2014, 08:50:47 AM »
     ;; Set Express Tools Flag
     (if (vl-catch-all-error-p (vl-catch-all-apply '(lambda()(acet-sys-shift-down))))
       (alert "\n** ExpressTools not loaded. Some Functions May not be Available. **")
       (setq shiftOK T)
     )
« Last Edit: November 02, 2014, 09:09:56 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Detect autocad express tools installed
« Reply #2 on: November 02, 2014, 10:40:45 AM »
Something similar:

Code - Auto/Visual Lisp: [Select]
  1. (defun expresstools-p nil
  2.     (or (member "acetutil.arx" (arx))
  3.         (and (findfile "acetutil.arx") (arxload "acetutil.arx" nil))
  4.     )
  5.     (eval
  6.         (list 'defun 'expresstools-p nil
  7.             (not
  8.                 (vl-catch-all-error-p
  9.                     (vl-catch-all-apply
  10.                         (function (lambda nil (acet-sys-shift-down)))
  11.                     )
  12.                 )
  13.             )
  14.         )
  15.     )
  16.     (expresstools-p)
  17. )

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Detect autocad express tools installed
« Reply #3 on: November 02, 2014, 12:07:49 PM »
While Lee's expresstools-p is cleverly penned (as usual :)) it captures and subsequently reports a static snapshot of the acet call attempt for the dynamically defined version of self, which sports misleading results if the ET tools library is unloaded (arxunload "acetutil.arx") after expresstools-p has been called:

(expresstools-p)

T

(arxunload "acetutil.arx")

(expresstools-p)

T

(acet-sys-shift-down)

*kaboom*


This can be remedied by modifying expresstools-p thusly:

Code: [Select]
(defun expresstools-p nil
   (or (member "acetutil.arx" (arx))
       (and (findfile "acetutil.arx") (arxload "acetutil.arx" nil))
   )
   (eval
       (list 'defun 'expresstools-p nil
          '(not
               (vl-catch-all-error-p
                   (vl-catch-all-apply
                       (function (lambda nil (acet-sys-shift-down)))
                   )
               )
           )
       )
   )
   (expresstools-p)
)

That said, it still is not ideal, as expresstools-p will no longer make the attempt to load the ET library if the ET library is unloaded after it is called, merely returning nil:

(expresstools-p)

T

(arxunload "acetutil.arx")

(expresstools-p)

nil


So in the end, my sleep deprived brain thinks the more pragmatic albeit less sexy version merely need be:

Code: [Select]
(defun expresstools-p ( )
    (or
        (member "acetutil.arx" (arx))
        (and (findfile "acetutil.arx") (arxload "acetutil.arx" nil))
    )
)

But mommy, I need coffees. Bad.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Detect autocad express tools installed
« Reply #4 on: November 02, 2014, 12:27:01 PM »
You raise a good point MP, I hadn't considered the possibility of the Express Tools being unloaded.  :-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Detect autocad express tools installed
« Reply #5 on: November 02, 2014, 12:41:51 PM »
:)

All said, it's kind of odd I barged my way into this discussion -- I'm a long time express tools use dissenter.  :-D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Detect autocad express tools installed
« Reply #6 on: November 02, 2014, 09:35:32 PM »
What's this talk about express fools ?  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Detect autocad express tools installed
« Reply #7 on: November 03, 2014, 04:59:57 AM »
Is there a particular reason for using a catch-all-apply structure instead of:
Code: [Select]
(and acet-sys-shift-down)

RAIN CODE

  • Guest
Re: Detect autocad express tools installed
« Reply #8 on: November 04, 2014, 06:26:30 AM »
damn my pc conked off again the very same day it got repaired.

have to wait for it to repair before I could try these.

 thanks anyway

RAIN CODE

  • Guest
Re: Detect autocad express tools installed
« Reply #9 on: November 06, 2014, 04:52:20 AM »

While waiting for my PC to repair, I went thru a nos. of posting here. It really gives me a good impression that of all the autolisp Forum, I find TheSwamp is one of the best Forum around, with alot of people with excellant understanding of Autolisp programming.

To anyone (or my ex-colleagues) without the knowledge of Autolisp programmin, should start with the Basic.

You may not know what you are missing, programming is a wonderful ....hmm should I say hobby. When you find your program working the first time that feeling is undiscribeable. That kind of feeling is almost akin to...you know what I mean ...

More so if the program you wrote helps to shorthen your office work.




« Last Edit: November 06, 2014, 04:56:59 AM by RAIN CODE »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Detect autocad express tools installed
« Reply #10 on: November 06, 2014, 08:16:09 AM »
Welcome to the Dark Side, you'll never go back.  :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

RAIN CODE

  • Guest
Re: Detect autocad express tools installed
« Reply #11 on: November 07, 2014, 03:13:49 AM »
Welcome to the Dark Side, you'll never go back.  :)

CAB is one of the Jedi Master here which I really have high respects for his work. :)

Sorry for my bad English I think the word for that posting should be indescribeable also the word 'out' missing in 'missing'