Paul,
Using the Command function negates creating a Transparent AutoLISP command.
you must use ActiveX for this. Unfortunately, creating a Transparent command
in the Multiple Document Environment of AutoCAD 2000 is a little more
difficult. First, you have to create a function, Then you have to create a
Docmanager reactor to identify when switching between Active documents to
prevent a Document Mismatch Error. Then you must create a callback function
to redefine the commands for the Active Document. Here's an Example: (Watch
out for word-wrap in this E-mail)
;; Callback Function to redefine Commands in Active Doc.
(defun cmdredef (calbck cmd / return ok)
(foreach x ax:commandslist
(if (and
(member (type (eval (caddr x))) '(SUBR USUBR EXRXSUBR))
(setq ok (apply 'vlax-add-cmd (cdr x)))
)
(setq return (cons ok return))
)
)
return
)
;; This Function is Run at top level at load after Functions
;; are defined to Create the commands.
(defun addmdicmd (lst / old)
(foreach x lst
(vlax-remove-cmd (car x))
(if (setq old (assoc (strcase (car x)) ax:commandslist))
(setq ax:commandslist (subst (cons (strcase (car x)) x) old
ax:commandslist))
(setq ax:commandslist (cons (cons (strcase (car x)) x) ax:commandslist))
)
)
(if (not agc:addcmdreactor)
(setq agc:addcmdreactor
(vlr-docmanager-reactor
"AX-Commands"
'((:vlr-documentBecameCurrent . cmdredef))
)
)
)
(cmdredef nil nil)
)
;; Define Zoom>Extents function.
(defun ax-ze ()
(vla-zoomextents (vlax-get-acad-object))
(princ)
)
;; Add Command "ZE" to Command definitions...
(setq ax:cmdlst (cons (list "ZE" 'ax-ze "ZE" 1) ax:cmdlst))
;; Define Zoom>Previous function.
(defun ax-zp ()
(vla-zoomPrevious (vlax-get-acad-object))
(princ)
)
;; Add Command "ZP" to Command definitions...
(setq ax:cmdlst (cons (list "ZP" 'ax-zp "ZP" 1) ax:cmdlst))
;; Run (addmdicmd) to define commands. (must be done last!)
(addmdicmd ax:cmdlst)
Add the Contents of this in to a LISP file and load the LISP file in your
acaddoc.lsp
Hope this helps,
--
Phillip Kenewell
CAD Systems Technician
Air Gage Company
[email protected]
===================
Paul Li - adesknews.autodesk.com
wrote in message
news:[email protected]...
> Hi Phil,
>
> Can you go into more detail as to how you can create a transparent lisp
> command using Visual Lisp? I tried to do a transparent lisp zoom previous
> command and it did not work: