Ok, give this a try...
** Create a FIELD, DieselExpression > in the box for the DIESEL expression type:
$(getvar,users1)
** Place the FIELD - it will probably show "----"
Now load this LISP:
(defun c:FilenameReactor nil
(vl-load-com)
;; © Lee Mac ~ 27.05.10
( (lambda ( data foo / react )
(if
(setq react
(vl-some
(function
(lambda ( reactor )
(if (eq data (vlr-data reactor)) reactor)
)
)
(cdar (vlr-reactors :vlr-command-reactor))
)
)
(if (vlr-added-p react)
(vlr-remove react)
(vlr-add react)
)
(setq react
(vlr-command-reactor data
(list
(cons :vlr-CommandWillStart foo)
)
)
)
)
(princ
(if (vlr-added-p react)
"\n** Reactor Activated **"
"\n** Reactor Deactivated **"
)
)
react
)
"Filename-Reactor"
'Filename-CallBack
)
(princ)
)
(defun Filename-CallBack ( reactor args / pos str )
(if (wcmatch (strcase (car args)) "*REGEN*")
(progn
(setq dwg (getvar 'DWGPREFIX))
(and (eq "\\" (substr dwg (strlen dwg)))
(setq dwg (substr dwg 1 (1- (strlen dwg)))))
(and (setq pos (vl-string-position 92 dwg 0 t))
(setq str (substr dwg 1 pos))
(setq pos (vl-string-position 92 str 0 t))
(setq dwg (substr dwg (1+ pos)))
(setvar "USERS1" dwg)
)
)
)
(princ)
)
** Type "FilenameReactor" at the command line (only type this once... it is a toggle).
** Regen the drawing and hopefully smile
Or you can load and call the LISP first, then make the FIELD, whichever takes your fancy