TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: RAIN CODE on November 02, 2014, 07:16:19 AM
-
Hi guys,
Just wondering - can autolisp able to detect if AutoCad Express Tools is installed ??
Thanks
-
;; 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)
)
-
Something similar:
(defun expresstools
-p
nil )
)
)
)
)
)
(expresstools-p)
)
-
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:
(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:
(defun expresstools-p ( )
(or
(member "acetutil.arx" (arx))
(and (findfile "acetutil.arx") (arxload "acetutil.arx" nil))
)
)
But mommy, I need coffees. Bad.
-
You raise a good point MP, I hadn't considered the possibility of the Express Tools being unloaded. :-)
-
:)
All said, it's kind of odd I barged my way into this discussion -- I'm a long time express tools use dissenter. :-D
-
What's this talk about express fools ? :-)
-
Is there a particular reason for using a catch-all-apply structure instead of:
(and acet-sys-shift-down)
-
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
-
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.
-
Welcome to the Dark Side, you'll never go back. :)
-
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'