(defun c:LevelUpLikeMario (/)
(princ)
)
(LevelUpLikeMario)
Where is the command that currently works? If you want it to run every time a drawing is opened, add the command to the end of your routine, and have the routine set to autoload
so something like thisCode: [Select](defun c:LevelUpLikeMario (/)
(princ)
)
(LevelUpLikeMario)
(if *myCommandReactor*
(vlr-remove *myCommandReactor*)
)
(setq *myCommandReactor*
(vlr-command-reactor nil '((:vlr-commandwillstart . sstrtcmdRev)))
)
(defun sstrtcmdRev (rea lst)
(if (wcmatch (car lst) "*SAVE*") (updpRev))
)
(defun updpRev (/ acsum Rev)
(setq Rev (getvar "CTAB"))
(setq acsum
(vla-get-summaryinfo
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vla-put-revisionnumber acsum Rev)
)
If I look at the code in the first post I notice some issues:
1.
When the command name matches "*SAVE*" you define a function without executing it.
2.
Lines 14 and 15 are outside the function updpRev.
3.
Line 14 is not necessary.
Using a :vlr-commandwillstart reactor you should be able to react to the SAVE and QSAVE commands. But I would not attempt to react to the QUIT command.Code: [Select](if *myCommandReactor*
(vlr-remove *myCommandReactor*)
)
(setq *myCommandReactor*
(vlr-command-reactor nil '((:vlr-commandwillstart . sstrtcmdRev)))
)
(defun sstrtcmdRev (rea lst)
(if (wcmatch (car lst) "*SAVE*") (updpRev))
)
(defun updpRev (/ acsum Rev)
(setq Rev (getvar "CTAB"))
(setq acsum
(vla-get-summaryinfo
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vla-put-revisionnumber acsum Rev)
)