Code Red > AutoLISP (Vanilla / Visual)
Detect autocad express tools installed
RAIN CODE:
Hi guys,
Just wondering - can autolisp able to detect if AutoCad Express Tools is installed ??
Thanks
CAB:
;; 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)
)
Lee Mac:
Something similar:
--- Code - Auto/Visual Lisp: ---(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))
MP:
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: ---(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)
)
--- End code ---
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: ---(defun expresstools-p ( )
(or
(member "acetutil.arx" (arx))
(and (findfile "acetutil.arx") (arxload "acetutil.arx" nil))
)
)
--- End code ---
But mommy, I need coffees. Bad.
Lee Mac:
You raise a good point MP, I hadn't considered the possibility of the Express Tools being unloaded. :-)
Navigation
[0] Message Index
[#] Next page
Go to full version